作者: Jet L

  • 【MEME】用APT打开APT.(《APT.》中的Linux梗)

    近日《APT.》这首歌爆火,听着确实洗脑,稍微接触过Linux的人可能立马就能联想到Linux中的APT包管理器,网络上也即刻出现了相关的Linux MEME,比如这条搬运自Reddit的视频:

    其中用Linux命令复刻了一些歌词,让人会心一笑,如果你看不懂的话,让我们一行行看看它究竟哪里好玩:

    视频第一行是一个安装APT包管理器的代码,当然实际安装时候应该是小写的apt,作者应该是为了对应《APT.》这个曲名,将结尾改成了APT.

    这部分对应歌词,当然没有办法实际运行,just for fun!

    对应歌词:Kissy face, kissy face Sent to your phone but,图片意为使用POST方法向服务器IP发送请求,一般的写法是:

    MESSAGE="Hello Wordl!"
    curl -X POST -d "message=$MESSAGE" http://192.168.1.10

    对应歌词:I’m trying to kiss your lips for real,图片中代码是使用Telnet链接远程主机发送明码信息,一般写法是:

    echo "123" | telnet ip.address port

    对应歌词:Red hearts, red hearts,That’s what I’m on yeah

    cd的意思是改变目录,pwd是打印工作目录,用以显示当前工作目录的绝对路径。

    对应歌词:Come give me something I can feel,图片代码运行时候会在终端提示输入信息,前面显示的便是“Come give me something I can feel”,效果类似:

    Come give me something I can feel: [用户输入]

    对应歌词:Don’t you want me like I want you, baby,Don’t you need me like I need you now,图片中的代码前两行提示是没有足够的权限,sudo则是提权操作,还找不到说明对方心里压根没你(笑)

    对应歌词:Sleep tomorrow but tonight go crazy ,图片中代码是启动 10 个并行的进程,每个进程从 /dev/urandom 获取 100 字节的随机数据,然后脚本会暂停 24 小时,最后通过 killall sleep 终止所有 sleep 进程。当然这段你仔细想想,想歪一些会更疯狂(笑)

    对应歌词:All you gotta do is just meet me at the APT.图片中的命令意思是通过命令行与目标主机建立连接,你和我都相聚在APT.嘛这个意思,非常有趣。当然一般的写法是类似:

    ssh APT@192.168.1.100 &

  • 【网站】WordPress使用Google Analytics代码的简单方法

    写在前面:谷歌分析会被浏览器的反广告和反追踪插件屏蔽,因此搜集到的数据可能有很大缺失。

    方法一:通过页眉+自定义HTML实现

    一般的网站页眉部分是统一的,如果不是的话,可以设置一个统一的空白的页眉,只需要将Google Analytics提供的script代码以HTML区块的方式粘贴到页眉部分即可全站启用,并为全站提供分析代码。

    方法二:通过模板函数实现(更推荐)

    使用类似的代码,插入到主题模板函数中,这样可以直接在Header中进行加载。

    // Function to add Google Analytics
    function add_google_analytics() {
        ?>
    <!-- Google tag (gtag.js) -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> // 替换你的ID
        <script>
          window.dataLayer = window.dataLayer || [];
          function gtag(){dataLayer.push(arguments);}
          gtag('js', new Date());
          gtag('config', 'GA_TRACKING_ID'); // 替换你的ID
        </script>
        <!-- End Google Analytics -->
        <?php
    }
    add_action('wp_head', 'add_google_analytics');

  • 【音乐】《Data & Picard》——听不懂,但,好听!

    这首歌曲是 YouTube博主——Pogo 的作品,一首有关《星际迷航》的混音作品,注意是混音作品,所以这流畅的听感,洗脑的旋律,真是太强了。

    作者在作品发布页写道:

    Temba, his arms wide! In Tamarian this signifies the giving of a gift, first heard in the excellent episode Darmok. Data & Picard is my tribute to one of the greatest TV series of all time. It is an original track featuring the voices of Captain Picard (Patrick Stewart) and Commander Data (Brent Spiner), accompanied by a music video I shot entirely in my living room with a green screen and lights.

    The track opens with the Klingon Victory Song, followed by a remix of Data singing Che Gelida Manina in the episode ‘In Theory’. This episode was the first ever to be directed by Patrick Stewart and I didn’t realize this until after the track was finished.

    我是没看过星际迷航的,所以只能写一些关于本曲的感受:

    第一次听:这是什么东西

    第二次听:好像有点意思

    第三次听:se la laaaa-sci riscaldar!

    一种不知道哪里冒出来的,又老又新的奇特感受,同时异常洗脑。

    关于本曲MV:

    作者写道:

    I sourced the Ben Nye makeup that was used to turn Spiner into Data, and a replica of the iconic Star Fleet uniform. Unfortunately I couldn’t get the contact lenses in and I could only get the uniform in red, so I spent a huge amount of time changing the colour of my eyes and uniform in post.

    The video was shot in Slog 4k ProRes HQ using a Sony A7SII and an Atomos Ninja Flame. Lights included 3x Arri 800w Tungstens, 2x Socanland LED banks to light the screen, and one 2000w Blonde to simulate sunlight. BIG thanks to the guys at HD Rentals in Perth for helping me out.

  • 【音乐】《La La La》——蹬车神曲

    想必听过该曲子的朋友们都拥有一辆山地自行车吧()

    B站UP主:“尽墨for车”多次使用该曲在山地自行车比赛中,如此的节奏伴随惊险刺激的山地车比赛画面,谁听完不想下去蹬一圈呢?那么,加油吧!蹬洋车子的大哥哥(

    关于本曲:

    Midnight Generation 是一支来自墨西哥北部的流行乐队,互联网上的信息也不是很多。

    在这张《Funk Your Bones (Side B)》专辑里的《Young Girl》也很好听,十分推荐。

    Live版:

  • 【网站】为WordPress添加APlayer播放器

    引入方式类似prism,由于使用概率较大,因此在主题模板函数中进行全局引入:

    // Function to add APlayer.mini.css and APlayer.mini.js to the site
    function add_APlayer() {
        
        wp_register_style(
            'APlayerCSS', // handle name for the style 
            get_stylesheet_directory_uri() . '/APlayer.css' // location of the file
        );
    
        wp_register_script(
            'APlayerJS', // handle name for the script 
            get_stylesheet_directory_uri() . '/APlayer.js' // location of the file
        );
    
        // Enqueue the registered style and script files
        wp_enqueue_style('APlayerCSS');
        wp_enqueue_script('APlayerJS');
    }
    add_action('wp_enqueue_scripts', 'add_APlayer');

    然后采用 APlayer官方文档 中描述的方式引入:

    <div id="aplayer">
    </div>
    <script>
    const ap = new APlayer({
        container: document.getElementById('aplayer'),
        audio: [{
            name: '',
            artist: '',
            url: '',
            cover: ''
        }]
    });
    </script>

  • 【Python】对本地网页进行元素提取并输出Excel

    一些网页通过加载Js来保护页面元素,当我们突破Js得到本地页面时,可以使用BS4库对页面进行分析,提取对应的元素来综合有价值的内容。

    示例代码:

    import requests
    from bs4 import BeautifulSoup
    import pandas as pd
    
    # 发送请求并获取网页内容
    url = 'your_local_or_online_page_url'
    response = requests.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')
    
    # 定义一个空的列表来存储提取的数据
    data = []
    
    # 遍历页面中的项目列表,假设项目数据都在某个父元素中
    projects = soup.find_all('tr', class_='project-id')  # 根据实际情况修改选择器
    
    # 提取每个项目的各项数据
    for project in projects:
        # 获取项目ID
        project_id = project.find('td', class_='project-id-class').get_text(strip=True)  # 修改为实际选择器
        
        # 将提取的数据添加到列表中
        data.append([project_id]) # 按实际修改
    
    # 创建 DataFrame 并保存为 Excel
    df = pd.DataFrame(data, columns=['ID']) # 按实际修改
    df.to_excel('projects_data.xlsx', index=False)
    
    print("Data has been successfully extracted and saved to 'projects_data.xlsx'.")

    主要用到了BS4库。

    示意代码:

    from bs4 import BeautifulSoup
    
    # 假设有一个HTML文档
    html_doc = """
    <html>
      <head><title>Example Page</title></head>
      <body>
        <p class="title"><b>Sample Page</b></p>
        <p class="story">This is a test story. <a href="http://example.com/1" class="link">link1</a> <a href="http://example.com/2" class="link">link2</a></p>
        <p class="story">Another test story.</p>
      </body>
    </html>
    """
    
    # 使用 BeautifulSoup 解析 HTML 文档
    soup = BeautifulSoup(html_doc, 'html.parser')
    
    # 提取<title>标签的内容
    title = soup.title.string
    print(f"Title: {title}")
    
    # 提取所有的链接(<a> 标签)
    links = soup.find_all('a')
    for link in links:
        print(f"Link text: {link.string}, URL: {link['href']}")
    
    # 查找特定类的<p>标签
    story_paragraphs = soup.find_all('p', class_='story')
    for p in story_paragraphs:
        print(f"Story paragraph: {p.get_text()}")

  • 【HTML】iframe小工具——提取嵌入链接并重设参数

    一般类似YouTube、Bilibili的分享链接,都设置了各自网站的相应参数,为了快速提取其src内容并自定义部分参数,可以使用该小工具进行快速设置。

    操作区
    预览展示区
    查看代码

    <style>
            textarea, input, select {
                width: 100%;
                margin-bottom: 10px;
                padding: 5px;
                font-size: 14px;
            }
            button {
                font-size: 16px;
                margin-bottom: 10px;
                padding: 5px 10px;
            }
            .link-container {
                margin-top: 10px;
            }
            .link-item {
                margin-bottom: 5px;
            }
            .iframe-preview {
                margin-top: 20px;
                padding: 10px;
                border: 1px solid #ddd;
                background: #f9f9f9;
            }
            .iframe-preview pre {
                font-size: 14px;
                background: #e9e9e9;
                padding: 10px;
                border-radius: 5px;
            }
            .row {
                display: flex;
                flex-wrap: wrap;
                gap: 10px;
            }
            .col {
                flex: 1 1 20%;
            }
            .col input, .col select {
                width: 100%;
            }
            .unit-select {
                width: 10px; /*缩小单位选择框宽度*/
            }
            .empty-option {
                font-size: 14px;
            }
            #iframePreviewContainer {
                margin-top: 20px;
            }
        </style>
    </head>
    <body>
        <!-- 输入框 -->
        <textarea id="iframeInput" placeholder="在此输入多个 iframe 代码"></textarea>
        <button id="extractButton">提取链接</button>
    
        <!-- 链接展示区 -->
        <div id="result" class="link-container"></div>
    
        <!-- 单个链接操作区 -->
        <h2>操作区</h2>
        <input id="selectedLink" type="text" placeholder="点击复制按钮后,链接将填入此处" readonly>
        
        <!-- iframe 属性设置 -->
        <div class="row">
            <div class="col">
                <label for="iframeTitle">标题:</label>
                <input id="iframeTitle" type="text" placeholder="请输入 iframe 标题">
            </div>
            <div class="col">
                <label for="iframeWidth">宽度:</label>
                <input id="iframeWidth" type="text" placeholder="例如 560">
            </div>
            <div class="col">
                <label for="iframeWidthUnit">宽度单位:</label>
                <select id="iframeWidthUnit" class="unit-select">
                    <option value="px">px</option>
                    <option value="%">%</option>
                    <option value="vw">vw</option>
                </select>
            </div>
            <div class="col">
                <label for="iframeHeight">高度:</label>
                <input id="iframeHeight" type="text" placeholder="例如 315">
            </div>
            <div class="col">
                <label for="iframeHeightUnit">高度单位:</label>
                <select id="iframeHeightUnit" class="unit-select">
                    <option value="px">px</option>
                    <option value="%">%</option>
                    <option value="vh">vh</option>
                </select>
            </div>
        </div>
    
        <div class="row">
            <div class="col">
                <label for="iframeFullscreen">允许全屏:</label>
                <select id="iframeFullscreen">
                    <option value="allowfullscreen">是</option>
                    <option value="">否</option>
                </select>
            </div>
            <div class="col">
                <label for="iframeReferrer">Referrer Policy:</label>
                <select id="iframeReferrer">
                    <option value="no-referrer">不发送</option>
                    <option value="no-referrer-when-downgrade">仅同源</option>
                    <option value="origin">仅发送源</option>
                    <option value="origin-when-cross-origin">跨源时发送源</option>
                    <option value="same-origin">同源发送完整路径</option>
                    <option value="strict-origin">严格同源发送源</option>
                    <option value="strict-origin-when-cross-origin">默认(严格同源)</option>
                    <option value="unsafe-url">发送完整 URL</option>
                    <option value="">保持空值</option>
                </select>
            </div>
            <div class="col">
                <label for="iframeLoading">加载方式:</label>
                <select id="iframeLoading">
                    <option value="eager">立即加载</option>
                    <option value="lazy">懒加载</option>
                    <option value="">保持空值</option>
                </select>
            </div>
            <div class="col">
                <label for="iframeAutoplay">自动播放:</label>
                <select id="iframeAutoplay">
                    <option value="autoplay">是</option>
                    <option value="">否</option>
                </select>
            </div>
        </div>
    
        <div class="row">
            <div class="col">
                <label for="iframeEncrypted">加密媒体:</label>
                <select id="iframeEncrypted">
                    <option value="encrypted-media">是</option>
                    <option value="">否</option>
                </select>
            </div>
            <div class="col">
                <label for="iframePictureInPicture">画中画:</label>
                <select id="iframePictureInPicture">
                    <option value="picture-in-picture">是</option>
                    <option value="">否</option>
                </select>
            </div>
            <div class="col">
                <label for="iframeWebShare">Web分享:</label>
                <select id="iframeWebShare">
                    <option value="web-share">是</option>
                    <option value="">否</option>
                </select>
            </div>
        </div>
    
        <!-- 生成 iframe 和复制按钮 -->
        <div>
            <button id="generateIframeButton">生成 iframe 嵌入代码</button>
            <button id="copyIframeButton">复制生成代码</button>
        </div>
    
        <!-- iframe 代码展示 -->
        <div id="generatedIframe" class="iframe-preview">
            <textarea id="iframeCodeText" readonly rows="10"></textarea>
        </div>
    
        <!-- iframe 预览展示区 -->
        <div id="iframePreviewContainer" class="iframe-preview">
            <h2>预览展示区</h2>
            <iframe id="iframePreview" src="" width="560" height="315" style="border: none;"></iframe>
        </div>
    
        <script>
            // 缓存常用的 DOM 元素
            const iframeWidthInput = document.getElementById('iframeWidth');
            const iframeHeightInput = document.getElementById('iframeHeight');
            const iframeWidthUnit = document.getElementById('iframeWidthUnit');
            const iframeHeightUnit = document.getElementById('iframeHeightUnit');
            const selectedLinkInput = document.getElementById('selectedLink');
            const iframeFullscreenSelect = document.getElementById('iframeFullscreen');
            const iframeReferrerSelect = document.getElementById('iframeReferrer');
            const iframeLoadingSelect = document.getElementById('iframeLoading');
            const iframeAutoplaySelect = document.getElementById('iframeAutoplay');
            const iframeEncryptedSelect = document.getElementById('iframeEncrypted');
            const iframePictureInPictureSelect = document.getElementById('iframePictureInPicture');
            const iframeWebShareSelect = document.getElementById('iframeWebShare');
            const iframeTitleInput = document.getElementById('iframeTitle');
            const generateIframeButton = document.getElementById('generateIframeButton');
            const copyIframeButton = document.getElementById('copyIframeButton');
            const iframeCodeText = document.getElementById('iframeCodeText');
            const iframePreview = document.getElementById('iframePreview');
            const resultDiv = document.getElementById('result');
    
            // 提取 iframe src 链接
            function extractSrc() {
                const input = document.getElementById('iframeInput').value;
                resultDiv.innerHTML = ''; // 清空之前的结果
    
                const srcMatches = [...input.matchAll(/src="([^"]+)"/g)];
                if (srcMatches.length > 0) {
                    const srcLinks = srcMatches.map(match => match[1]);
    
                    srcLinks.forEach(link => {
                        const linkItem = createLinkItem(link);
                        resultDiv.appendChild(linkItem);
                    });
                } else {
                    resultDiv.textContent = '没有找到有效的 iframe 链接';
                }
            }
    
            // 创建链接项
            function createLinkItem(link) {
                const div = document.createElement('div');
                div.classList.add('link-item');
    
                const textNode = document.createTextNode(link);
                const copyButton = document.createElement('button');
                copyButton.textContent = '复制';
                copyButton.onclick = function() {
                    selectedLinkInput.value = link;
                };
    
                div.appendChild(textNode);
                div.appendChild(copyButton);
                return div;
            }
    
            // 生成 iframe 代码
            function generateIframeCode() {
                const width = iframeWidthInput.value;
                const height = iframeHeightInput.value;
                const widthUnit = iframeWidthUnit.value;
                const heightUnit = iframeHeightUnit.value;
                const title = iframeTitleInput.value;
                const src = selectedLinkInput.value;
                const fullscreen = iframeFullscreenSelect.value;
                const referrer = iframeReferrerSelect.value;
                const loading = iframeLoadingSelect.value;
                const autoplay = iframeAutoplaySelect.value;
                const encrypted = iframeEncryptedSelect.value;
                const pictureInPicture = iframePictureInPictureSelect.value;
                const webShare = iframeWebShareSelect.value;
    
                let iframeCode = `<iframe src="${src}"`;
    
                if (title) {
                    iframeCode += ` title="${title}"`;
                }
                iframeCode += ` width="${width}${widthUnit}" height="${height}${heightUnit}"`;
    
                if (fullscreen) {
                    iframeCode += ` ${fullscreen}`;
                }
    
                if (referrer) {
                    iframeCode += ` referrerpolicy="${referrer}"`;
                }
    
                if (loading) {
                    iframeCode += ` loading="${loading}"`;
                }
    
                if (autoplay) {
                    iframeCode += ` ${autoplay}`;
                }
    
                if (encrypted) {
                    iframeCode += ` ${encrypted}`;
                }
    
                if (pictureInPicture) {
                    iframeCode += ` ${pictureInPicture}`;
                }
    
                if (webShare) {
                    iframeCode += ` ${webShare}`;
                }
    
                iframeCode += '></iframe>';
    
                iframeCodeText.value = iframeCode;
                iframePreview.src = src;
            }
    
            // 复制代码到剪贴板
            function copyIframeCode() {
                iframeCodeText.select();
                document.execCommand('copy');
            }
    
            // 事件监听
            document.getElementById('extractButton').addEventListener('click', extractSrc);
            generateIframeButton.addEventListener('click', generateIframeCode);
            copyIframeButton.addEventListener('click', copyIframeCode);
        </script>
    </body>
  • 【摄影特辑】青岛2023

    【摄影特辑】青岛2023

    镜头:Panasonic 30mm Macro

    相机:Panasonic G9M2

    后期:Snapseed

    很荣幸,第二张图片还被松下影像翻了牌子

  • 【音乐】《踊り子》(舞女)——Vaundy与小松菜奈的奇妙配合

    歌词

    ねぇ、どっかに置いてきたような

    事が一つ二つ浮いているけど

    ねぇ、ちゃんと拾っておこう

    はじけて忘れてしまう前に

    ねぇ 回り出した あの子と僕の未来が

    止まりどっかで またやり直せたら

    回り出した あの子と僕が被害者

    づらでどっかを また練り歩けたらな

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    あのね、私あなたに会ったの

    夢の中に置いてきたけどね

    ねぇ、どうして私が好きなの

    一度しか会ったことがないのにね

    ああ 思いを蹴って

    二人でしてんだ

    壊(わす)れない愛を歌う

    言葉を二人に課して

    誓いをたてんだ

    忘れない愛を歌うようにね

    回り出した あの子と僕の未来が

    止まりどっかで またやり直せたら

    回り出した あの子と僕が被害者

    づらでどっかを また練り歩けたらな

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とうるるる とぅるる

    とぅるるる とうるるる とぅるる

    とぅるるる とうるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    回り出した あの子と僕の未来が

    止まりどっかで またやり直せたら

    回り出した あの子と僕が被害者

    づら でどっかを また練り歩けたらな

    時代に乗って僕たちは

    変わらず愛に生きるだろう

    僕らが散って残るのは

    変わらぬ愛の歌なんだろうな

    時代に乗って僕たちは

    変わらず愛に生きるだろう

    僕らが散って残るのは

    変わらぬ愛の歌なんだろうな

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    とぅるるる とぅるるる とぅるる

    《踊り子》(舞女)是音乐鬼才Vaundy作词、作曲、演唱的一首歌曲,没错,虽然MV里面是小松菜奈,但是整个曲子都是由Vaundy所演唱,慵懒的嗓音配上小松竟也没有很违和。

    VIA Wiki:谈到 MV 拍摄,小松说:“一整天,’Dancer’一直在我的脑海中一遍又一遍地旋转,我能够旋转、旋转、旋转、奔跑,我能够一直跳舞,一首让我想跳舞的歌,我自由地摇晃着身体,转眼间就过去了,我能够度过一段快乐的时光!我回头看。 Vaundy 也出席了拍摄现场,小松评论道:“这是一次友好而愉快的拍摄,因为 Vaundy 在现场一起享受它。

    该曲2021年11月17日发布,Billboard JAPAN最高排名15位。

    MV也是4:3画幅,但是官方上传的视频是16:9,两侧有黑边,截图时候批量去除了。

  • 【Python】裁切图片为指定画幅比例

    该工具是在截取MTV的画面时产生的需求,一些4:3画幅的视频制作时候加入了黑边,成了16:9视频,因此想截图出原本4:3的画面,一方面可以进剪辑软件进行直接裁剪,也可以在原视频进行导出后操作,考虑到二压费时费力,因此选择对截取的图片进行批处理。

    import os
    import random
    import string
    from tkinter import Tk, filedialog, Button, Label, messagebox
    from PIL import Image
    
    
    def random_filename(extension):
        """生成随机文件名"""
        chars = string.ascii_letters + string.digits
        return ''.join(random.choices(chars, k=8)) + f".{extension}"
    
    
    def crop_to_aspect(image, target_ratio=4/3):
        """裁剪图像宽边以符合指定宽高比"""
        width, height = image.size
        current_ratio = width / height
    
        if current_ratio > target_ratio:  # 如果宽高比大于目标比例,宽度过大
            new_width = int(height * target_ratio)  # 计算符合比例的新宽度
            left = (width - new_width) // 2  # 左侧裁剪量
            right = left + new_width  # 右侧裁剪量
            image = image.crop((left, 0, right, height))  # 裁剪左右宽边
    
        return image
    
    
    def process_images():
        """处理图片并保存结果"""
        input_files = filedialog.askopenfilenames(
            title="选择图片文件",
            filetypes=[("Image Files", "*.jpg *.png")]
        )
        if not input_files:
            return
    
        output_dir = filedialog.askdirectory(title="选择输出文件夹")
        if not output_dir:
            return
    
        for file_path in input_files:
            try:
                with Image.open(file_path) as img:
                    # 转换为符合比例的图片
                    processed_img = crop_to_aspect(img)
                    # 保存文件
                    ext = file_path.split('.')[-1]
                    output_path = os.path.join(output_dir, random_filename(ext))
                    processed_img.save(output_path)
            except Exception as e:
                messagebox.showerror("错误", f"处理文件 {file_path} 时出错: {e}")
                continue
    
        messagebox.showinfo("完成", "图片批量处理完成!")
    
    
    def create_gui():
        """创建GUI"""
        root = Tk()
        root.title("图片批量处理工具")
        root.geometry("400x200")
    
        Label(root, text="批量处理图片 - 保持高度裁切宽边为4:3比例").pack(pady=20)
        Button(root, text="选择图片并处理", command=process_images).pack(pady=10)
        Button(root, text="退出", command=root.quit).pack(pady=10)
    
        root.mainloop()
    
    
    if __name__ == "__main__":
        create_gui()