作者: evan

  • minio搭配PicGo图床插件使用

    minio搭配PicGo图床插件使用

    MinIO 搭配 PicGo 图床插件使用指南

    部署 MinIO

    首先,我们需要通过 Docker Compose 部署 MinIO。以下是一个示例的 docker-compose.yml​ 文件:

    version: '3'
    services:
      minio:
        image: minio/minio:RELEASE.2024-11-07T00-52-20Z
        hostname: "minio"
        ports:
          - "9000:9000" # API 端口
          - "9001:9001" # 控制台端口
        environment:
          MINIO_ACCESS_KEY: admin    # 管理后台用户名
          MINIO_SECRET_KEY: tyw123456   # 管理后台密码,最小8个字符
        volumes:
          - ./data:/data               # 映射当前目录下的data目录至容器内/data目录
          - ./config:/root/.minio/     # 映射配置目录
        command: server --console-address ':9001' /data  # 指定容器中的目录 /data
        privileged: true
        restart: "no"
    

    参考:GitHub 项目链接

    启动服务:

    docker compose up
    

    服务启动后,可以通过以下地址访问:

    # 账号
    admin/tyw123456
    
    # 后台管理地址
    http://127.0.0.1:9001
    
    # API地址
    http://127.0.0.1:9000
    

    MinIO 配置

    创建 Bucket

    1. 登录到 MinIO 后台管理界面:http://localhost:9001/
    2. 导航到 Administrator -> Buckets -> Create bucket
    3. 直接点击确定即可创建 Bucket。

    创建 Bucket1

    修改权限

    如果 Bucket 需要作为公共图床使用,建议将访问权限设置为 Public。操作步骤如下:

    1. 导航到 Administrator -> Buckets -> Summary -> Access Policy
    2. 将访问策略设置为 Public。

    修改权限

    配置 Access Keys

    1. 导航到 User -> Access Keys -> Create access key
    2. 创建新的 Access Key。

    配置 Access Keys

    配置 Region

    1. 导航到 Administrator -> Configuration -> Region
    2. 配置 Region,这一步非常重要,后续配置会用到。

    配置 Region

    配置 PicGo 图床

    新建 S3 图床配置

    1. 在 PicGo 中新建一个 S3 图床配置,或者使用默认配置。
    2. 修改配置如下:
    # AccessKeyId
    # 使用前面步骤创建的
    
    # SecretAccessKey
    # 使用前面步骤创建的
    
    # 设定Bucket
    # 使用前面创建的名称
    
    # 设定上传路径
    # 默认即可
    
    # 设定Region
    # 使用前面步骤创建的
    
    # 设定自定义节点
    # 本地就是:http://127.0.0.1:9000
    
    # 其他选项酌情默认配置即可
    

    配置 PicGo

    选择配置并上传

    1. 在 PicGo 中选择刚刚配置的 S3 图床。
    2. 在图片右侧菜单点击上传到 PicGo 图床即可。

    上传图片

    完结撒花 🎉

    至此,MinIO 搭配 PicGo 图床插件的配置和使用已经完成。希望这篇指南对你有所帮助!


  • 【思源插件推荐】发布工具——快速输出你的内容

    【思源插件推荐】发布工具——快速输出你的内容

    【思源插件推荐】发布工具——快速输出你的内容


      • 【思源插件推荐】发布工具——快速输出你的内容 - 知乎专栏
      • https://zhuanlan.zhihu.com/p/660341957
      • 如果要把思源里的内容发布到各个博客平台该怎么弄?你可以先将笔记导出 Markdown 文本,然后导入到各个博客平台,也可以直接全选复制,粘贴到平台的编辑页面上。但无论是以 Markdown 文本导入还是复制粘贴,如何处…
      • 2025-03-07 17:37:34

    如果要把思源里的内容发布到各个博客平台该怎么弄?你可以先将笔记导出 Markdown
    文本,然后导入到各个博客平台,也可以直接全选复制,粘贴到平台的编辑页面上。但无论是以 Markdown 文本导入还是复制粘贴,如何处理图片,是一个令人头大的问题。

    好在插件市场有“发布工具
    ”,这款插件能解决将思源中的笔记发布到各个平台上的问题,方便你快速输出你的内容。

    本文将以“将思源中的笔记发布到​知乎​”为例,来介绍这款插件。11


    1. 插件的安装

    在插件市场中找到“发布工具”,下载安装并启用。

    【思源插件推荐】发布工具——快速输出你的内容

    ​启用后,发现顶栏左上角多了一个“小飞机”的标志。


    2. 配置发布平台

    点击“小飞机”,打开“发布设置”。

    【思源插件推荐】发布工具——快速输出你的内容

    ​这里以配置知乎平台为例。在“发布配置”中找到“知乎”并启用。

    【思源插件推荐】发布工具——快速输出你的内容

    启用后点击“授权”后确定,会弹出一个知乎的登录窗口,然后输入你的知乎账号和密码进行登录。登录成功后点击“验证”即可完成配置。

    【思源插件推荐】发布工具——快速输出你的内容


    3. 发布文章

    授权成功后,再点击“小飞机”,可以看到在“一键发布”上多了一个“知乎”的选项。

    【思源插件推荐】发布工具——快速输出你的内容

    此时打开你想发布的文章,用“小飞机”一键发布即可。


    4. 排版优化

    使用当前版本的插件将文章发布到知乎上时,会有排版段落间距过宽的问题,如果你不介意排版的话倒是问题不大。

    当然,想我这种强迫症患者是忍受不了排版过于松散的。所以我会在知乎的编辑器上修改排版。

    注意​:如果在知乎上修改原文后,再想通过思源发布内容更新到知乎上时,会出问题。

    所以我需要在修改完原文后,将修改同步到思源笔记。

    点击“常规发布”后,选择“知乎”平台。

    【思源插件推荐】发布工具——快速输出你的内容

    点击“同步修改到思源笔记”。

    【思源插件推荐】发布工具——快速输出你的内容

    这样的话,下次再从思源笔记发布文章更新就不会有问题啦!


    5. 上传图片到图床

    如果编辑平台支持使用网络图片,或者你有个人网络博客的话,可以利用“扩展功能”中的“上传图片到图床”来上传图片。

    不过这需要额外的插件——PicGo 插件。

  • 自托管端口管理系统Portall

    自托管端口管理系统Portall



    自托管端口管理系统Portall

    自托管端口管理系统Portall

    发表于2024-07-17更新于2024-11-01分类于各种折腾Waline:2阅读次数:196本文字数:1.9k阅读时长 ≈2 分钟

    Portall 提供了一个直观的 Web 界面,用于生成、跟踪和组织跨多个主机的端口和服务。

    老苏一直在折腾各种开源软件,但总是记不清哪些应用占用了哪些端口,每次都是先随机想一个端口,然后在笔记中搜索,看有没有被占用过。Portall​ 就是用来解决老苏遇到的这种情况的,当然,excel​ 也是可以的 😂

    什么是 Portall ?

    Portall​ 是一个自托管端口管理系统,它提供了一个直观的 Web​ 界面,用于生成、跟踪和组织跨多个主机的端口和服务。它旨在让您更轻松地管理自托管应用和服务。

    软件主要特征:

    • 轻松的端口管理: 添加、删除和分配端口到不同的服务和主机
    • 端口号生成: 为您的应用程序快速生成唯一的端口号
    • 导入工具:Caddyfile​、Docker-Compose​ 或 JSON​ 数据导入现有配置
    • 自定义规则: 定义您自己的端口范围并为端口生成器设置排除项
    • 块级设计: 拖放元素来组织端口并在主机之间移动应用程序
    • 主题: 包括明暗模式,计划推出更多主题
    • CSS Playground: 使用自定义 CSS​ 支持修改外观
    • 移动响应: 从任何地方管理您的端口

    技术栈

    • 后端: Flask(Python)
    • 数据库: SQLAlchemy 和 SQLite
    • 前端: HTML、CSS、JavaScript

    自托管端口管理系统Portall

    安装

    在群晖上以 Docker 方式安装。

    在注册表中搜索 portall​ ,选择第一个 need4swede/portall:​,版本选择 latest​。

    本文写作时, latest​ 版本对应为 1.0.3​;

    自托管端口管理系统Portall

    docker​ 文件夹中,创建一个新文件夹 portall​,并在其中建一个子文件夹 data

    文件夹 装载路径 说明
    docker/portall/data /app/instance 存放数据库文件

    自托管端口管理系统Portall

    端口

    本地端口不冲突就行,不确定的话可以用命令查一下

    # 查看端口占用
    netstat -tunlp | grep 端口号
    
    本地端口 容器端口
    8855 8080

    自托管端口管理系统Portall

    环境

    可变
    PORT 容器端口设置,默认设为8080
    SECRET_KEY 用于加密和安全认证的密钥,根据需要进行修改

    自托管端口管理系统Portall

    命令行安装

    如果你熟悉命令行,可能用 docker cli​ 更快捷

    # 新建文件夹 portall 和 子目录
    mkdir -p /volume1/docker/portall/data
    
    # 进入 portall 目录
    cd /volume1/docker/portall
    
    # 运行容器
    docker run -d 
       --restart unless-stopped 
       --name portall 
       -p 8855:8080 
       -v $(pwd)/data:/app/instance 
       -e PORT=8080 
       -e SECRET_KEY=<your_secret_key> 
       need4swede/portall:latest
    

    也可以用 docker-compose​ 安装,将下面的内容保存为 docker-compose.yml​ 文件

    version: '3'
    
    services:
      rediary:
        image: need4swede/portall:latest
        container_name: portall
        restart: unless-stopped
        ports:
          - 8855:8080
        volumes:
          - ./data:/app/instance
        environment:
          - PORT=8080
          - SECRET_KEY=<your_secret_key>
    

    然后执行下面的命令

    # 新建文件夹 portall 和 子目录
    mkdir -p /volume1/docker/portall/data
    
    # 进入 portall 目录
    cd /volume1/docker/portall
    
    # 将 docker-compose.yml 放入当前目录
    
    # 一键启动
    docker-compose up -d
    

    运行

    在浏览器中输入 http://群晖IP:8855​ 就能看到主界面

    自托管端口管理系统Portall

    Add IP​ 添加 IP address

    自托管端口管理系统Portall

    加个描述

    自托管端口管理系统Portall

    Generate​ ,会随机生成了一个端口

    自托管端口管理系统Portall

    Settings​ –> General​ ,点 Save​ 将这个地址保存为缺省的 IP

    自托管端口管理系统Portall

    Ports​ 会看到之前生成的端口

    自托管端口管理系统Portall

    +​ 号可以添加一些之前已经使用的端口

    自托管端口管理系统Portall

    添加完成之后

    自托管端口管理系统Portall

    官方的动图更直观

    自托管端口管理系统Portall

    参考文档

    need4swede/Portall: Port Management Interface
    地址:https://github.com/need4swede/Portall

    Introducing Portall: A Self-Hosted Port Management System : r/selfhosted
    地址:https://www.reddit.com/r/selfhosted/comments/1dyack6/introducing_portall_a_selfhosted_port_management/

    17%

  • Crafting Engaging CSS Animations step by step guide

    In the realm of technology blogging, captivating your audience goes beyond just the written word. Incorporating eye-catching CSS animations can elevate your content and provide a dynamic user experience. In this tutorial, we'll explore the art of creating CSS animations to add flair and interactivity to your technology blog.

    Prerequisites

    Before we dive into the world of CSS animations, ensure the following:

    1. Basic HTML and CSS Knowledge: Familiarize yourself with the fundamentals of HTML and CSS.
    2. Access to Your Blog's Stylesheet: Make sure you can modify your blog's CSS stylesheet.

    Step 1: Planning Your Animation

    Before writing any code, sketch out the type of animation you want. Consider the mood and tone of your blog, ensuring the animation complements your content.

    Step 2: Setting Up Your HTML

    In your blog post or webpage, identify the element you want to animate. Add a class to this element for easy targeting in your CSS.

    <div class="animated-element">
      Your content here...
    </div>

    Step 3: Writing the CSS Animation

    Open your blog's CSS stylesheet and add the following code:

    body {
      margin: 0;
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 13px;
      line-height: 18px;
      color: #333333;
      background-color: #ffffff;
    }
    
    a {
      color: #0088cc;
      text-decoration: none;
    }

    This example creates a simple fade-in animation with a slight upward movement. Feel free to experiment with different properties like opacity, transform, and transition to achieve the desired effect.

    Step 4: Triggering the Animation with JavaScript (Optional)

    If you want the animation to occur on a specific event, like when the user scrolls to the element, you can use JavaScript. Add the following script to your blog:

    <script>
      document.addEventListener('DOMContentLoaded', function () {
        var animatedElement = document.querySelector('.animated-element');
    
        function isInViewport(element) {
          var rect = element.getBoundingClientRect();
          return rect.top < window.innerHeight;
        }
    
        function handleScroll() {
          if (isInViewport(animatedElement)) {
            animatedElement.classList.add('show');
            window.removeEventListener('scroll', handleScroll);
          }
        }
    
        window.addEventListener('scroll', handleScroll);
        handleScroll(); // Check on page load
      });
    </script>

    Step 5: Preview and Publish

    Preview your blog post to see the CSS animation in action. Tweak the animation properties as needed to achieve the desired look and feel. Once satisfied, publish your post and let your readers enjoy the visually enhanced content.

    Conclusion

    By incorporating CSS animations into your technology blog, you add a layer of engagement that captivates your audience. Experiment with different animations and effects to find the perfect fit for your blog's style. Elevate your content and make a lasting impression with the power of CSS animations.

  • Understanding how Links and protocols works 🚀

    Understanding how Links and protocols works 🚀

    Within a web browser, the ability to move from one document to another is facilitated by links. These links consist of two main parts: the protocol and server address, followed by the document path.

    A link is essentially composed of two distinct segments. The first part determines the protocol and server address, which can be specified either through a domain name or an IP address. The second part represents the document path appended to the address. For instance, consider the following document address:

    https://estudiopatagon.com/contact/

    Breaking it down:

    • Protocol (https): Specifies the communication protocol to be used. In this case, it's HyperText Transfer Protocol Secure, denoted by "https."
    • Domain Name (estudiopatagon.com): Identifies the server's location using a human-readable domain name. It points to the server that hosts the website.
    • Document URL (/contact/): Represents the specific path of the document relative to the server's root path. It guides the server to the exact location of the requested content.

    The Role of the Web Server

    Once a link is clicked, the web browser sends a request to the specified server using the provided protocol, domain name, and document path. The web server, in turn, is responsible for interpreting this request.

    Once identified, the server serves the file as the response, allowing the browser to render and display the content.

    The server analyzes the request, extracts the document path, and searches its directory structure for the corresponding file.

    computer screen displaying files
    Photo by Ferenc Almasi / Unsplash

    Conclusion

    In essence, the web server acts as the interpreter and provider, ensuring that the correct response is delivered based on the user's request. This seamless interaction between the browser and the server is fundamental to the functionality of the World Wide Web.

    As we continue our exploration, we'll delve deeper into the intricacies of web development, understanding how links, protocols, and servers collaborate to deliver the web content we interact with daily.

    Stay tuned for a deeper dive into the mechanics of web navigation and document retrieval.

  • Unleashing the Power of JavaScript: multiple event techniques

    Unleashing the Power of JavaScript: multiple event techniques

    Incorporating dynamic and interactive elements into your content can significantly elevate the user experience. In this tutorial, we'll explore the fascinating world of JavaScript, covering essential techniques to enhance your technology blog.

    Prerequisites

    Before diving into JavaScript, ensure the following:

    1. Text Editor: Have a reliable text editor, such as Visual Studio Code or Sublime Text, installed on your computer.
    2. Understanding of HTML and CSS: Familiarize yourself with the basics of HTML and CSS, as JavaScript often works in tandem with these technologies.

    Step 1: Including JavaScript in Your HTML

    Start by adding JavaScript to your HTML document. Place the script tag just before the closing body tag for better performance:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Your Tech Blog Title</title>
    </head>
    <body>
    
      <!-- Your content goes here -->
    
      <script src="app.js"></script>
    </body>
    </html>

    Step 2: Basic JavaScript Functions

    Create a simple JavaScript file (e.g., app.js) to include basic functions. Let's start with a function that displays a message:

    // app.js
    function showMessage() {
      alert('Welcome to your tech blog! 🚀');
    }
    
    showMessage(); // Call the function

    Step 3: DOM Manipulation

    JavaScript shines in manipulating the Document Object Model (DOM). Update HTML content dynamically:

    <div id="dynamic-content">This content can change</div>
    // app.js
    function updateContent() {
      var element = document.getElementById('dynamic-content');
      element.innerHTML = 'New dynamic content!';
    }
    
    updateContent(); // Call the function

    Step 4: Event Handling

    Enhance user interaction by handling events. Let's make a button that changes the content when clicked:

    <button onclick="updateContent()">Change Content</button>
    // app.js
    function updateContent() {
      var element = document.getElementById('dynamic-content');
      element.innerHTML = 'New content after button click!';
    }
    

    Step 5: Asynchronous JavaScript (AJAX)

    Fetch data asynchronously from a server to keep your blog dynamic:

    <div id="async-content">This content will be replaced</div>
    <button onclick="fetchData()">Fetch Data</button>
    // app.js
    function fetchData() {
      var element = document.getElementById('async-content');
      fetch('https://jsonplaceholder.typicode.com/todos/1')
        .then(response => response.json())
        .then(data => {
          element.innerHTML = 'Fetched Data: ' + data.title;
        });
    }
    

    Conclusion

    JavaScript empowers you to create a dynamic and interactive technology blog. From basic functions to DOM manipulation and asynchronous operations, the possibilities are vast. Experiment with these techniques, and watch as your blog becomes a captivating hub for tech enthusiasts. Stay tuned for more JavaScript adventures on your blogging journey!

  • HTTP, Web Browsers, and Web Servers

    HTTP, Web Browsers, and Web Servers

    At the core of the internet lies a complex yet fascinating ecosystem known as the World Wide Web. To unravel its workings, we need to explore key concepts such as HTTP, web browsers, and web servers.

    The Internet as Infrastructure

    Think of the internet as a vast phone network infrastructure, with numerous interconnected devices, each assigned a unique identifier, much like a phone number. But what makes the internet truly powerful is its applications, and over time, various attempts have been made to explore its potential.

    Early internet endeavors, like email and Usenet newsgroups, made their mark, but it was the World Wide Web that truly revolutionized our online experiences.

    The Birth of the World Wide Web

    The inception of the World Wide Web can be credited to Sir Tim Berners-Lee, a visionary based in Switzerland. Back in the early days, he conceptualized a utility to visualize and interlink research papers. Little did he know that this idea would evolve into the World Wide Web we know today.

    Working at CERN in Geneva, Berners-Lee introduced the concept of "hyperlinks." This innovative idea involved linking documents together, allowing users to navigate seamlessly between them. His creation was initially an academic tool, but its impact was far-reaching.

    HTTP: The Communication Protocol

    At the heart of the web's functionality is HTTP, or Hyper Text Transfer Protocol. This protocol, operating on top of TCP (Transmission Control Protocol), dictates how web browsers communicate with web servers and vice versa. It sets the rules for the exchange of information between these entities.

    Web Servers and Web Browsers

    In the web ecosystem, two primary players come into play: the Web Server and the Web Browser. The Web Server, typically hosted remotely, serves web pages to clients, which are the Web Browsers. The interaction between these components is governed by the rules established by HTTP.

    Imagine the Web Server as a repository of web pages, and the Web Browser as the tool that fetches and displays these pages for users. The communication between them is akin to a conversation following the rules of the HTTP protocol.

    HTML: The Language of Web Pages

    Web pages, the visual entities we interact with, are essentially text files encoded in HTML, or Hyper Text Markup Language. HTML provides the structure and format for web content, defining elements like paragraphs, headings, images, and more.

    As we journey further into understanding the web, we'll delve into HTML and explore how these text files become the immersive web pages we encounter daily. Stay tuned as we bridge the gap between theory and practical implementation in the realm of HTML.

  • Mastering HTML Essentials to start your Tech Blog 🔥

    As a technology blogger, having a strong foundation in HTML is fundamental for crafting engaging and well-structured content. In this tutorial, we'll delve into the key HTML elements and techniques that will empower you to create compelling and accessible posts on your technology blog.

    Prerequisites

    Before we embark on this HTML journey, ensure the following:

    1. Text Editor: Have a reliable text editor, such as Visual Studio Code or Sublime Text, installed on your computer.
    2. Basic Understanding of Web Technologies: Familiarize yourself with the basics of web technologies, including how HTML works alongside CSS and JavaScript.

    Step 1: Setting Up Your HTML Document

    Create a new HTML document and set up the basic structure. Every HTML document should include the following:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Your Tech Blog Title</title>
    </head>
    <body>
    
      <!-- Your content goes here -->
    
    </body>
    </html>

    Step 2: Structuring Content with HTML Tags

    HTML provides a variety of tags to structure your content. Here are some essential ones:

    • Headings:
      <h1>Your Main Heading</h1>
      <h2>Subheading</h2>
    • Paragraphs:
      <p>This is a paragraph of text.</p>
    • Lists:
      <ul>
        <li>Item 1</li>
        <li>Item 2</li>
      </ul>
    
      <ol>
        <li>Step 1</li>
        <li>Step 2</li>
      </ol>

    页: 1 2 3

  • Displaying Images in HTML: The img tag a masterclass

    Displaying Images in HTML: The img tag a masterclass

    Images play a crucial role in enhancing the visual appeal of a website, and in HTML, the img tag is the key to incorporating images into your web pages. This tag is straightforward yet powerful, allowing you to seamlessly integrate images into your content.

    The <img> Tag Basics

    The <img> tag is a self-closing tag, which means it ends with />. It does not contain any content but rather serves as a self-sustaining element. Here's a simple example:

    <img src="image.png" />
    

    In this example, the src attribute specifies the image source. You can replace "image.png" with the actual file path or URL of your image.

    Image Formats and Alt Attribute

    On the web, a diverse range of image formats is used, including PNG, JPEG, GIF, SVG, and the more recent WebP. When using the <img> tag, it's important to include the alt attribute, as per HTML standards. The alt attribute provides a descriptive text for the image, aiding screen readers and search engine bots:

    <img src="dog.png" alt="A picture of a dog" />
    

    Ensure that the alt attribute provides a meaningful description of the image, contributing to accessibility and search engine optimization.

    Controlling Image Size with Width and Height Attributes

    You can control the dimensions of the displayed image using the width and height attributes. These attributes take numeric values expressed in pixels. This is particularly useful to reserve space for the image, preventing layout changes when the image is fully loaded:

    <img src="dog.png" alt="A picture of a dog" width="300" height="200" />

    In this example, the width is set to 300 pixels, and the height is set to 200 pixels. Adjust these values according to your design preferences and layout requirements.

    Integrating images with the <img> tag is a fundamental skill in web development. As you continue to explore HTML and enhance your web pages, mastering the art of incorporating images will contribute significantly to the overall user experience of your website.