Set up a profile
- Contribution snake
<picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yaoniplan/yaoniplan/output/github-contribution-grid-snake-dark.svg"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/yaoniplan/yaoniplan/output/github-contribution-grid-snake.svg"> <img alt="github-snake" src="https://raw.githubusercontent.com/yaoniplan/yaoniplan/output/github-contribution-grid-snake.svg"> </picture>
- Typing SVG
![Typing SVG](https://readme-typing-svg.demolab.com/?lines=Hello%20there%2C%20I'm%20yaoniplan%20%F0%9F%91%8B)
&font=Fira%20Code
- Remember to encode the string
- Skill icons
![skills](https://skillicons.dev/icons?i=arch,bash)
arch
# Replace it with other icon id (e.g. debian)&perline=14
- Repo cards
[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=yaoniplan&repo=note)](https://github.com/yaoniplan/note)
&theme=dark
# Replacedark
with other theme (e.g. cobalt)&show_owner=true
- Contribution snake
- Notes
- Use GitHub Actions
vi ~/.config/yaoniplan/.github/workflows/main.yml
name: generate animation on: # Run automatically every 24 hours schedule: - cron: "0 */24 * * *" # Allows to manually run the job at any time workflow_dispatch: # Run on every push on the development branch push: branches: - development jobs: generate: permissions: contents: write runs-on: ubuntu-latest timeout-minutes: 5 steps: # Generates a snake game from a GitHub user (<github_user_name>) contributions graph, output a svg animation at <svg_out_path> - name: generate github-contribution-grid-snake.svg uses: Platane/snk/svg-only@v3 with: github_user_name: ${{ github.repository_owner }} outputs: | dist/github-contribution-grid-snake.svg dist/github-contribution-grid-snake-dark.svg?palette=github-dark # Push the content of <build_dir> to a branch # The content will be available at https://raw.githubusercontent.com/<github_user>/<repository>/<target_branch>/<file>, or as github page - name: push github-contribution-grid-snake.svg to output branch uses: crazy-max/ghaction-github-pages@v3.1.0 with: target_branch: output build_dir: dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- Becuase to highlight my skills and experience.
- Use GitHub Actions
- References
Use "wrangler"
npm create cloudflare@latest -- products
# Create a projectnpx wrangler d1 create products
# Create a databasevi ~/.config/store/products/wrangler.toml
# Append to end of file[[d1_databases]] binding = "DB" database_name = "products" database_id = "<unique-ID-for-your-database>"
vi ~/.config/store/products/products.sql
# Configure your D1 databaseDROP TABLE IF EXISTS products; CREATE TABLE IF NOT EXISTS products ( barcode TEXT PRIMARY KEY, name TEXT, price TEXT ); INSERT INTO products (barcode, name, price) VALUES ('6934567890123','water1','1'), ('6934567890124','water2','2'), ('6934567890125','water3','3');
npx wrangler d1 execute products --local --file=./products.sql
# Test locally firstnpx wrangler d1 execute products --local --command="SELECT * FROM products"
# Validate your data
vi ~/.config/store/products/src/index.ts
# Configure your Workerexport interface Env { DB: D1Database; // The D1 database binding } const JSON_HEADERS = { "Content-Type": "application/json" }; export default { async fetch(request: Request, env: Env): Promise<Response> { const url = new URL(request.url); const pathname = url.pathname; const method = request.method; try { if (pathname === "/search_product" && method === "GET") { const barcode = url.searchParams.get("barcode"); const name = url.searchParams.get("name"); // Ensure at least one search parameter is provided if (!barcode && !name) { return new Response( JSON.stringify({ error: "Missing barcode or name" }), { status: 400, headers: JSON_HEADERS } ); } let query = "SELECT barcode, name, price FROM products WHERE "; const params: string[] = []; if (barcode) { query += "barcode = ?"; params.push(barcode); } if (name) { if (params.length > 0) { query += " OR "; // If there's already a condition, use OR } query += "name LIKE ?"; params.push(`%${name}%`); } const stmt = env.DB.prepare(query); const results = await stmt.bind(...params).all(); return new Response( JSON.stringify(results.results), { headers: JSON_HEADERS } ); } if (pathname === "/add_product" && method === "POST") { const data = await request.json(); const { barcode, name, price } = data; if (!barcode || !name || !price) { return new Response( JSON.stringify({ error: "Missing data" }), { status: 400, headers: JSON_HEADERS } ); } await env.DB.prepare( "INSERT INTO products (barcode, name, price) VALUES (?, ?, ?)" ).bind(barcode, name, price).run(); return new Response( JSON.stringify({ message: "Product added successfully" }), { status: 201, headers: JSON_HEADERS } ); } if (pathname === "/delete_product" && method === "DELETE") { const barcode = url.searchParams.get("barcode"); if (!barcode) { return new Response( JSON.stringify({ error: "Missing barcode" }), { status: 400, headers: JSON_HEADERS } ); } await env.DB.prepare( "DELETE FROM products WHERE barcode = ?" ).bind(barcode).run(); return new Response( JSON.stringify({ message: "Product deleted successfully" }), { headers: JSON_HEADERS } ); } if (pathname === "/update_product" && method === "PUT") { const data = await request.json(); const { barcode, name, price } = data; if (!barcode || !name || price == null) { return new Response( JSON.stringify({ error: "Missing barcode, name, or price" }), { status: 400, headers: JSON_HEADERS } ); } // Check if the product exists before updating const existingProduct = await env.DB.prepare( "SELECT 1 FROM products WHERE barcode = ?" ).bind(barcode).first(); if (!existingProduct) { return new Response( JSON.stringify({ error: "Product not found" }), { status: 404, headers: JSON_HEADERS } ); } await env.DB.prepare( "UPDATE products SET name = ?, price = ? WHERE barcode = ?" ).bind(name, price, barcode).run(); return new Response( JSON.stringify({ message: "Product updated successfully" }), { headers: JSON_HEADERS } ); } return new Response( "Route not found", { status: 404 } ); } catch (error) { return new Response( JSON.stringify({ error: "Database error" }), { status: 500, headers: JSON_HEADERS } ); } }, } satisfies ExportedHandler<Env>;
npx wrangler dev
# Develop locallynpx wrangler d1 execute products --remote --file=./products.sql
# Import the data into the production version of your databasenpx wrangler d1 execute products --remote --command="SELECT * FROM products"
# Validate the datanpx wrangler deploy
# Deploy your Worker on the Internet
- Notes
- Create (Add the new product to the database)
curl --request POST http://localhost:8787/add_product \ --header "Content-Type: application/json" \ --data '{ "barcode": "6934567890123", "name": "water", "price": 1 }'
- Read (Get product by barcode)
curl http://localhost:8787/search_product?barcode=6934567890123
barcode
# Replace it withname
to get product by name
- Update (Update the information of a product)
curl --request PUT "http://localhost:8787/update_product" \ --header "Content-Type: application/json" \ --data '{ "barcode": "6934567890123" "name": "water2" "price": 2 }'
- Delete (Delete product by barcode)
curl --request DELETE http://localhost:8787/delete_product?barcode=6934567890123
- Because to open the database to the Internet for easy query.
- Use Cloudflare D1 as a backend
- Create (Add the new product to the database)
- References
- https://developers.cloudflare.com/d1/get-started/
- Artificial intelligence
Integrate Cloudflare Workers KV for low-latency access
npx wrangler kv namespace create products
# Create a KV namespacevi ~/.config/store/products/wrangler.toml
[[kv_namespaces]] binding = "products" id = "<your-kv-namespace-id>"
vi ~/.config/store/products/src/index.ts
// Adjust as needed
npx wrangler deploy
# Deploy your Worker on the Internet
- Notes
- References
Change wallpaper color in iPhone Shortcuts
- Get
All
wallpapers - Get
Random Item
fromWallpapers
- Switch to
Item from List
- Get
- Notes
- Because to randomize the color of the wallpaper.
- Make sure add the other three colors of wallpaper (Silver, Gold, Deep purple) before running.
- Because to randomize the color of the wallpaper.
- References
Use Systemd timers
doas vi /etc/systemd/system/checkIn.timer
[Unit] Description=Check in [Timer] OnCalendar=12:30 [Install] WantedBy=timers.target
doas vi /etc/systemd/system/checkIn.service
[Unit] Description=Check in [Service] ExecStart=/home/yaoniplan/.config/store/signIn/.venv/bin/python3 /home/yaoniplan/.config/store/signIn/autoSignIn.py
- Notes
doas systemctl enable checkIn.timer --now
# Enable the timer now
- References
- ChatGPT
Use "selenium"
- Imports
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time
- Define a function
def auto_sign_in_and_check_in(driver, username, password): # Log in (Update with actual selector) username_field = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, "#user_login")) ) password_field = driver.find_element(By.CSS_SELECTOR, "#password") submit_button = driver.find_element(By.CSS_SELECTOR, "#userlogin-submit") # Fill in the username and password username_field.send_keys(username) password_field.send_keys(password) # Click the submit button submit_button.click() WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, "i.pps-icon.pps-icon-close-clear")) # Update with actual selector ) # Click the pps icon pps_icon = driver.find_element(By.CSS_SELECTOR, "i.pps-icon.pps-icon-close-clear") # Update with actual selector pps_icon.click() # Wait for the page to load after login (Update with actual selector) WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, "div.login_text.mobie a.slide-user-menu")) ) # Click the slide user menu (Update with actual selector) slide_user_menu = driver.find_element(By.CSS_SELECTOR, "div.login_text.mobie a.slide-user-menu") slide_user_menu.click() # Wait for the page to load after login (Update with actual selector) WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, ".meiriqiandao > span:nth-child(1)")) ) # Click the check-in button check_in_button = driver.find_element(By.CSS_SELECTOR, ".meiriqiandao > span:nth-child(1)") # Update with actual selector check_in_button.click()
# Setup WebDriver driver = webdriver.Chrome() # Make sure to have the appropriate WebDriver executable # Open the login URL (Replace with the actual URL) driver.get("https://example.com/login")
- Call the function
# Update with the actual username and password auto_sign_in_and_check_in(driver, "yourUsername", "yourPassword") # Wait to see the result before closing (adjust as needed) time.sleep(5) # Optionally, close the browser after the task is completed driver.quit()
- Imports
- Notes
- Because to complete some repetitive but meaningless work. (e.g. check-in)
- References
- ChatGPT
Use "eval"
eval rsync -av "$option"
# Handle the variable containing spaces correctly
- Notes
- Solve the problem
yaoniplan@tux ~/.config $ syncFiles.sh store receiving incremental file list rsync: [sender] change_dir "/home/yaoniplan/.config/store /home/yaoniplan" failed: No such file or directory (2) sent 8 bytes received 8 bytes 32.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1852) [Receiver=3.3.0] rsync: [Receiver] write error: Broken pipe (32) yaoniplan@tux ~/.config $
- Solve the problem
- References
- ChatGPT
Allow others in your WLAN to access the API
vim ~/.config/store/serverSideQuery/app.py
if __name__ == '__main__': app.run(debug=True)
- Replace
debug=True
withhost='0.0.0.0', port=5000
- Replace
- Notes
http://192.168.10.100:5000
- References
- ChatGPT
Set up a Flask web server
- Imports
from flask import Flask, request, jsonify import sqlite3
- Create a new Flask web application instance named
app
app = Flask(__name__)
- Function to get a product by barcode
def get_product_by_barcode(barcode): conn = sqlite3.connect('products.db') cursor = conn.cursor() cursor.execute("SELECT name, price, image_url FROM products WHERE barcode=?", (barcode,)) product = cursor.fetchone() conn.close() return product
- Route to search for a product
@app.route('/search_product', methods=['GET']) def search_product(): barcode = request.args.get('barcode') product = get_product_by_barcode(barcode) if product: return jsonify({"name": product[0], "price": product[1], "image_url": product[2]}) else: return jsonify({"error": "Product not found"}), 404
- Application runner
if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
- Imports
- Notes
- Add a new product
# Function to add a new product def add_product(barcode, name, price, image_url): conn = sqlite3.connect('products.db') cursor = conn.cursor() cursor.execute("INSERT INTO products (barcode, name, price, image_url) VALUES (?, ?, ?, ?)", (barcode, name, price, image_url)) conn.commit() conn.close() # Route to add a new product @app.route('/add_product', methods=['POST']) def add_product_route(): data = request.json barcode = data.get('barcode') name = data.get('name') price = data.get('price') image_url = data.get('image_url') # Validate input data if not all([barcode, name, price, image_url]): return jsonify({"error": "Missing data"}), 400 # Add product to database add_product(barcode, name, price, image_url) return jsonify({"message": "Product added successfully"}), 201
- Add the new product to the database
curl --request POST http://192.168.10.100:5000/add_product --header "Content-Type: application/json" --data '{ "barcode": "6934567890123", "name": "Water", "price": 1, "image_url": "http://example.com/image.png" }'
- Get prodect details
curl http://192.168.10.100:5000/search_product?barcode=6934567890123
- Add a new product
- References
- ChatGPT
Understand product barcode
- 13 digits
- International
- 6934567890123 (Sample in China)
- 13 digits
- Notes
- Because to build a small cash register software.
- References
- ChatGPT
Save the browser text as a file in iPhone Shortcuts
- If
Shortcut Input
does not have any value
Text
#Clipboard
- Otherwise
Text
#Shortcut Input
- End If
- Ask for
Text
withEnter file name:
- Set name of
If Result
toProvided Input
- Save
Renamed Item
toDownloads
- Subpath #
Provided Input
- Subpath #
- Open
Saved File
inFiles
- If
- Notes
- Open directory where the file is located
- Open
Saved File
inFiles
- Open
- Because to save text as file.
- Open directory where the file is located
- References
Save selection as file in iPhone Shortcuts
Text
Shortcut Input
- Ask for
Text
withEnter file name:
- Allow Multiple Lines (Disable)
- Set name of
Text
toProvided Input
- Save
Renamed Item
toDownloads
- Subpath
Provided Input
- Subpath
- Notes
- Because it's suitable for some short JSON text.
- References
- ChatGPT
Save the entire text content of a webpage as file in iPhone Shortcuts
var result = [];
# Initialize an empty arraybody = document.body;
# Get the entire body of the document- Create a selection object and a range object
sel = window.getSelection(); range = document.createRange();
range.selectNodeContents(body);
# Select the contents of the bodysel.removeAllRanges();
# Clear any existing selectionssel.addRange(range);
# Add the new range to the selectionselString = sel.toString();
# Convert the selected content to a stringcompletion(selString);
# Call a function namedcompletion
with the selected string
- Notes
- Run JavaScript on Web Page (Shortcut Input, paste the code above) - Ask fro Input (Text, Enter file name:, config.json) - Set Name (JavaScript Result, Provided Input) - Save File (Renamed Item, Downloads, Provided Input) - Open File (Saved File, Files)
completion(document.body.innerText);
# Easier methodSet Name
# This will change the document type
- Because just like saving a file with
Ctrl-s
in browser.
- Run JavaScript on Web Page (Shortcut Input, paste the code above) - Ask fro Input (Text, Enter file name:, config.json) - Set Name (JavaScript Result, Provided Input) - Save File (Renamed Item, Downloads, Provided Input) - Open File (Saved File, Files)
- References
Use "xlsx2csv"
xlsx2csv input.xlsx output.csv
- Notes
- Because to edit the file simply.
- References
- ChatGPT
The abbreviation of "Comma-separated values" is "csv"
- A text file format
- Use commas to separate values
- Use newlines to separate records
- A text file format
- Notes
- Because to record the information of the goods.
- Name, price, barcode
- Because to record the information of the goods.
- References
Close the keyboard after pressing the Enter key
vim ./script.js
taskInput.addEventListener('keydown', function(event) { if (event.key === 'Enter') { addTask(taskInput.value); taskInput.value = ''; // Clear the input field hideInputBox(); // HIde the input box after adding the task taskInput.blur(); // Blur the input field to close the keyboard } })
- Notes
blur()
# Remove focus
- References
- ChatGPT
Use "EOF"
- Write multiple lines text into a new file
tee ./styles.css << EOF # Paste multiple lines text here EOF
- Write multiple lines text into a new file
- Notes
<<
# An operator (Take the text that follows as input)EOF
# A delimiter (Between them)
- References
man tee
#/append
- ChatGPT
Understand Exodus in the Bible
- Who
- Moses (God's agent) and the Israelites
- Why
- Lead the Israelites out of slavery in Egypt
- Result
- Leave Egypt and approach Canaan
- Who
- Notes
- Artificial intelligence is like God (Humans on Earth are like Moses)
- References
Please tell me the story of Exodus in the Bible
# ChatGPT
Try to follow the Docker Compose specification
compose.yaml
# Replace docker-compose.ymldocker compose
# Replace docker-compose- Delete the first line containing 'version' to remove obsolete warning
- Notes
- Because to make Docker simpler.
- References
View system information without third-party tools
cat /proc/cpuinfo
# CPU information- Number of processors
- Number of CPU cores of the processor
- Model name
cat /proc/version
# Kernel versioncat /proc/meminfo
# Memory informationcat /proc/partitions
# Disk partitionscat /proc/filesystems
# File systemsnodev
# No device- What file system types are currently used by disks
- Notes
- Because to view the basic information of a computer.
- References
Use "sheets"
=SUM(E2:E126)
# Calculate the sum of this range=
# Start a formula
- Notes
- Because the user experience is better than "excel".
- Support dark mode
- Open files faster
- Simpler user interface
- Disadvantages
- No version control feature
- Because the user experience is better than "excel".
- References
- https://drive.google.com/drive/home
A simple cheat sheet about Google Sheets software
# ChatGPT
Fetch an icon of a website
https://favicone.com/google.com?s=32
- Notes
google.com
# Replace it with other domain name of a websites
# Size32
# 32x32 pixels (Clearer)https://api.faviconkit.com/google.com/64
# Another method
- References
- ChatGPT
If vectors $a=(0,1)$, $b=(2,x)$, $b\perp(b-4a)$, then $x=$
- $\cos\theta=1$ # The expression ($-\sqrt{2}\cos\theta$) will be the smallest when the value ($\cos\theta$) is the largest
- The ratio of the adjacent (connected) side to the hypotenuse in a right triangle (Like a point on the unit circle)
- $|\vec{a}+\vec{b}|=\sqrt{|\vec{a}|^{2}+|\vec{b}|^{2}}$ # Properties of orthogonal (e.g. $\vec{a}\perp\vec{b}$) vectors (Pythagorean theorem)
- The magnitude of the vector $\vec{a}+\vec{b}$ is the hypotenuse of the right triangle with sides of length $|\vec{a}|$ and $|\vec{b}|$
- $|\vec{c}|=1$ # A unit vector has a magnitude of 1
- $\vec{c} \cdot \vec{c}=|\vec{c}| |\vec{c}| \cos\theta$ # Dot product formula
- $u \cdot v=0$ # Two vectors are perpendicular ($\cos90\degree$) if their dot product is zero
- $(\vec{a}-\vec{c})\cdot(\vec{b}-\vec{c})=\vec{a} \cdot \vec{b}-\vec{a} \cdot \vec{c}-\vec{c} \cdot \vec{b}+\vec{c} \cdot \vec{c}$ # Distributive property of the dot product
- $u \cdot v = u_{1}v_{1}+u_{2}v_{2}$ # Vector multiplication
- $u - v=(u_{1}-v_{1},u_{2}-v_{2})$ # Vector subtraction
- $\cos\theta=1$ # The expression ($-\sqrt{2}\cos\theta$) will be the smallest when the value ($\cos\theta$) is the largest
- Notes
- $4a=4 \cdot (0,1)=(0,4)$ # Each component of the vector is multiplied by scalar (A single number)
- Express $\overrightarrow{AD}$ in terms of vectors $\vec{b}$ and $\vec{c}$
- $\overrightarrow{BD}=2\overrightarrow{DC}$ # Point D divides side BC into three equal parts ($BD:DC = 2:1$, $BD=\frac{2}{3}BC$)
- Vector = scalar + direction
- $\overrightarrow{AD}=\overrightarrow{AB}+\overrightarrow{BD}$ # Position vector addition
- $\overrightarrow{BC}=\overrightarrow{AC}-\overrightarrow{AB}$ # Position vector subtraction
- References
- If $\vec{a}$ $\vec{b}$ $\vec{c}$ are unit vectors, $\vec{a} \cdot \vec{b}=0$, then the minimum value of $(\vec{a}-\vec{c}) \cdot (\vec{b}-\vec{c})$ is
- In the $\triangle ABC$, if $\overrightarrow{AB}=\vec{c}$, $\overrightarrow{AC}=\vec{b}$, $\overrightarrow{BD}=2\overrightarrow{DC}$, then $\overrightarrow{AD}=$
- College Entrance Math in Jiangxi
- ChatGPT
Increase the number in output filenames
i=1; for f in *.MOV; do ffmpeg -i "$f" -c:v libx265 -crf 28 -preset slow -c:a aac -b:a 128k 240627checkTheCigarettes${i}.mp4; i=$((i + 1)); done
- Notes
${}
# Reference the value of a variable ($
is ok, but${}
is powerful)$(())
# Perform arithmetic operations (Calculate the value)- Because to achieve semi-automation in the shell.
- References
- ChatGPT
Use "a-shell"
help -l
# List all installed packages
- Notes
- Because to download a piece of music from YouTube in iPhone.
- References
The abbreviation of "the first floor" is "1F".
B1
# Basement level 1
- Notes
- Because to distinguish floors when using map navigation software.
- References
- ChatGPT
Open a department store in Dongguan City, Guangdong Province, China. (2024-06-30)
- Don't join other brands
- Notes
- The other party may not perform the specific things metioned in the contract
- Indoor and outdoor cameras must be included
- The glass door must include a glass frame and a glass fan
- Air conditioning must be available
- One-hand payment and one-hand delivery
- Bulid an artificial intelligence to answer questions about commodity information
- Provide Free services
- Hot water (Make hot instand noodles)
- Business cooperation
- Find each other
- Wear seat belts for rear seats in small cars (Impose a fine of RMB 10, deduct 0 points, late payment fee will be RMB 0)
- Require
- Awnings (If the sun will hit the product)
- Shelves
- Banknote detector
- Monitor
- Rice cooker
- Business license
- Food business license (Maybe just record it)
- Health certificate
- Real estate certificate
- Lease contract
- Because to help my cousin's family pay off their debts by providing food services.
- The other party may not perform the specific things metioned in the contract
- References
- http://txjy.syggs.mofcom.gov.cn/ # Enter the brand name in the "特许品牌" to query the company registration information
- https://www.gov.cn/banshi/2005-08/23/content_25575_2.htm #
/第五十一条
- https://www.gov.cn/banshi/2005-08/23/content_25575_3.htm #
/第八十九条
- https://www.gd.gov.cn/zwgk/wjk/zcfgk/content/post_2531572.html #
/第五十五条
Use "excel"
Ctrl-z
# UndoCtrl-y
# RedoAlt-q
# Query- Use keyboard shortcuts
- Long press
Alt
- Long press
- Notes
- Formulas
=M2*0.8
# 20% off price (M: column; 2: row)
- Because to deal with a .xlsx file.
- Formulas
- References
Capture a long screenshot
- Firefox
Ctrl-Shift-s
# Select a region
- Chromium
Ctrl-Shift-i
# InspectCtrl-Shift-p
# Prompt a command palettescreenshot
# Type to select 'Capture full size screenshot'
- Firefox
- Notes
- Because to share with others.
- References
Use "sing-box"
doas sing-box run -c ~/.config/sing-box/config.json
# Replace config.json with your configurationvim ~/.bash_profile
# Set proxy export all_proxy="socks://127.0.0.1:2333" export no_proxy="127.0.0.1, localhost, 192.168.10.0/24, 100.65.173.16"
all_proxy
# Both HTTP and HTTPS connections2333
# Search 'listen_port' to get the port100.65.173.16
# Use no_proxy (Remember to new a terminal to make changes effective)
- Direct (Do not use a proxy for domains)
[ "route": { "rules": [ { "domain_suffix": [ "example.com", "example2.com" ], "outbound": "direct" }, { ... } ] } ]
- Select a server
{ "experimental": { "clash_api": { "external_controller": "0.0.0.0:9090", "secret": "" } }, }
- Notes
- Install dependencies
doas mv sing-box-1.10.0-alpha.16-linux-amd64/sing-box /usr/local/bin/sing-box
# Install dependenciesnix profile install nixpkgs#sing-box
# Another method
- Solve the problem
FATAL[0000] start service: initialize inbound/tun[0]: configure tun interface: operation not permitted
doas sing-box run -c ~/.config/sing-box/config.json
# Add permission
- Because to use a faster proxy tool.
- Install dependencies
- References
Use "ffprobe"
ffprobe yourVideoFile.mp4
-show_streams
# Show streams (e.g. video, audio)
- Notes
- Because to get video and audio information.
- (e.g. Duration, bitrate, video codec, resolution, audio codec, etc.)
- Because to get video and audio information.
- References
- ChatGPT
Display the help message and exit if no arguments are provide
vim ~/.local/bin/getInformation.sh
# If the number of arguments is equal to zero if [ "$#" -eq 0 ]; then echo "Usage: $(basename $0) <arg1> <arg2> ..." exit 1 fi
- Notes
- Because to make the Shell script more user-friendly.
- References
- ChatGPT
Use "nvim"
nix run github:jordanisaacs/neovim-flake
- Notes
Ctrl-^
# Switch to next tab in normal mode (file)"+y
# Copy text into clipboard"
# Specify the register+
# System clipboard registery
# Yank (Copy)
vim ~/.config/nvim/init.lua
# Manage plugins using built-in package manager-- Call their setup function require('noice').setup()
git clone https://github.com/folke/noice.nvim ~/.config/nvim/pack/vendor/start/noice.nvim
# Install a plugin (e.g. nui.nvim)
- Warning: It takes a long time to download and bulid the first time.
- Because to try to use nvim.
- References
- https://programmingpercy.tech/blog/learn-how-to-use-neovim-as-ide/#enabling-language-server-protocolsupport
- https://github.com/rcallaby/Learn-Vim-and-NeoVim/blob/main/Lessons/Part-14-Using-Lua-In-NeoVIM/usingLua.md#loading-the-plugin
- https://www.youtube.com/watch?v=O-VcTY0umMc
- https://github.com/jordanisaacs/neovim-flake#documentation
- ChatGPT
Use "matplotlib"
python
# Import dependenciesimport matplotlib.pyplot as plt import numpy as np
matplotlib.pyplot
# The pyplot module from the matlotlib libraryas
# Aliasplt
# For plottingnumpy
# The librarynp
# For numerical operations
python
# Save and closeplt.savefig('function.svg', format='svg', transparent=True) plt.close()
savefig('...', ...)
# Save the current figure as an image fileformat='svg'
# Set image format to SVGtransparent=True
# Set image background to transparent
- Notes
- Define functions and variables
def f(x): return np.sqrt(x * (x - 1)) + np.sqrt(x) x = np.linspace(-0.5, 2, 400) y = np.zeros_like(x) valid_indices = (x >= 0) & (x >= 1) | (x == 0) y[valid_indices] = f(x[valid_indices])
linspace()
# Generate a linearly spaced array of numbers-0.5
# Starting point of the sequence2
# Ending point of the sequence400
# The number of points between themzeros_like(x)
# The same shape as x filled with zeros&
# And|
# Or==
# Equal to
- Set the curve
plt.figure(figsize=(10, 6), facecolor='none') plt.style.use('dark_background') plt.plot(x, y, label='$f(x) = \sqrt{x(x-1)} + \sqrt{x}$', color='yellow')
figsize=(10, 6)
# Set figure size to 10x6 inchesfacecolor='none'
# Set facecolor to transparentstyle.use('dark_background')
# Set dark background styleplot.(x, y)
# Plot the functionlabel='$f(x) = ...$'
# Display a mathematical expression in LaTex syntax
- Set the axes
plt.axhline(0, color='white', linewidth=0.5) plt.axvline(0, color='white', linewidth=0.5)
ax
# Axesh
# Horizontal (v
: Vertical)0
# Coordinate0.5
# Units
- Set auxiliary markers
plt.grid(color='gray', linestyle='--', linewidth=0.5) plt.title('Plot of $f(x) = \sqrt{x(x-1)} + \sqrt{x}$', color='white') plt.xlabel('x', color='white') plt.ylabel('f(x)', color='white') plt.ylim(-0.5, 2.5)
$...$
# Display a mathematical expression in LaTex syntax--
# Dashed linesxlabel
# Set the label for the x-axisylabel
# Set the y-axis labelylim(-0.5, 2.5)
# Set the y-axis limits from -0.5 to 2.5
- Set label and legend
plt.fill_between(x, y, where=valid_indices, color='brown', alpha=0.5, label='Valid domain') plt.legend(loc='upper left')
fill_between(x, y, ...)
# Fill the area between the curve defined by x and ylabel='Valid domain'
# Display the label in the plot legendplt.legend()
# Adjust the position of the legendloc='upper left'
# Move the position of the legend to upper left corner- From default lower right corner
- Because to plot graphs of mathematical functions.
- Define functions and variables
- References
Use "library"
library listen ~/classical_music.tl.db
- Notes
library next
# Playback next--random
# Playback shufflepipx install xklb
# Install dependencies- Because to listen to classical music.
- References
- https://github.com/chapmanjacobd/library/tree/main/example_dbs # classical_music.tl.db
- https://github.com/chapmanjacobd/library#examples
library listen --help
Use "sqlite"
python
# Create a connectionimport sqlite3 connection = sqlite3.connect("aquarium.db") cursor = connection.cursor()
connection
# Variable (e.g. cursor, etc.)sqlite3.connect("")
# Connect to (Or create) the databaseaquarium.db
# Database name
python
# Close the connectioncursor.close() connection.close()
close()
# Close the connection (e.g. connection)
- Notes
- Create
cursor.execute("CREATE TABLE fish (name TEXT, species TEXT, tank_number INTEGER)") cursor.execute("INSERT INTO fish VALUES ('Sammy', 'shark', 1)") cursor.execute("INSERT INTO fish VALUES ('Jamie', 'cuttlefish', 7)") connection.commit()
execute("")
# Execute a SQL command"CREATE TABLE ... ()"
# Create a tablefish
# Table namename
# Column name (e.g. species, tank_number)TEXT
# Type name (e.g. INTEGER)"INSERT INTO ... VALUES ('...', '...', ...)"
# Insert a row into the tableSammy
# Insert the value into the first column (e.g. name)commit()
# Commit (Or save) changes to the database
- Read
rows = cursor.execute("SELECT name, species, tank_number FROM fish").fetchall() print(rows)
"SELECT ..., ..., ... FROM ..."
# Select columns from the tablefetchall()
# Retrieve all remaining rows of the query result as a list ([]
) of tuples (()
)
- Update
new_tank_number = 2 moved_fish_name = "Sammy" cursor.execute( "UPDATE fish SET tank_number = ? WHERE name = ?", (new_tank_number, moved_fish_name) ) connection.commit()
"UPDATE ... SET ... = ? WHERE ... = ?", (..., ...)
# Update a value in the row of the table?
# Placeholder
- Delete
released_fish_name = "Sammy" cursor.execute( "DELETE FROM fish WHERE name = ?", (released_fish_name,) ) connection.commit()
"DELETE FROM ... WHERE ... = ?", (...,)
# Delete a row in the table
- Because to use a database to store data.
- Use SQLite command line
sqlite3 products.db .dump > products.sql
# Generate the SQL dumpsqlite3 products.db 'SELECT * FROM products;'
# Execute a SQL statementsqlite3 products.db
# Interact with the database.tables
# Get tables (In an interactive shell)SELECT * FROM products;
# Select all entries from a tablenix profile install nixpkgs#sqlite
# Install dependencies- Because to show it quickly temporarily.
- Create
- References
- https://mathpretty.com/16311.html
tldr sqlite3
- ChatGPT
Calculate the square root of a number in Python interpreter
python
# Usemath
moduleimport math print(math.sqrt(25))
math
# Built-in modulesqrt
# Function25
# Argument
python
# Use**
operatorprint(25 ** 0.5)
**
# Exponentiation operator
- Notes
- Because to verify that $\sqrt{}$ is the principal square root function which outputs non-negative value.
- References
The domain of the function $y=\sqrt{x(x-1)}+\sqrt{x}$ is
- Square root
- Every nonnegative real number $x$ has a unique nonnegative square root
- Square root
- Notes
- $x(x-1)\ge0$ ($x=0$ and $x=1$) # $x\le0$ or $x\ge1$
- If $x<0$, then $x$ is negative and $x-1$ is negative, so $x(x-1)$ is positive
- If $0<x<1$, then $x$ is positive and $x-1$ is negative, so $x(x-1)$ is negative
- If $x>1$, then $x$ is positive and $x-1$ is positive, so $x(x-1)$ is positive
- $x\ge0$
- $x(x-1)\ge0$ ($x=0$ and $x=1$) # $x\le0$ or $x\ge1$
- References
- https://en.wikipedia.org/wiki/Domain_of_a_function#/media/File:Square_root_0_25.svg
- https://en.wikipedia.org/wiki/Square_root
- College Entrance Math in Jiangxi
- ChatGPT
Model the Sudoku Game
- Horizontal Blocks using TMB
- Top, Middle, Bottom
- Horizontal Blocks using TMB
- Notes
- Because to teach niece about problem-solving skills in Sudoku.
- References
Tie a knot for the pants belt
- Left
- Ampersand (&)
- Right
- Form a loop
- Pass through the first circle
- Wrap the second circle
- Left
- Notes
- Because there is no need to tie and untie knots when go to the toilet. (except for the first)
- Pull everything tight
- Because there is no need to tie and untie knots when go to the toilet. (except for the first)
- References
Select next match in Bash
Ctrl-i
# Get two or more matching results (The same asTab
)Ctrl-n
# Next
- Notes
- Because to autocomplete file name without copying and typing manually.
- References
The abbreviation of "Web Distributed Authoring and Versioning" is "WebDAV".
- A set of extensions
- Hyprtext Transfer Protocol
- A set of extensions
- Notes
- Because to interact with data.
- Upload files from local to remote
- Synchronize personal account data by logging in
- Share with the open source world
- Because to interact with data.
- References
Use "webdav"
curl --user "admin:***" --upload-file "/mnt/grow/image/2024-06-04-171256.png" "http://192.168.10.100:5244/dav/$filePath/"
- Notes
admin:***
# Replace it with your username and password--upload-file "/mnt/grow/image/2024-06-04-171256.png"
# Replace it with--request <method>
MKCOL
# Make collection (folder)DELETE
# Delete a folder (file)PROPFIND
# Properties find (Metadata: name, size, creation date, modification date, etc.)
- Solve the problem by encoding special characters (e.g. spaces, Chinese characters, etc.)
curl: (3) URL rejected: Malformed input to a URL function
node -e 'console.log(require("querystring").escape("《新闻联播》 20240602.m4a"));'
# Evaluatepython -c "import urllib.parse; print(urllib.parse.quote('《新闻联播》 20240602.m4a'))"
# Command- Percent followed by two hexadecimal digits (e.g.
%E3%80%8A
is《
,%20
is Space)
- References
- https://gist.github.com/stokito/cf82ce965718ce87f36b78f7501d7940
man curl
#/^\s*-T
^
# Beginning of a line\s
# Space (Or*
# Zero or more-T
# Replace it with other literal string (e.g.-u
)
Use "h-m-m"
h-m-m
- Notes
- Warnings:
- Configuration files sometimes do not take effect
- Chinese fonts can cause typesetting disorder
vim ~/.config/h-m-m/h-m-m.conf
auto_save = true # Prevent accidental exits
s
# Saveq
# Quit (Q
: Without saving)
Space
# Toggle (Between collapse and expand)o
# Create a sibling node (Child node:O
)sibling
# Type your wordsCtrl-w
# Delete a wordCtrl-c
# Cancel (The current operation) OrCtrl-[
e
# Edit (Current node)
d
# Delete (Current node)u
# Undo
S
# Rename (Current file)/
# Searchb
# Expand all (Opposite:v
)n
# Next (Opposite:N
)
yay --sync h-m-m-git
# Install dependencies- Because to use a mind map tool in the terminal.
- Warnings:
- References
Enable trash feature for files on Linux
vi ~/.bashrc
alias rm='mv --target-directory=$HOME/.trash/'
source ~/.bashrc
# Make changes effective
- Notes
- Warning: Delete files may result in data loss. (Unless you are an adventurer)
mkdir ~/.trash/
# Make the directory if no such directorydoas crontab -e
# Enable scheduled deletion using root user (Solve permission denied problem)00 18 * * * /home/yaoniplan/.local/bin/cleanTrash.sh
vim ~/.local/bin/cleanTrash.sh
#!/usr/bin/env sh # Set variables trashDir="/home/yaoniplan/.trash" # Delete files and directories older than 30 days find "$trashDir" -mindepth 1 -ctime +30 -delete
chmod +x ~/.local/bin/cleanTrash.sh
# Change executable mode
\rm -rf ~/Downloads/trash
# Unalias to delete (Solve directory not empty problem)- Because people in a forum mentioned this requirement.
- References
man mv
#/-t
- ChatGPT
The abbreviation of "File Transfer Protocol" is "FTP"
- Communication
- Notes
- Because to transfer files from a server to another.
- References
Use "basename"
basename "$(swww query | sed --silent 's/.*image: //p')"
- Notes
- Because to get current wallpaper name in script.
- References
- ChatGPT
The abbreviation of "scalable vector graphics" is "svg"
- An image format
- Notes
- Because clearer than pictures in other formats. (e.g. GIF, PNG, etc.)
- References
Use "inkscape"
t
# TextFn-1
# Adjust positionupArrow
# Move up
- Notes
- Other - Icon 32x32 - New Document - Save as favicon.svg
vim ~/note/assets/index.html
<head> <link rel="icon" type="image/svg+xml" href="../assets/favicon.svg"> </head>
nix profile install nixpkgs#inkscape
# Install dependencies- Because to create an SVG favicon for a website.
- References
- ChatGPT
Use "dioxionary"
dioxionary --read-aloud --online Jesus
- Notes
dioxionary list
# List all queried words
- References
dioxionary --help
- https://github.com/vaaandark/dioxionary/releases
Use "ftp"
doas systemctl enable vsftpd --now
# Enable the daemon now
- Notes
- Other clients
192.168.10.100 # Server /grow # Path (Optional)
doas vim /etc/vsftpd.conf
# Set default directory for anonymous users anon_root=/mnt
doas systemctl restart vsftpd
# Restart to make it effective after editing configuration file
doas pacman --sync vsftpd
# Install dependencies- Because to use FTP in software that does not support SFTP.
- Other clients
- References
- https://wiki.gentoo.org/wiki/Vsftpd#Anonymous_read_access
man 5 vsftpd.conf
#/anon_root
man vsftpd
#/^file
Use "sdcv"
sdcv Linux
- Notes
- Download dictionary files
- Install downloaded dictionaries
doas tar --bzip2 -xf stardict-xfardic-gnu-linux-2.4.2.tar.bz2 -C /usr/share/stardict/dic/
# Extract '.tar.bz2'doas unzip dict-en-en.zip -d /usr/share/stardict/dic/dict-en-en/
# Extract '.zip'
nix profile install nixpkgs#sdcv
# Install dependencies
- References
- sdcv # StarDict console version
man sdcv
#/^file
- https://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary/191268#191268
Use "dict"
dict subject
- Notes
- Solve the problem
'dict.conf' doesn't specify any dict server
vim /etc/dict.conf
# Use online dictionariesserver dict.org
- Because to learn how to pronounce a word and how to use it.
- International Phonetic Alphabet
- Make a sentence
nix profile install nixpkgs#dict
# Install dependencies
- Solve the problem
- References
- https://wiki.gentoo.org/wiki/Dictd#Server_configuration
man dict
#/^config
/^file
Use "nmap"
nmap 192.168.10.0/24
# Scan all IP addresses (From192.168.10.0
to192.168.10.255
)nmap -sT -p- 192.168.10.100
-sT
# Scan TCP connect-p-
# Port (From 1 to 65535)
- Notes
- Because to scan all ports of an IP address.
nix profile install nixpkgs#nmap
# Install dependencies
- References
man nmap
#/-sT
/-p-
- ChatGPT
Use "cut"
brightnessctl --machine-readable | cut --delimiter=',' --fields='4'
- Notes
- Because to get the current brightness level percentage.
- References
Use "tr"
brightnessctl --machine-readable | cut --delimiter=',' --fields='4' | tr --delete '%'
# Delete a percentage characterecho $XDG_DATA_DIRS | tr ':' '\n'
# Replace colons with newlinesecho $XDG_DATA_DIRS | sed 's/:/\n/g'
# Another method
- Notes
- Because to make the output human-readable.
- References
- ChatGPT
Use "subfinder"
subfinder -domain yaoniplan.eu.org
- Notes
- Other methods (e.g. enumerate DNS, etc.)
pipx install sublist3r
# Install dependenciessublist3r --domain yaoniplan.eu.org
- Warnings: Cannot find the latest subdomain names on April 25, 2024.
nix profile install nixpkgs#subfinder
# Install dependencies- Because to find all subdomain names of a domain name.
- Other methods (e.g. enumerate DNS, etc.)
- References
tldr subfinder
Use "epr"
epr yourBook.epub
- Notes
- Disadvantages
- Code indentation is incorrect (epy)
m
# Metadatal
# Next screen (Opposite:h
)t
# Table of contents?
# Help pagenix profile install nixpkgs#epr
# Install dependenciespipx install epy-reader
# Install dependencies
- Disadvantages
- References
Use "baca"
baca yourBook.epub
- Notes
yay --sync baca-ereader-git
# Install dependencies
- References
Use "bk"
bk yourBook.epub
- Notes
nix profile install nixpkgs#bk
# Install dependencies
- References
Use "arianna"
org.kde.arianna
- Notes
l
# Next screen (Opposite:h
)flatpak install arianna
# Install dependencies
Use "bookworm"
/nix/store/phxpkf9ia91k58q00niavhi8w1k4fdr1-bookworm-unstable-2022-01-09/bin/com.github.babluboy.bookworm
- Notes
Ctrl-l
# LibraryCtrl-+
# Zoom in (Opposite:Ctrl--
)Space
# Next screen (Opposite:Shift-Space
)nix profile install nixpkgs#bookworm
# Install dependencies
- References
Use "koreader"
rocks.koreader.KOReader
- Notes
- Delete a file
0
# Go to the end of bookRightArrow
# Select delete button
PageDown
# Next list (Opposite:PageUp
)DownArrow
# Next screen (Opposite:UpArrow
)t
# Table of contentsflatpak install rocks.koreader.KOReader
# Install dependencies
- Delete a file
- References
- https://koreader.rocks/user_guide/#keyboardshortcuts
- https://github.com/koreader/koreader/wiki/Installation-on-desktop-linux#flatpak # AppImage version can access the network (e.g. WebDAV)
Use "zellij"
Ctrl-p d
# Split the terminal down to new a pane (Pane down)Alt-n
# New a paneAlt-k
# Move focus (Vim-like)Alt-[
# Toggle layout
Ctrl-p e
# Embed the pane in the middle or right of the tabCtrl-p w
# Toggle floating pane
Ctrl-t n
# New a tabCtrl-t 1
# Go to tab 1 (Orh/l
)
- Notes
vim ~/.config/zellij/config.kdl
keybinds { unbind "Ctrl h" // unbind in all modes (To recover Backspace key) }
nix profile install nixpkgs#zellij
# Install dependencies
- References
The abbreviation of "International Phonetic Alphabet" is "IPA"
/ˌɪnfərˈmeɪʃən/
/ˌ/
# Secondary stress/ˈ/
# Primary stress
- Notes
- Because to understand the stress part of a word.
- References
Tell me the International Phonetic Alphabet of word 'information'
# ChatGPT
Use "distrobox"
distrobox create --image debian:latest --name debian-distrobox
# Create a containerdebian
# Replace it with other Linux distribution (e.g.gentoo/stage3
)
distrobox enter debian-distrobox
# Enter a containerdistrobox list
# Get container name
distrobox rm debian-distrobox
# Remove a containerrm
# Replace it withstop
to stop it before removing if container is running
distrobox-export --bin /usr/bin/st --export-path ~/.local/bin/
# Export an application- Append
-delete
to the end of the line to delete the exported application
- Append
- Notes
nix profile install nixpkgs#distrobox
# Install dependencies
- References
man distrobox-export
#/examples
- Replace
export
with other action (e.g.create
)
- Replace
Use "imv"
imv -r /mnt/yaoniplan/chinaTelecom/2024/04/
i
# Zoom in (Opposite:o
)a
# Actual size (Restore original size)r
# Reset zoom and panh/j/k/l
# Vim-like (Pan pictures)]
# Next picture (Opposite:[
)p
# Print image path
- Notes
imv - < <(wl-paste --type image/png)
# View an image from clipboard-
# Read from standard input<
# Redirect the contents<()
# Create a temporary file
- Warning: Does not support web images in jpeg format. (But "feh" is OK)
imv https://alist.yaoniplan.eu.org/d/chinaTelecom/2024/03/26/6601c9e4474e8.jpeg
- https://libreddit.northboot.xyz/r/swaywm/comments/fpovat/what_image_viewer_is_recommended_for_sway_use/
vim ~/.config/imv/config
# Configure as needed[binds] # Copy path of current image to clipboard y = exec wl-copy "$imv_current_file" # Send a notification (e.g. /home/yaoniplan/.trash/2024-06-04-091824.png) p = exec notify-send "$imv_current_file" # Delete current image and quit <Shift+D> = exec rm "$imv_current_file"; quit
;
# Execute in order (e.g. Copy path and then send a notification)
doas pacman --sync imv
# Install dependencies- Because to view pictures on Wayland.
- References
- https://github.com/kuhy/.dotfiles/blob/master/image/imv.org #
/notify
less /etc/imv_config
#/current
man imv
#/binds$
/^config
- https://github.com/kuhy/.dotfiles/blob/master/image/imv.org #
Use "tdrop"
WAYLAND_DISPLAY=no tdrop -mta wayst --app-id wayst1
- Notes
vim ~/.config/hypr/hyprland.conf
# Make the window float if the window is not floating windowrulev2 = float, class:^(wayst1)$ # Bind a global shortcut key to show and hide the window bind = $mainMod, W, exec, WAYLAND_DISPLAY=no tdrop -mta wayst --app-id wayst1
nix profile install nixpkgs#tdrop
# Install dependencies- Because to use the drop-down terminal on Wayland.
- References
Use "hdrop"
vim ~/.config/hypr/hyprland.conf
bind = $mainMod, Space, exec hdrop --floating kitty --class kitty1
- Notes
nix profile install nixpkgs#hdrop
# Install dependencies- Because to use the drop-down terminal on Wayland.
- References
Use "kickoff"
kickoff
- Notes
- Warning: Some custom keys don't work
ctrl+shift-v
ctrl+[
vim ~/.config/kickoff/config.toml
# Customizenix profile install nixpkgs#kickoff
# Install dependencies
- Warning: Some custom keys don't work
- References
The abbreviation of "HTTP Live Steaming" is "HLS".
- An adaptive bitrate streaming protocol
- Notes
- Split video content into smaller segments
- Create a playlist file (e.g. playlist2160p.m3u8) containing the URLs for these segments
- Choose adaptive bitrates and resolutions based on bandwidth and device
- Deliver over HTTP(S) protocols (Compatible with web infrastructure)
- References
Use "wofi"
wofi --show dmenu
# Interact with user via scriptselected_option=$(echo -e "full\nactive\nselect" | wofi --show dmenu)
- Notes
vim ~/.config/wofi/style.css
window { font-size: 28px; }
vim ~/.config/wofi/config
# Like `wofi --show run` by default show=run
- Because that "tofi" software seems to be no longer maintained.
- References
- https://www.youtube.com/watch?v=KfOYXvRMcIQ # Beautify it using CSS
man 5 wofi
#/CSS SELECTOR
man 7 wofi
#/^mode
Use "date"
date +%s
# Seconds since the Epoch (1970-01-01 00:00 UTC)- (e.g. 1712921641)
- Notes
- Because to generate UNIX timestamp.
- References
man date
#/%s
Use "okular"
okular
- Notes
- Disadvantages
- The operation is too complicated
- The page turning animation delay is too long
nix shell nixpkgs#okular
# Install dependencies
- Disadvantages
Use "xpdf"
nix shell nixpkgs#xpdf
# The software is marked as unsafe... error: Package ‘xpdf-4.05’ in /nix/store/bjv2qk3gg1iv69rbama3q9aprcp6d9wp-source/pkgs/applications/misc/xpdf/default.nix:61 is marked as insecure, refusing to evaluate. ...
Get the full path of a file
realpath msyh.ttc | wl-copy
# Copy the full path to clipboard
- Notes
- Because to upload a file to remote machine via script.
- References
- ChatGPT
Resize Linux swap partition
doas fdisk /dev/sda
m
# Print the memup
# Print all partitionse
# Resize a partition (e.g. 2)n
# New a partition (e.g. 3)t
# Change a partition type (e.g. swap)w
# Write to disk
doas mkswap /dev/sda3
# Format the new swap partitiondoas swapon /dev/sda3
# Activate it
- Notes
- Warning: Manipulate hard disk partitions may result in data loss. (Unless you are an adventurer)
- Solve the problem about 'BTRFS error ... device total_bytes should be at most ...'
btrfs rescue fix-device-size /dev/sda2
- Because to solve the
[ERROR]: Out of memory, exiting.
problem.
- References
Use "qpdfview"
qpdfview yourBook.pdf
- Notes
- Warnings: Could not load plug-in for file type 'EPUB'
qt.qpa.wayland: EGL not available
Ctrl-f
# Find textCtrl-Shift-t
# Tool barCtrl-Shift-m
# Menu barCtrl-i
# Invert color (Dark mode)nix profile install nixpkgs#qpdfview
# Install dependencies
- Warnings: Could not load plug-in for file type 'EPUB'
- References
- In 'Shortcuts' of 'Settings' of 'Edit'
Use "evince"
evince yourBook.pdf
- Notes
- Warnings: Unable to open document "file:///path/to/book.epub".
File type Electronic book document (application/epub+zip) is not supported
Ctrl-i
# Invert color (Dark mode)nix profile install nixpkgs#evince
# Install dependencies
- Warnings: Unable to open document "file:///path/to/book.epub".
- References
- In 'Keyboard Shortcuts' of 'File options'
Understand "RX" and "TX"
RX
# Reception (Download)TX
# Transmission (Upload)
- Notes
- Because see it when using "btm".
- References
- ChatGPT
Use "sioyek"
Shift-o
# Open previous book (e.g. tutorial.pdf)+
# Zoom in (Opposite:-
):dark
# Toggle dark mode:number
# Jump to page by page numbert
# Table of contents (Better method)
q/j/k/gg/G/ma/
# Vim-likeSpace
# Scroll pages (Opposite:Shift-Space
)
- Notes
vim ~/.config/sioyek/prefs_user.config
# Set fonts for epub epub_css *{font-family: sans-serif;} # Set dark mode by default default_dark_mode 1
yay --sync sioyek-git
# Install dependencies (Maybe it does not release any more new versions)
- References
- https://github.com/ahrm/sioyek/issues/706#issuecomment-1910112060 # font
- https://sioyek-documentation.readthedocs.io/en/latest/configuration.html
- https://github.com/ahrm/sioyek/releases # Extract portable.zip to get AppImage version
- https://github.com/ahrm/sioyek/blob/main/tutorial.pdf
- https://sioyek-documentation.readthedocs.io/en/latest/
Use "mupdf"
mupdf -I yourBook.epub
- Notes
- Zoom in
Z
# Zoom fitW
# Width+
# Zoom in
-I
# Invert colors (Dark mode)Shift-i
# Toggle
doas pacman --sync mupdf
# Install dependencies
- Zoom in
- References
Use "zathura"
zathura yourBook.pdf
- Notes
- Use slideshow
git clone https://github.com/crvdgc/latex-beamer-flake cd latext-beamer-flake && rm -rf .git && git init git add . && nix build
vim ./slides.md
# Write slidesnix build
# Bulid slideszathura ./result/latex-beamer-demo.pdf
# View slidesCtrl-n
# Hide statusbarSpace/Shift-Space
# Scroll pagesg
# Go to the top (Opposite:G
)ma
# Mark (Return mark:'a
)
/
# SearchTab
# Table of contentsvim ~/.config/zathura/zathurarc
map i recolor set recolor-darkcolor "#B0B002"
i
# Pressi
to enable dark mode
a/s
# Adjust window+
# Zoom in (Opposite:-
)
j/k/q
# Vim-likenix profile install nixpkgs#zathura
# Install dependencies
- Use slideshow
- References
Understand a ".m3u" file
vi ~/playlist.m3u
#EXTM3U #EXTINF:-1 tvg-name="LoveNrture" group-title="•4K",Love Nrture 4K「自然」 https://d18dyiwu97wm6q.cloudfront.net/playlist2160p.m3u8
- Notes
EXT
# ExtendedINF
# Information-1
# Indefinite (Unknown duration)group-title
# CategoryLove Nrture 4K「自然」
# Name
- References
Use "hyprctl"
hyprctl version
# Get version of Hyprlandhyprctl activewindow
# Get geometry of current windowhyprctl dispatch exit
# Exit hyprlandhyprctl dispatch movetoworkspace "1,address:0x583b23a8c460"
# Fix window disappearing bughyprctl clients -j
# Get address (e.g.0x583b23a8c460
)
hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"'
- e.g.
690,22 654x355
- e.g.
- Notes
-j
# JSON\()
# Placeholders (Be replaced with actual values).at[0]
# The first element (e.g.690
) of the array (e.g.at
)
- References
Use "exit"
vim ~/.local/bin/captureFullscreen2PNG.sh
# Exit the script with a specific exit statusif [[ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]]; then ... else echo "Error: Your \$XDG_CURRENT_DESKTOP is not Hyprland." exit 1 fi
- Notes
$XDG_CURRENT_DESKTOP
# Get current desktop0
# Success (Opposite:1
)- Because need to modify a Bash script to improve compatibility.
- References
- ChatGPT
Use "eww"
eww daemon
# Remember to run it in the background as a daemon
- Notes
vim ~/.config/eww/eww.yuck
- Example window
(defwindow example :monitor 0 :geometry (geometry :x "0%" :y "20px" :width "90%" :height "30px" :anchor "top center") :stacking "fg" :reserve (struts :distance "40px" :side "top") :windowtype "dock" :wm-ignore false "example content")
- Example window
eww open example
# Replaceopen
withclose
to close a windoweww list-windows
# Get name
nix profile install nixpkgs#eww
# Install dependencies
- References
Use "waybar"
waybar
# Remember to run it in the background as a daemon
- Notes
- Warning: Cannot modify the value of min-height (Save space)
vim ~/.config/waybar/config.jsonc
# This works, but the interactivity is gone{ ... "mode": "overlay", ... }
- https://github.com/Alexays/Waybar/issues/185
- https://github.com/Alexays/Waybar/discussions/2594
- Use "nerd-fonts" to display iconic font
doas pacman --sync nerd-fonts
# Install dependencies
vim ~/.config/waybar/config.jsonc
# Click to execute script{ "layer": "top", "modules-center": ["clock"], "clock": { "format-alt": "{:%a, %d. %b %H:%M}", "on-click": "bash ~/.local/bin/controlMpv.sh", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>" } }
- https://github.com/Alexays/Waybar/discussions/3072#discussioncomment-8903605 # Adjust calendar
- Show calender on hover
vim ~/.config/waybar/style.css
# Simulate dynamic island* { /* Make the background transparent */ background-color: transparent; } .modules-center { font-weight: bold; /* Make font bold */ padding: 0px 8px; /* Fill space for height and width */ background-color: rgba(0, 0, 0, 1); /* Set dark mode */ border-radius: 20px; /* Set rounded corners */ } tooltip { /* Set dark mode for calendar that pops up when mouse is hovered */ background-color: rgba(0, 0, 0, 1); }
nix profile install nixpkgs#waybar
# Install dependencies
- Warning: Cannot modify the value of min-height (Save space)
- References
Use "uosc"
vim ~/.config/mpv/input.conf
# Play next in playlist Enter script-binding uosc/next # Display playlist (Or `uosc/playlist`) Ctrl+p script-binding uosc/items
vim ~/.config/mpv/script-opts/uosc.conf
autoload=yes
vim ~/.config/mpv/mpv.conf
keep-open=yes
- Notes
vim ~/.config/mpv/script-opts/uosc.conf
# Hide top bar controls and title # Avoid the problem of always being on the screen top_bar_controls=no top_bar_title=no
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)"
# Install dependencies
- References
Use "wine"
wine ~/.wine/drive_c/path/to/yourProgram.exe
# Run the installed package
- Notes
- Solve the problem which is needed for .NET applications to work correctly.
yay --sync wine-mono
- Fonts
- Copy msyh.ttc and msyhbd.ttc from https://github.com/taveevut/Windows-10-Fonts-Default/tree/master to
~/.wine/drive_c/windows/Fonts/
vim ~/.wine/msyh_font.reg
REGEDIT4 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink] "Lucida Sans Unicode"="msyh.ttc" "Microsoft Sans Serif"="msyh.ttc" "MS Sans Serif"="msyh.ttc" "Tahoma"="msyh.ttc" "Tahoma Bold"="msyhbd.ttc" "msyh"="msyh.ttc" "Arial"="msyh.ttc" "Arial Black"="msyh.ttc"
wine regedit ~/.wine/msyh_font.reg
# Make changes effective
- Copy msyh.ttc and msyhbd.ttc from https://github.com/taveevut/Windows-10-Fonts-Default/tree/master to
yay --sync wine-staging-wow64
# Install dependencies- Because niece's programming class requires Windows software to be installed on Linux.
- Solve the problem which is needed for .NET applications to work correctly.
- References
Use "ble.sh"
Ctrl-f
# Insert the suggestionAlt-f
# Insert only the first word of the suggestion
- Notes
- Warning: Flase trigger rate is higher than default. (Can't control it on March 30, 2024.)
- Install dependencies
git clone --recursive https://github.com/akinomyoga/ble.sh ~/.config/ble.sh cd ~/.config/ble.sh && make
vim ~/.bashrc
# Load it by default# Add this lines at the top of .bashrc: [[ $- == *i* ]] && source ~/.config/ble.sh/out/ble.sh --noattach # your bashrc settings come here... # Add this line at the end of .bashrc: [[ ${BLE_VERSION-} ]] && ble-attach
- References
Use "fbgrab"
fbgrab screenshot.png
- Notes
- Warning: This method can only capture the tty screen.
- Solve the problem
[yaoniplan@tux ~]$ doas fbgrab -w 1366 -h 768 -b 16 -f framebuffer.dump fb.png Line length cannot be smaller than width [yaoniplan@tux ~]$
doas fbgrab -w 1366 -h 768 -b 16 -f framebuffer.dump -l 1366 fb.png
# Set the line length
- Solve the problem
[yaoniplan@tux ~]$ fbgrab screenshot.png Error: Couldn't open /dev/fb0.
doas fbgrab screenshot.png
# Get permission to access the framebuffer device
- Because to take a screenshot on server via SSH.
- References
- ChatGPT
The abbreviation of "near-filed communication" is "nfc".
- A set
- Communication protocols
- A set
- Notes
- Because need to use an electronic card on mobile phone.
- References
Try a transit card if on iPhone
- Add a bank card (e.g. China UnionPay Debit Card)
- Recharge the transit card
- Add a transit card (e.g. Beijing T-Union Transit Card)
- Wallet - Add button - Transit Card
- Add a bank card (e.g. China UnionPay Debit Card)
- Notes
- Because to make taking transportation (e.g. bus, subway) more convenient
- Without opening payment software manually
- Because to make taking transportation (e.g. bus, subway) more convenient
- References
transit card site:apple.com
# Google- https://support.apple.com/en-us/108373
en-us
# Replace it with your code (e.g.zh-cn
,ja-JP
, etc.)ja
# Japanese (Language code)JP
# Japan (Region code)
- https://support.apple.com/en-us/HT208539
- ChatGPT
The abbreviation of "electronic publication" is "epub".
- Because mobile device compatibility is better than PDF.
- References
After trying the Emby for a few months #idea
- Not many resources compared to some film and television websites
The abbreviation of "Really Simple Syndication" is "RSS".
- The efficiency is not as high as active search when needed
- Notes
- Like a small search engine
- Hope to save time and cost for all mankind
- Like a product of the industrial revolution
- References
Try another network operator if in China
- China Mobile
- China Telecom
- China Unicom
- China Broadnet
- Notes
- Send SMS to current network operator
CXXZ#yourIdName#yourIdNumber
# 查询携转SQXZ#yourIdName#yourIdNumber
# 授权携转- Choose based on your needs after trying them
- Send SMS to current network operator
- References
Try some song list music software
- Like Prometheus stealing fire from the gods as a gift to mankind
- Notes
- It's convenient to use AppImage if in Linux.
- References
Use "obsidian"
Ctrl-p
# Open command palette- Find commonly used commands
Ctrl-o
# Open quick switcher- New a file
- Switch within files
- Notes
- Warning: It's an unfree software.
- Tips
- Leave professional things to professional software
- Do not all in one (Add plugins as needed)
flatpak install flathub md.obsidian.Obsidian
# Install dependencies- Because to want my friends to quickly learn about a simple and fast Markdown note-taking software.
- References
- https://www.youtube.com/watch?v=phEyrE5rRRg
- In 'Hotkeys' of 'Options' of 'Settings'
Interact with tofi
vim ~/.local/bin/controlMpv.sh
# Interact with tofi selected_option=$(echo -e "delete\nplay/pause" | tofi) case "$selected_option" in "delete") echo 'run rm "${path}"; playlist-remove current' | socat - "/tmp/mpvsocket" ;; "play/pause") echo cycle pause | socat - "/tmp/mpvsocket" ;; *) echo "Invalid selection. Aborting." exit 1 ;; esac
- Notes
- Because to control "mpv" from the command-line via a script.
- References
- ChatGPT
Use "qutebrowser"
qutebrowser
- Notes
- Disadvantages
- https://github.com/qutebrowser/qutebrowser/issues/7286#issuecomment-1168130067 # Some scripts are incompatible
- https://github.com/qutebrowser/qutebrowser/issues/30 # Do not support Chromium extensions
gC
# Duplicate the current tab- Open developer tools
wi
# Web inspector (Ctrl-[
,wIf
):devtools
# Developer tools- Right-click 'Inspect'
:adblock-update
# Get adblock listsCtrl-Tab
# Toggle between two tabs- Use userscripts
- Put your file (e.g. https://github.com/AckslD/Qute-Translate/blob/master/translate) in
~/.config/qutebrowser/userscripts/
# Method one - Put your file (e.g. redirectUrl.user.js) in
~/.config/qutebrowser/greasemonkey/
# Method two :greasemonkey-reload
# Make it effective- Because to block advertisements and translate a word.
- Put your file (e.g. https://github.com/AckslD/Qute-Translate/blob/master/translate) in
pp
# Paste URL from clipboard (Pp
: In new tab):wq
# Restore tabs the next time you open qutebrowser;y
# Yank hint linkgo
# Edit the current URLCtrl-h
# Homepage (Startpage)r
# Reload the current tabF
# Open link in new tabo
# Complete:open
automatically (O
: In new tab):open gh tofi
# Search in GitHub
:open alist.yaoniplan.eu.org
# Open URL in current tabCtrl-i
# Complete URL (The same asTab
)Ctrl-j
# Confirm (The same asEnter
)Ctrl-[
# Cancel (The same asEsc
)Ctrl-h
# Delete a letter (The same asBackspace
)
/music
# Search textCtrl-j
# Entern
# Next match
d
# Close the current tab (The same asCtrl-w
)u
# Undo closed tab
yy
# Copy URL to clipboardH
# Previous pagei
# Insert textgt
# Search tab (OrT
)J
# Next tab
vim ~/.config/qutebrowser/config.py
# Bind the command to set playback speed to 2 to the key 'q' config.bind('q', 'clear-messages ;; jseval document.querySelector("video, audio").playbackRate = 2') # Toggle status bar and tabs config.bind('X', 'config-cycle statusbar.show always never;; config-cycle tabs.show always never') # Hide tabs and status bar by default c.tabs.show = 'never' c.statusbar.show = 'never' # Custom keybindings (See: `qute://settings/` to get setting and value) # Translate languages: auto, en, zh-CN, etc. # Play videos with mpv c.bindings.commands = {"normal": {"<Ctrl+Shift-t>": "spawn --userscript translate --text", "<Ctrl-t>": "spawn --userscript translate", "gM": "hint links spawn mpv {hint-url}"}} # Custom start page c.url.start_pages = '~/note/assets/index.html' # Custom search engines c.url.searchengines = { "DEFAULT": 'https://google.com/search?q={}', "gh": 'https://github.com/search?q={}' "t": 'https://translate.google.com/#auto/en/{}' } # Custom hints c.fonts.hints = 'bold 15px Fira Code' c.colors.hints.fg = 'white' c.colors.hints.bg = 'black' c.hints.border = '0px solid #E3BE23' # Load automatically config.load_autoconfig(True) # Enable dark mode c.colors.webpage.preferred_color_scheme = 'dark' c.colors.webpage.darkmode.enabled = True c.colors.webpage.bg = 'black'
:config-write-py
# Generate if~/.config/qutebrowser/config.py
does not exist:config-source
# Make changes effective
yay --sync qutebrowser
# Install dependencies
- Disadvantages
- References
- https://libreddit.perennialte.ch/r/qutebrowser/comments/os9hed/qutebrowser_video_speed_controller/
- https://libreddit.oxymagnesium.com/r/qutebrowser/comments/hxa58m/where_do_i_see_my_consolelogs/
- https://github.com/qutebrowser/qutebrowser/issues/6005 #
/status
- https://github.com/noctuid/dotfiles/blob/master/browsing/.config/qutebrowser/config.py
- https://old.reddit.com/r/qutebrowser/comments/k1pr5z/greasemonkey_scripts_minimal_example/gdqyoaq/
- https://www.ii.com/qutebrowser-configpy/
- https://old.reddit.com/r/qutebrowser/comments/i6n71m/yank_hint_url/g0wtgd7/
- https://old.reddit.com/r/qutebrowser/comments/7kydgn/how_to_custom_a_command/driv86o/
- https://old.reddit.com/r/qutebrowser/comments/7gckl8/how_do_you_edit_the_current_url/dqiev2o/
- https://old.reddit.com/r/qutebrowser/comments/la7vcy/caretmode_hints/glmdl8w/
- https://old.reddit.com/r/qutebrowser/comments/zmqey6/an_update_on_the_status_of_dark_mode/j0dp5o4/
:help
# Open help pages
Use "musikcube"
musikcube
Space
# Select your music paths before usingEnter
,rightArrow
keya
# Libraryk
# Volume down 5%l
# Next song
s
# Settings
- Notes
- Warning: Use "mpv" as a music player to replace it on March 13, 2024.
vim ~/.config/musikcube/hotkeys.json
# Enable Vi mode... "key_down": "j", "key_left": "h", "key_right": "l", "key_up": "k", ... "playback_next": "M-l", "playback_previous": "M-j", "playback_volume_down": "M-k", "playback_volume_up": "M-i", ...
nix profile install nixpkgs#musikcube
# Install dependencies- Because to play next song in the directory automatically.
- References
Use "tori"
tori
- Notes
- Warning: Use "mpv" as a music player to replace it on March 13, 2024.
vim ~/.config/tori.yaml
playlists_dir: /mnt/server/al.jybest.ltd/
- References
Use "vmn"
vmn
Enter
# Play
- Notes
- Warning: Use "mpv" as a music player to replace it on March 13, 2024.
--headless=yes
# No video output--library=/mnt/server/al.jybest.ltd/IU专辑合集/
# Directory contains music files--view=song-only
# Output complete paths of all audio filesyay --sync vmn
# Install dependencies
- References
man vmn
The abbreviation of "featuring" is "feat.".
- Featured guest
- Notes
- Because saw it while listening to music.
- References
Extract a ".7z" file
~/.venv/bin/ipython
# Method oneimport py7zr with py7zr.SevenZipFile("./KikoPlay_1.0.1_Linux-x86_64.7z", mode='r') as z: z.extractall()
7z x ~/Downloads/MTI.7z -o/mnt/grow/temporary/ankiDeck/
# Method two7z l ~/Downloads/MTI.7z
# List it before extractingx
# Extract-o
# Output directory
- Notes
- Install dependencies
uv pip install ipython py7zr
# Method onenix profile install nixpkgs#p7zip
# Method two
- Install dependencies
- References
Use "flatpak"
flatpak override --user --filesystem=/home/$(whoami)/Downloads/ com.github.ahrm.sioyek
# Allow access to a directory/home/$(whoami)/Downloads
# Replace it with other directory (e.g./mnt/$(whoami)
)
flatpak search kikoplay
# Search a package--columns=application
# Get Application ID
flatpak install io.github.KikoPlayProject.KikoPlay
# Install a packageinstall
# Replace it withuninstall
to uninstall
flatpak run io.github.KikoPlayProject.KikoPlay
# Run a packageio.github.KikoPlayProject.KikoPlay
# Another method
flatpak list
# List installed packages
- Notes
- Warning: Some software cannot run properly on Xwayland.
yaoniplan@tux ~/Downloads $ QT_QPA_PLATFORM="xcb" flatpak run io.github.KikoPlayProject.KikoPlay libpng warning: iCCP: known incorrect sRGB profile Cannot load libcuda.so.1 Cannot load libcuda.so.1 Failed to recognize file format. yaoniplan@tux ~/Downloads $
- Set a mirror if in China
doas flatpak remote-add flathub https://mirror.sjtu.edu.cn/flathub/flathub.flatpakrepo
remote-add
# Replace it withremote-modify
if existsdoas vim /var/lib/flatpak/repo/config
# Another wayurl=https://dl.flathub.org/repo/ url-is-set=true
doas pacman --sync flatpak
# Install dependencies
- Warning: Some software cannot run properly on Xwayland.
- References
Use "uv"
- Build a Python project
uv init
# Create a new Python project in the current directoryuv add selenium
# Add a selenium package to the projectuv run checkIn.py
# Run a script in the project's environment
uv pip uninstall ani-cli
# Uninstall a packageuv pip list
# List installed packagesuv pip install anki
# Install a package- Install Python tools globally (The ImportError problem makes it impossible to use)
uv tool install xklb
# Replaceinstall
withuninstall
to uninstalluv tool list
# List installed tools
- Build a Python project
- Notes
--index-url https://pypi.tuna.tsinghua.edu.cn/simple/
# Use a mirror (Improve download speed)- Warnings: Cannot support
uv pip install git+https://github.com/wustho/epr.git
nix profile install nixpkgs#uv
# Install dependencies
- References
The abbreviation of "internationalization" is "i18n".
18
# nternationalizatio (20 - 2)
- References
- https://en.wikipedia.org/wiki/Internationalization_and_localization
- The Hard Thing About Hard Things # Chapter 9: The End of the Beginning
Use "swww"
swww query
# query informationswww img /usr/share/hyprland/wall_anime_2K.png
swww-daemon
# Run in the background as a daemon at boot time
- Notes
--transition-type any
# Fashionnix profile install nixpkgs#swww
# Install dependencies- Because to set wallpaper on Wayland.
- References
- https://github.com/LGFae/swww#usage
- https://wiki.hyprland.org/Useful-Utilities/Wallpapers/
swww img --help | less
#/transition
Use "violentmonkey"
Ctrl-l
# Select lineCtrl-[
# Indent less
- Notes
- Because to write a user script for a website.
- References
- In
?
tab of the code editing page
- In
Use "obs"
obs
# Configure recording settings to your preferences# In Settings of File MPEG-4 (.mp4) # Recording Format 1364x768 # Output (Scaled) Resolution 60 # Common FPS Values %CCYY-%MM-%DD_%hh-%mm-%ss # Filename Formatting
- Add a source (e.g. Screen Capture) In Sources
- Leave only an audio mixer (e.g. Desktop Audio) to avoid recroding environment sound (e.g. computer fan, keyboarding)
- Or use a microphone
- Start Recording
- Notes
doas pacman --sync obs-studio
# Install dependencies- Use Nix to install it will output errors
error: Failed to initialize video. Your GPU may not be supported, or your graphics drivers may need to be updated.
echo "127.0.0.1 localhost" | doas tee -a /etc/hosts
# Solve the problemyaoniplan@tux ~ $ obs-cli recording start error: dial tcp: lookup localhost: Temporary failure in name resolution yaoniplan@tux ~ $
- Use Nix to install it will output errors
- References
- ChatGPT
Use "javascript"
- Interact with video
// Enable full-screen mode for the video (Opposite: `webkitExitFullscreen`) document.querySelector('video').requestFullscreen(); // Play the video (Replace `play` with `pause` to stop it) document.querySelector('video').play(); // Set the video speed to 2.5 document.querySelector('video').playbackRate = 2.5;
- Press Enter key to click next episode icon
document.addEventListener('keydown', function(event) { if (event.key === 'Enter') { let url = window.location.href; let nextIcon = null; if (url.includes("https://github.com")) { nextIcon = document.querySelector('a[rel="next"]'); } else if (url.includes("https://www.google.com")) nextIcon = document.querySelector('a#pnnext'); if (nextIcon) { nextIcon.click(); } } });
- Press Enter key to go to next episode URL
document.addEventListener('keydown', function(event) { if (event.key === 'Enter') { let currentPageURL = window.location.href; // Get the current page URL let pageNumber = currentPageURL.match(/\/(\d+)\.(\w+)$/)[1]; // Extract the page number from the URL let fileExtension = currentPageURL.match(/\/(\d+)\.(\w+)$/)[2]; // Extract the file extension from the URL let nextPageNumber = parseInt(pageNumber, 10) + 1; // Increment the page number let nextPageNumberPadded = String(nextPageNumber).padStart(pageNumber.length, '0'); // Zero-pad the next page number let nextPageURL = currentPageURL.replace(`/${pageNumber}.${fileExtension}`, `/${nextPageNumberPadded}.${fileExtension}`); // Construct the next URL window.location.href = nextPageURL; // Redirect to the next URL } });
- Redirect URL if your IP is blocked
if (window.location.hostname === "www.reddit.com") { window.location.href = "https://old.reddit.com" + window.location.pathname + window.location.search; }
- Press Enter key to go to next episode URL
- Access iframe after DOM content loaded
document.addEventListener('DOMContentLoaded', function() { var iframe = document.getElementById('playiframe'); if (iframe) { // Add your code here. } });
- Interact with video
- Notes
div.video-switch-icon:nth-child(3)
# Get CSS selector- Use
Ctrl-Shift-c
then click (Locate the element's position in HTML) - Right-click the pop-up location - Copy - CSS Path (Or Outer HTML, ask ChatGPT how to click it)
- Use
- In userscript manager
// ==UserScript== // @key value // ==/UserScript== // Add your JavaScript code here.
- Replace following key and value with yours
// @name Press Enter key to click next episode
# Script name// @match https://www.agedm.org/*
# Match URL
- Because to achieve semi-automation in the website.
- References
Use "fastfetch"
fastfetch
- Notes
--pipe
# Disable logo (To show full text)--logo none
# Another method with colors
- Because it faster than "neofetch".
nix profile install nixpkgs#fastfetch
# Install dependencies
- References
fastfetch --logo
Convert Unix timestamp to human readable time
date --date=@1707053016
- (
Sun Feb 4 09:23:36 PM CST 2024
)
- (
- Notes
+"%Y-%m-%dT%H:%M:%SZ"
# Append to the end- (
2024-02-04T21:23:36Z
)
- (
- Other methods
perl -le 'print scalar localtime(1707053016)'
python -c "import datetime; print(datetime.datetime.fromtimestamp(1707053016))"
awk 'BEGIN { print strftime("%c", 1707053016) }'
- References
man date
#/-d
- ChatGPT
Use "cmus"
:unbind browser enter
# Remove a key binding usingTab
5
# Display the directory browserCtrl-r
# Repeat currentCtrl-h
# Previous directory (The same as../
)Ctrl-j
# Play (The same asEnter
)D
# Delete a song from library (The same asDelete
)a
# Add to library and move to next line-
# Reduce volume by 10% (Opposite:+
)/
# Searchc
# Pause or resume while playingm
# Toggle aaa mode (Artist, album, or all)
7
# Settings1
# Library
- Notes
- Warning: Use "mpv" as a music player to replace it on March 13, 2024.
vim ~/.config/cmus/rc
# Show the directory in browser viewcd /mnt/server/al.jybest.ltd/
nix profile install nixpkgs#cmus
# Install dependencies
- References
- https://old.reddit.com/r/linuxquestions/comments/hbnmss/override_home_directory_in_cmus/ik0md15/
man cmus
#/unbind
man cmus-tutorial
Use "jq"
echo "$response" | jq --raw-output '.content'
# Replace.content
with the desired key for filtering
- Notes
.[].url
.[]
# Iterate over each object
.data.content[] | select(.is_dir == false) | "\(.name | @uri)?sign=\(.sign)"
select(.is_dir == false)
# Filter items whereis_dir
isfalse
"\()"
# Embed the value of a field or expression inside a string@uri
# Uniform resource identifier (Encode a string)
.data.content[].name
# Navigate to thename
field within each object in thecontent
array inside thedata
object, extract eachname
value.data
# Access thedata
key in the JSON object.content
# Access thecontent
array[]
# Iterate over each element of thecontent
array.name
# Access thename
field of each object in thecontent
array
jq
# JSON querynix profile install nixpkgs#jq
# Install dependencies- Because to extract the value of the
content
key from the JSON response.
- References
vi example.json
{ "code": 200, "message": "success", "data": { "content": [ { "name": "001 music", "size": 0, "is_dir": true, "modified": "2022-04-04T01:49:16+08:00", "created": "2022-04-04T01:49:16+08:00", "sign": "", "thumb": "", "type": 1, "hashinfo": "null", "hash_info": null }, { "name": "002 music", "size": 0, "is_dir": true, "modified": "2022-04-04T01:49:17+08:00", "created": "2022-04-04T01:49:17+08:00", "sign": "", "thumb": "", "type": 1, "hashinfo": "null", "hash_info": null } ] } }
jq --raw-output '.data.content[].name'
001 music 002 music
man jq
#/-r
- ChatGPT
Use "synctv"
vim ~/.config/synctv/docker-compose.yml
version: '3.3' services: synctv: image: 'synctvorg/synctv:latest' container_name: synctv restart: always ports: - '8080:8080/tcp' - '8080:8080/udp' volumes: - ~/.config/synctv:/root/.synctv environment: - PUID=0 - PGID=0 - UMASK=022 - TZ=Asia/Shanghai
docker-compose up --detach
# Run in the background
- Notes
- Disadvantages: no English, complex operation steps
192.168.10.100:8080
# Run in the Chromiumroot
# Account and password
- References
Generate a UUID randomly
uuidgen
- Notes
- Other methods
cat /proc/sys/kernel/random/uuid
python -c 'import uuid; print(uuid.uuid4())'
- Because to use vless on a foreign server.
- Other methods
- References
- ChatGPT
Use "cloudflared"
cloudflared tunnel login
# Copy and open a URL to verifycloudflared tunnel create memos2
# Create a tunnelvim ~/.cloudflared/config.yml
url: http://localhost:5230 tunnel: 6c24fc10-8436-4adf-9f75-f5bdacdeedf8 credentials-file: /home/yaoniplan/.cloudflared/6c24fc10-8436-4adf-9f75-f5bdacdeedf8.json
cloudflared tunnel list
# Get the ID (e.g. 6c24fc10-8436-4adf-9f75-f5bdacdeedf8)
cloudflared tunnel route dns memos2 memos2.yaoniplan.eu.org
# Assign a CNAME record to tunnel subdomaincloudflared tunnel run memos2
# Run the tunnel
- Notes
- Run multiple services
vim ~/.cloudflared/config.yml
tunnel: 2ec7443a-fc35-4160-b260-fc3055089c5d credentials-file: /home/yaoniplan/.cloudflared/2ec7443a-fc35-4160-b260-fc3055089c5d.json ingress: - hostname: alist.yaoniplan.eu.org service: http://localhost:28465 - hostname: download.yaoniplan.eu.org service: http://localhost:53420 - service: http_status:404
cloudflared tunnel route dns alist alist.yaoniplan.eu.org
# Replacealist
with other service (e.g. download)cloudflared tunnel run alist
# Replacealist
with other service (e.g. download)
cloudflared tunnel delete memos2
# Delete a tunnelcloudflared tunnel cleanup memos2
# Cleanup connection before deleting
doas pacman --sync cloudflared
# Install dependencies- Use nix will take a lot of time to compile
- Solve the problem
Failed to add route: code: 1003, reason: Failed to create record alist.yaoniplan.eu.org with err An A, AAAA, or CNAME record with that host already exists. For more details, refer to <https://developers.cloudflare.com/dns/manage-dns-records/troubleshooting/records-with-same-name/>.
- https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/#create-dns-records
- Remove conflicting records (e.g. CNAME)
- Because to try to run some applications on the internet.
- Run multiple services
- References
- https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/configuration-file/#file-structure-for-public-hostnames
- https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/
cloudflared tunnel --help | less
#/delete
Create a Firefox profile without cookies for testing purposes
firefox -CreateProfile testing_profile
# Create a profilefirefox -P testing_profile
# Launch with the profile
- Notes
- Delete a profile
firefox -ProfileManager
# Select, Deleterm -rf ~/.mozilla/firefox/gazu9g2t.testing_profile
# Another method
- Delete a profile
- References
- ChatGPT
Use "pm2"
pm2 logs alist
# View logs of a processpm2 monit
# View previous commandpm2 stop all
# Reduce memory usage temporarilypm2 start all
# Start all stopped processes
pm2 restart alist
# Restart after modifying the configuration filepm2 start ./alist -- server
# Start./alist server
commandpm2 save
# Save process listpm2 resurrect
# Resurrect dumped processes
pm2 delete synctv
# Delete a processpm2 list
# List all processes
- Notes
--name cloudflared-alist
# Set a name for the process- Because to try to use a foreign server when no docker.
npm install -g pm2
# Install dependencies
- References
pm2 --help | less
#/delete
/status
/save
/name
- https://github.com/Unitech/pm2
Use "bemenu"
bemenu-run --hb '#467b96' --hf '#dfdfdf' --tb '#467b96' --tf '#dfdfdf' -H 20 --fn 'Fira Code' -p '->'
- Notes
Ctrl-y
# Paste from clipboard- Advantages
- High compatibility with dmenu
- Disadvantages
- Set default values (Does not support configuration files)
- https://github.com/nix-community/home-manager/pull/4713#issue-2015985146
- Use '##' to replace '#' to make command effective in Hyprland
- Other theme
- Vertical
bemenu-run -i -l 10 -w --scrollbar=autohide -n --fn 'SF Mono 16' --nb '#282C34' --nf '#ABB2BF' --tb '#282C34' --tf '#ABB2BF' --fb '#282C34' --ff '#ABB2BF' --hf '#ABB2BF' --hb '#3E4451' --sb '#282C34' --sf '#61AFEF' --scb '#282C34' --scf '#61AFEF'
- Vertical
- References
Use "cloudflare"
- Use R2 (Need PayPal and debit card)
- R2 - Create bucket - Bucket name (e.g. memos)
- Manage R2 API Tokens - Create API token - Token name (e.g. Memos R2 Token) - Permissions (e.g. Admin Read & Write) - Copy (e.g. Access Key ID, Secret Access Key, Endpoints)
- R2.dev subdomain - Allow Access - allow - Public R2.dev Bucket URL (copy)
- Use Worker
- Workers & Pages - Create application - Create Worker (Optional: Change name) - Deploy
- Configure Worker - Edit Code - Paste the following code - Save and deploy
- Trigers - Add Custom Domain - Domain (your subdomain, note that your domain name must be in Cloudflare)
- Use Tunnels
- Zero Trust - Networks - Create a tunnel - Select your connector (e.g. Cloudflared)
- Tunnel name (e.g. memos) - Save tunnel - Choose your environment (e.g. Docker)
- Copy and run command in your server - Subdomain (e.g. memos) - Domain (e.g. yaoniplan.eu.org) - Type (e.g. HTTP) - URL (e.g. localhost:5230)
- Use R2 (Need PayPal and debit card)
- Notes
vim worker.js
addEventListener( "fetch",event => { let url=new URL(event.request.url); url.hostname="server.tail471ed.ts.net"; // Replace it with the website you want to proxy url.protocol='https'; // If the protocol is http, please change it to http let request=new Request(url,event.request); event. respondWith( fetch(request) ) } )
- Because to add subdomain in Cloudflare.
- References
The abbreviation of "disc jockey" is "DJ".
- A person
- Play recorded music
- For an audience
- A person
- Notes
- Driving not the car but the music.
- Because to help my brother download car music.
- References
Use "udiskie"
udiskie &
# Remember to run in the background as a daemon
- Notes
- Because to mount a hard disk (or USB) automatically.
- My brother needs temporary access to my computer to download some resources to his USB drive.
- Mount a hard disk without root permission manually
udisksctl mount --block-device /dev/sdd1
# Mount (Replacemount
withunmount
to unmount)- Use
lsblk
command to get/dev/sdd1
block device cd /run/media/$(whoami)
# Your USB directory
nix profile install nixpkgs#udiskie
# Install dependencies
- Because to mount a hard disk (or USB) automatically.
- References
Check if Wayland is enabled in Firefox
about:support
#/protocol
- References
about:about
Enable Wayland in Chromium
about:flags
- Search "Preferred Ozone platform"
- Set it to "Wayland"
- Restart the browser
- Notes
- I will search "wayland". (Faster)
- References
Use "make"
vim ~/.config/note/Makefile
# Simplify the process.PHONY: build up build: docker-compose build up: docker-compose up --detach
make build
# Execute commanddocker-compose build
make up
# Execute commanddocker-command up --detach
doas make install
# Install a packagedoas make uninstall
# Uninstall a package
- Notes
git clone https://github.com/hyprwm/contrib; cd contrib/grimblast/; doas make install
# Install the scriptnix profile install nixpkgs#hyprpicker
# Install dependencies (e.g. grim, slurp, hyprctl, hyprpicker, wl-copy, jq, notify-send)grimblast check
# Check if required tools are installedgrimblast copysave area $HOME/$(date +%F_%H-%M.png)
- References
Use "wf-recorder"
wf-recorder -f out.gif --codec=gif
# Record a GIF
- Notes
-f
# File name- Disadvantages: Large file, low quality
- References
- https://github.com/ammen99/wf-recorder/issues/79#issue-591769918
man wf-recorder
#/-f
Use "wlsunset"
wlsunset -l 28.2 -L 116.6
- Remember to run it in the background as a daemon at boot time
- Notes
-l
# Latitude-L
# Longitude- https://www.google.com/maps?q=Dongxiang+Fuzhou+Jiangxi+China
Dongxiang+Fuzhou+Jiangxi+China
# Replace it with your location- Right-click the geographical location on the map
- Click on the pop-up latitude and longitude to copy it
nix profile install nixpkgs#wlsunset
# Install dependencies- Because it has a timing feature. (Work at sunrise and rest at sunset)
- References
Use "grim"
grim -g "$(slurp)" $HOME/$(date +%F_%H-%M.png)
# Select a region and screenshot it-g
# Geometry$HOME/$(date +%F_%H-%M.png)
# File name
grim -g "$(slurp)" - | wl-copy
# Take a area screenshot and copy to clipboard-
# Send screenshot to stdouttee /mnt/grow/image/"$(date +%F-%H%M%S).png" |
# Specify a file name (Add it before thewl-copy
)
- Notes
- Use "grimblast"
grimblast copysave area $HOME/$(date +%F_%H-%M.png)
grimblast check
# Check if required tools are installednix profile install nixpkgs#grimblast
# Install dependencies
nix profile install nixpkgs#grim nixpkgs#slurp
# Install dependencies- Because to share screenshots with others in the open source world.
- Use "grimblast"
- References
Use "mako"
notify-send "Hello, $(whoami)!" "This is an example notification."
mako
# Remenber to run in the background as a daemon at boot time
vim ~/.config/mako/config
sort=-time layer=overlay background-color=#2e34407f width=450 height=150 border-size=3 border-color=#99c0d0 # Rounded corners border-radius=12 icons=0 max-icon-size=64 default-timeout=5000 ignore-timeout=0 font="Noto Sans CJK SC" 14 margin=12 padding=12,20 [urgency=low] border-color=#cccccc [urgency=normal] border-color=#99c0d0 [urgency=critical] border-color=#bf616a default-timeout=0
7f
# Alpha channel (transparent)Noto Sans CJK SC
# Changet font name with yoursmakoctl reload
# Reload configuration file to make changes effective
- Notes
- Use "makoctl"
makoctl dismiss
# Dismiss a notificationmakoctl restore
# Restore the previous notification
- Because to use the fastest notification daemon on Wayland.
nix profile install nixpkgs#mako
# Install dependencies- Solve the problem
yaoniplan@tux ~ $ mako Failed to acquire service name: File exists Is a notification daemon already running? yaoniplan@tux ~ $
- Check for running notification daemons (e.g. xfce4-notifyd, gnome-shell)
pgrep dunst # Check for Dunst
- Stop existing daemons (e.g. xfce4-notifyd, gnome-shell)
pkill dunst # Stop Dunst
- Check for running notification daemons (e.g. xfce4-notifyd, gnome-shell)
- Solve the problem
yaoniplan@tux ~ $ notify-send -bash: notify-send: command not found yaoniplan@tux ~ $
nix profile install nixpkgs#libnotify
# Thenotify-send
command is part of thelibnotify
package
- Use "makoctl"
- References
- https://cascade.moe/posts/hyprland-configure/#mako
man 5 mako
#/COLORS
- ChatGPT
Use "gammastep"
gammastep -O 1500 &
# One-shot
- Notes
- Because to set color temperature in Wayland.
nix profile install nixpkgs#gammastep
# Install dependencies
- References
Use "swhkd"
pkexec swhkd --debug --config ~/.config/hypr/swhkdrc
- Notes
swhks &
# Run it before using the above commandyay --sync swhkd-bin
# Install dependencies
- References
Use "w3m"
w3m ~/note/index.html
- Notes
unzip -p file.epub "*.h*" | w3m -T text/html
# View epub file (Does not support loading images)B
# Close current buffer (The same asAlt-Left
in Chromium)T
# New tab in the current link}
# Next tab
Ctrl-h
# History page/search
# SearchCtrl-j
# Follow link (The same asEnter
)
- Scroll page (Vim-like)
Space
# Next pageb
# Previous pagej / Ctrl-n
# Next line
- Other tools
lynx ~/note/index.html
nix profile install nixpgks#w3m
# Install dependencies (e.g.lynx
)- Because to check notes quickly. (Like "links")
- References
- https://libreddit.kavin.rocks/r/commandline/comments/b40tt6/made_a_cli_epub_reader/ #
/w3m
H
# Help- ChatGPT
- https://libreddit.kavin.rocks/r/commandline/comments/b40tt6/made_a_cli_epub_reader/ #
Write a function in Vim
vim ~/.vimrc
" Insert code block function! InsertCodeBlock() " Check if the current line has a four-space indent if indent('.') == 4 " Append text below the current line call append(line('.'), [' ```', ' ', ' ```']) " Move cursor down twice execute "normal! 2j" " Enter insert mode at the end of line (Like 'A' key) startinsert! else call append(line('.'), [' ```', ' ', ' ```']) execute "normal! 2j" startinsert! endif endfunction command! InsertCodeBlock :call InsertCodeBlock()
- Notes
:InsertCodeBlock
# Use the command to call the function- Because to use markdown to write some reusable documents.
- References
- Add a demo.gif here
- ChatGPT
Use "tofi"
tofi-run "$@" | ${SHELL:-"/bin/sh"}
tofi-run | sh
# It's ok.
- Notes
- Advantages: Sort by frequency of use.
- Disadvantages
- No support for custom keybindings.
- https://github.com/philj56/tofi/issues/101#issue-1702785890
- It has no completion feature.
"$@"
# All arguments${SHELL}
# The value of the SHELL environment variable:-
# Specify a default value if the variable is not set"/bin/sh"
# A specified value- Use default shell (if
echo $SHELL
is not empty) or /bin/sh
vim ~/.config/tofi/config
# Show a text cursor in the input field text-cursor = true text-cursor-style = block # Transparency (#RRGGBBAA) background-color = #00000000 # Accept arguments require-match = false # Set fonts font = /usr/share/fonts/TTF/FiraCode-Regular.ttf
fc-list | grep -i fira
# Get font file path
- Support hotkey
Ctrl-n/p
# Next or previous (Ctrl-j/k
is OK)Ctrl-w
# Clear a wordCtrl-u
# Clear a lineCtrl-c
# Close Tofi
nix profile install nixpkgs#tofi
# Install dependencies- Because to execute scripts quickly. (Like "dmenu")
- References
Display unicode characters
doas pacman --sync noto-fonts-cjk
- Notes
doas pacman --sync noto-fonts-emoji
# Display emoji- Because to try other Chinese fonts after trying 'wqy-microhei'.
- References
Use "foot"
foot -e tmux
- Notes
- Enable daemon mode
foot --server
# Remember to run in the background as a daemonfootclient
# New the terminal
- Hotkeys
Shift-pageUp
# Scroll page up (Opposite:Shift-pageDown
)Ctrl-Shift-r
# SearchCtrl-s
# Search for the next match (Opposite:Ctrl-r
)Ctrl-Shift-w
# Extend current selectionCtrl-Shift-c
# Copy selected text to clipboardCtrl-Shift-n
# New a terminal
- Use "fira code"
doas pacman --sync ttf-fira-code
# Install dependenciesvim ~/.config/foot/foot.ini
font=Fira Code:size=12 [colors] alpha=0.8 # transparency
- Restart Foot to make changes effective
-e
# Execute- Solve the problem
warning: 'C' is not a UTF-8 locale, using 'C.UTF-8' instead
LC_ALL=C.UTF-8 foot
# Temporarily
nix profile install nixpkgs#foot
# Install dependencies- Because to try the fastest responsive terminal in Wayland.
- https://github.com/dabisu/sakura
- https://github.com/ii8/havoc/issues/53 # Without CJK fonts support by default
- Enable daemon mode
- References
- https://old.reddit.com/r/swaywm/comments/kdtxik/dnklfoot_terminal_a_small_shoutout/gg3a274/
- https://codeberg.org/dnkl/foot/issues/1067#issuecomment-452654 #
/daemon
man foot.ini
man foot
#/-e
- ChatGPT
Use "wayst"
wayst -e tmux
--app-id wayst1
# Set window class for rule matching--title fzf
# Set window title when switching windows
- Hotkey
Ctrl-Shift-d
# New a terminalCtrl-d
# Close a terminalCtrl-Shift-k
# Enter vi-like keyboard select modeCtrl-Shift-c
# Copy after selecting text like viEsc
# Quit select mode
- Notes
vim ~/.config/wayst/config
font = [ "Fira Code", "Noto Sans CJK SC" # Support Chinese characters ] font-size = 12
-e
# Executeyay --sync wayst-git
# Install dependencies- Because to try the fastest responsive terminal in Wayland.
- References
Get the name of the terminal emulator
echo $TERM
- Notes
tmux display-message -p "#{client_termname}"
# If use tmux-p
# Print the output to stdout
- References
man tmux
#/display-message
- ChatGPT
Check if the display server protocol is Wayland
if [[ "$XDG_SESSION_TYPE" = "wayland" ]]; then
- Notes
- Because to use Wayland.
- References
- ChatGPT
Use "wl-clipboard"
wl-copy
# Copy to clipboardwl-paste
# Paste text from clipboard
- Notes
- Examples
wl-copy < /mnt/grow/image/2024-06-23-100503.png
# Copy file to clipboardwl-paste --type image/png | imv -
# View an image from clipboardecho "$(which mako)" | wl-copy
# Copy file path to clipboard
- Because to use Wayland.
doas pacman --sync wl-clipboard
# Install dependencies
- Examples
- References
- ChatGPT
Use "hyprland"
Super-rightClick
# Adjust window sizeSuper-click
# Drag windowSuper-q
# New a terminalSuper-c
# Kill a windowSuper-arrowKey
# Move focusSuper-s
# Show or hide scratchpadSuper-Shift-s
# Move a window into scratchpad
Super-numberKey
# Enter workspace 1 (e.g. 2, 3, ..., etc.)Super-Shift-numberKey
# Move a window into workspace
Super-m
# Exit Hyprland
- Notes
vim ~/.config/hypr/hyprland.conf
# Enable as needed# Switch between windows in a floating workspace bind = ALT, Tab, exec, hyprctl dispatch cyclenext && hyprctl dispatch bringactivetotop # Combine two commands into one line bind = $mainMod, C, exec, hyprctl dispatch resizeactive exact 48% 95% && hyprctl dispatch centerwindow # Make window 50% of screen width bind = $mainMod, C, resizeactive, exact 48% 95% # Make window centered bind = $mainMod, C, centerwindow # Assign a window to a workspace (Silent: `workspace 1 silent`) windowrulev2 = workspace 1, class:^(firefox)$ # Set size for floating windows (Make sure the window is floating and not full screen by default) windowrulev2 = size 1000 600, class:^(firefox)$, title:^(Save As)$ # Enable fullscreen for a window by default windowrulev2 = fullscreen, class:^(wayst1)$ # Execute script at boot time exec-once = ~/.local/bin/runAtBootTime.sh # Enable scratchpad # silently launch wayst in special workspace exec-once = [workspace special silent] wayst -e tmux new-session 'vim -c "VimwikiMakeDiaryNote"' animations { # define special workspace animation animation = specialWorkspace, 1, 4, default, slidevert } bind = $mainMod, Space, togglespecialworkspace bind = $mainMod SHIFT, Space, movetoworkspace, special # Disable animation (Avoid including them in the picture when taking screenshots) # `hyprctl layers`: Get namespace (e.g. launcher, wofi) # For workspace to replace `1` with `0` (Avoid making it take longer for your eyes to adpat) layerrule = noanim, wofi animation = specialWorkspace, 0, 4, default # Disable blur windowrulev2 = opacity 0 0,class:^(waybar)$ # Move windows like Vi mode bind = $mainMod SHIFT, H, movewindow, l bind = $mainMod SHIFT, L, movewindow, r bind = $mainMod SHIFT, K, movewindow, u bind = $mainMod SHIFT, J, movewindow, d # Execute apps at launch exec-once = mako exec-once = wlsunset -l 28.2 -L 116.6 # Bind `Alt-Enter` key to new a terminal bind = Alt, Return, exec, foot -e tmux # Bind `Super-f` key to toggle full screen bind = $mainMod, F, fullscreen, 0 # Bind `Super-l` key to lock screen bind = $mainMod, L, exec, swaylock --color 000000; hyprctl dispatch dpms off misc { mouse_move_enables_dpms = false key_press_enables_dpms = true # Exit Hyprland to take effect (If need to turn off the text at the bottom of the screen) disable_splash_rendering = true }
- Because to experience the animation special effects on Wayland.
- References
- https://github.com/hyprwm/Hyprland/issues/3566#issuecomment-1858861625 #
/size
- https://libreddit.nohost.network/r/hyprland/comments/165pra4/active_window_on_top/jyg2p0x
- https://libreddit.nohost.network/r/hyprland/comments/18won1q/center_single_window_on_master_layout_and_prevent/kg0dvq9 #
/centerwindow
- https://github.com/hyprwm/Hyprland/issues/2948#issuecomment-2283235966 #
/resizeactive
- https://libreddit.nohost.network/r/hyprland/comments/1c31ufa/how_to_remove_this_line_at_bottom/kzdpbkt
- https://wiki.hyprland.org/Configuring/Window-Rules/
- https://libreddit.baczek.me/r/hyprland/comments/18o5d18/open_window_on_initial_workspace_opened_rather/
- https://red.artemislena.eu/r/hyprland/comments/15xlykt/disabling_workspace_animations/
- https://libreddit.oxymagnesium.com/r/hyprland/comments/1ars1q7/a_drop_down_terminal_quakelike/kqm2i7i/
- https://libreddit.kavin.rocks/r/hyprland/comments/11jjpn8/animation_for_specific_window/ # Disable animation
- https://libreddit.nohost.network/r/hyprland/comments/10q5t3e/no_blur_on_hyprland/ # Disable blur
- https://github.com/hyprwm/Hyprland/issues/1337#issuecomment-1374832211
- https://old.reddit.com/r/hyprland/comments/118z40c/bind_the_enter_key_in_hyprland/j9m0r04/
- https://github.com/hyprwm/Hyprland/discussions/830#discussioncomment-3868467 # Switch app
- https://old.reddit.com/r/hyprland/comments/11c2lie/how_to_moveresize_windows_with_only_the_keyboard/jak96fw/
- https://github.com/hyprwm/Hyprland/commit/2e3f0d5991874edb01f1bfe4ffc75701f8b398dc # Anime mascot wallpaper
- https://old.reddit.com/r/hyprland/comments/xwit2h/drag_window/ir6rm9j/
- https://old.reddit.com/r/hyprland/comments/14u9p3v/turning_off_screens_after_locking_them/jrf09np/
- https://old.reddit.com/r/hyprland/comments/y92mo2/how_do_i_make_a_fullscreen_toggle_bind/k0tg5o1/
- https://github.com/hyprwm/Hyprland/issues/3566#issuecomment-1858861625 #
Use "fzf"
fzf
- Notes
Ctrl-j/k
# Next/previous selection (Same asCtrl-n/p
)Ctrl-m
# Enter key--reverse
# Put the search bar in the top of screenvi ~/.bashrc
# BindCtrl-j
key toEnter
key (Like Bash)export FZF_DEFAULT_OPTS="--bind=ctrl-j:accept"
source ~/.bashrc
# Make changes effective
- Because "ani-cli" depends on 'fzf'.
- References
Use "mov-cli"
mov-cli
- Notes
- Because to watch a foreign movie.
pipx install mov-cli
# Install dependencies
- References
Make a contribution in GitHub
- Push a request (Contributor)
- Fork a repository
- Edit a file in the forks (Optional: Choose a development branch)
- Create Pull requests
- Pull a request (Owner)
cd ~/note/; git checkout -b lingyiba-development development
# Switch to a new branchgit pull https://github.com/lingyiba/note.git development
# Test the changesgit checkout development
# Return to the branch before switchinggit push origin development
# Push to remote
- Push a request (Contributor)
- Notes
- Because to experience the power of the open source world.
- References
- https://github.com/aermin/blog/issues/50#issue-347703624
- https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
- https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request
Use "aria2c"
touch ~/.config/aria2c/aria2.session
vim ~/.config/aria2c/aria2.conf
dir = /home/yaoniplan/.config/aria2c enable-rpc = true rpc-allow-origin-all = true rpc-listen-all = true continue = true input-file = /home/yaoniplan/.config/aria2c/aria2.session save-session = /home/yaoniplan/.config/aria2c/aria2.session max-concurrent-downloads = 5
aria2c --conf-path ~/.config/aria2c/aria2.conf
- Notes
- Optional
rpc-listen-port = 47819
# Change default 6800 portrpc-secret = 4jJOSa9ePitWJV1G5dRAweJLv53bd7N/TzK71L1u8o8=
# Change default empty password (Useopenssl rand -base64 32
command to generate RPC secret)
nix profile install nixpkgs#aria2
# Install dependencies
- Optional
- References
- https://xnth97.github.io/2017/10/25/raspberry-pi/#安装-aria2
man aria2c
#/rpc options
- ChatGPT
Add zero padding to file name
for n in {1..9}; do old="Python3($n).flv"; new="Python3(0$n).flv"; mv "$old" "$new"; done
- Notes
- Because sometimes the tenth file doesn't get sorted correctly.
- Another method
for f in *; do mv "$f" "$(echo "$f" | sed -E 's/\(([0-9])\)/\(0\1\)/')"; done
-E
# Regular expression\(
# Escape it and match(
(The same as\)
)()
# A capture group[]
# Character set0-9
# Match any digit from 0 to 9\1
# A backreference to the first captured group
- References
Use "ipython"
ipython
- Hotkey
Ctrl-p
# Complete a sentence
- Notes
vi ~/.ipython/profile_default/ipython_config.py
# Enable vi modec.TerminalInteractiveShell.editing_mode = 'vi' c.TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode = False
pipx install ipython
# Install dependencies
- References
Use "termux"
- Connect to your server
pkg upgrade && pkg install openssh # Upgrade and install dependencies ssh yaoniplan@192.168.10.100 # Connect to your server
- Connect to your server
- References
- https://www.sqlsec.com/2018/05/termux.html
- https://github.com/termux/termux-app#GitHub
- https://github.com/termux/termux-app/actions/workflows/debug_build.yml?query=branch%3Amaster+event%3Apush
- Click a latest workflow run results
- Search string android-5-github-debug_universal and then click it
Monitor network traffic
nload -u M -U G enp2s0
-u M
# Unit in Megabytes-U G
# Unit of the total amount of data in Gigabytesenp2s0
# Use commandip address
to get device name
- Notes
- Use "btm"
f
# Freezee
# Expand a widget?
# HelpShift-h/j/k/l
# Move focusj/k
# Move optionsCtrl-d/u
# Scroll down/up a half/
# SearchCtrl-[
# The same asEsc
dd
# Delete a process
- Other methods
btop
# Use shortcut keyCtrl-minus
to adjust terminal sizecat /proc/net/dev | grep enp2s0
ip -human-readable -statistics link show enp2s0
bmon
doas iftop
vnstat -l
nix shell nixpkgs#nload
# Install dependencies- Replace
nload
with other dependencies (e.g.bottom
,vnstat
,iftop
,bmon
,btop
, etc.)
- Replace
- Use "btm"
- References
Use "yt-dlp"
yt-dlp "yourPlaylistURL"
- Notes
yt-dlp --flat-playlist --default-search ytsearch20 "linux tutorial" -O "#EXTINF:%(duration_string)s,%(title)s" -O "%(webpage_url)s" -O "" | awk 'BEGIN { print "#EXTM3U\n" } { print $0 }' >> playlistOne.m3u
# Write to a M3U fileyt-dlp --skip-download --ignore-errors --print-to-file url playlist.txt "yourPlaylistUrl"
# Extract playlist URL to fileyt-dlp "yourPlaylistUrl" --flat-playlist --dump-json | jq -r .url >> ~/playlist.txt
# Another way
yt-dlp --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=ie-TS-BitnQ
# Download the audio file in MP3 formatyt-dlp --extract-audio --audio-format mp3 --batch-file aolaStar.txt
# Batch download
yt-dlp --skip-download --write-subs yourURL
# download subtitles only--max-downloads 1
# Download the latest one--yes-playlist
# Download the playlist--output
# Output filename template (e.g."%(title)s.%(ext)s"
)/mnt/grow/temporary/
# If full path is required"%(playlist)s/
# A folder%(playlist_index)s
# A sequence%(title)s
# A file name.%(ext)s"
# A file extension
"
# Enclose in quotes if URL contains special characters (e.g.&
)nix shell nixpkgs#yt-dlp
# Install dependencies
- References
Use "anki"
d
# Decks/
# SearchSpace
# Next step and card4
# Easyu
# Undo
y
# Syncb
# Browsedeck:自然拼读 is:learn
# Filter cards (e.g. learning) in deck (e.g. 自然拼读)
- Notes
- Import apkg packages in batches for testing purposes
for f in ~/Downloads/deck/*.apkg; do curl localhost:8765 --request POST --data '{ "action": "importPackage", "version": 6, "params": { "path": "'$f'" } }' done
~/Downloads/deck/*.apkg
# Your apkg packages path'$f'
# Enclose in single quotes to make variable effective- Remember that full path and filename cannot contain spaces
- Solve the problem by importing media files in batches
Error playing audio. This can be caused by a corrupt file, a file iOS does not support (eg .ogg), or an mp3 file incorrectly named .wav hair1.wav: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)"
- Get media file directory path
curl localhost:8765 --request POST --data \ '{ "action": "getMediaDirPath", "version": 6 }'
cp -r ~/testWAV/*.mp3 ~/.local/share/Anki2/User\ 1/collection.media/
- Use 'Find and Replace' to replace wav with mp3
- Install an addon named 'AnkiConnect' before running command
- Get media file directory path
- Sync server
python -m venv ~/.config/anki/ # Create a virtual environment using the built-in `venv` module ~/.config/anki/bin/pip install anki # Install anki.syncserver in the virtual environment MAX_SYNC_PAYLOAD_MEGS=1000; SYNC_USER1=admin:****** ~/.config/anki/bin/python -m anki.syncserver
SYNC_USER1=admin:*** SYNC_USER2=user:***
# Multiple users- Client (e.g. Linux, Android, iOS, etc.)
http://192.168.10.100:8080/ # In 'Self-hosted sync server' of 'Syncing' admin # In 'user' of 'Synchronize' ****** # In 'password' of 'Synchronize'
crontab -e
@reboot MAX_SYNC_PAYLOAD_MEGS=500; SYNC_USER1=admin:****** ~/.config/anki/bin/python -m anki.syncserver
- Click the sync button to sync the progress before and after learning
nix profile install nixpkgs#anki
# Install dependencies
- Import apkg packages in batches for testing purposes
- References
Understand "active learning"
- Group discussion
- Practice by doing
- Teach others
- Notes
- Propose a hypothesis (To test it)
- Find relevant circles
- References
Use "pipx"
pipx install animdl
- Notes
pipx upgrade mov-cli
# Upgradepipx list
# List installed packagespipx uninstall animdl
# Uninstallnix profile install nixpkgs#pipx
# Install dependencies
- References
pipx --help
Use "ani-cli"
ani-cli Terror in Resonance
- Notes
--range "3 - 4"
# Specify range (Without clicking next manually)cat ~/.local/state/ani-cli/ani-hsts
# View historytac ~/.local/state/ani-cli/ani-hsts | less
# Another way
- Issues: Can't add a source (Cause: Watermark, not many sources, etc.)
Terror in Resonance
# Replace it with your desired animation nameyay --sync ani-cli
# Install the dependencies
- References
The abbreviation of "All Clear" is "AC".
- In a calculator
- Notes
- Because we saw it in an electronic calculator.
- References
- ChatGPT
The abbreviation of "American Sign Language" is "ASL".
- For the deaf
- Notes
- Because we saw it at the Worldwide Developers Conference.
- References
Use "smb"
doas vi /etc/samba/smb.conf
[yaoniplan] path = /mnt/grow writable = yes browsable = yes public = no valid users = yaoniplan, root
doas smbpasswd -a yaoniplan
# Set SMB password for your userdoas systemctl restart smb
# Restart to take effect
- Notes
- Warning: The speed is slower than WebDAV. (Sometimes freeze)
testparm
# Check for syntactic errors/mnt
# Replace it with a directory you want to sharedoas pacman --sync samba
# Install dependencies- Because it needs to be used on devices or software that does not support WebDAV.
- References
Use "node"
node main.js
- Notes
nix shell nixpkgs#nodejs
# Install denpendencies- Because we need to see the output of the file.
- References
vim main.js
const notes = ['do', 're', 'me']; notes.forEach((note) => console.log(note));
- https://dev.to/i3uckwheat/understanding-callbacks-2o9e
- https://www.theodinproject.com/lessons/nodejs-introduction-what-is-nodejs
- ChatGPT
Add UTF-8 encoding support to HTML file
vi ~/note/index.html
... <html> <head> <meta charset="UTF-8"> ... </head> ...
- Notes
- Because to display Chinese characters properly in HTML file for Docker image
- References
- ChatGPT
Use "ish"
- Start an HTTP server
git clone git@192.168.10.100:/var/git/note.git
# Download a directory containing index.htmlpython3 -m http.server -d ~/note/ 2003
# Use module to serve directory listening on portlocalhost:2003
# Run in Safari
mount -t ios . /mnt
# Mount a local folder and thenls /mnt
umount /mnt
# Unmount it
- Clipboard
cat /dev/clipboard
# https://github.com/ish-app/ish/issues/192#issuecomment-717605379echo foo > /dev/clipboard
# https://github.com/ish-app/ish/issues/192#issuecomment-717605036
df -h
# Check disk freeid
# Check current user (Likewhoami
)- Connect to your server
apk add openssh # Install dependencies ssh-keygen && ssh yaoniplan@192.168.10.100 # Generate authentication keys for ssh and then connect ssh-copy-id yaoniplan@192.168.10.100 # Connect to a remote machine without password
vi ~/.profile
# Execute automatically after opening iSHssh yaoniplan@192.168.10.100
- Start an HTTP server
- Notes
- Warning: No Siri Shortcuts integration.
- Terminate SSH connection
Ctrl-b d
# Detach the current session if using tmuxlogout
# Exit the login shell
vi /etc/apk/repositories
# Set mirrorhttps://mirrors.ustc.edu.cn/alpine/latest-stable/main https://mirrors.ustc.edu.cn/alpine/latest-stable/community
apk update
# Update repository indexes to take effect
apk update && apk upgrade
# Run before installing packages (Make sure free access to the internet)
- References
Rename file in batches
for file in *.m4a; do mv "$file" "$(echo "$file" | sed -E 's/\[[0-9]+\]//g')"; done
- Notes
-E
# Extended regular expressions[0-9]
# Any single digit from 0 to 9+
# One or more times
- References
yt-dlp --output "%(title)s.%(ext)s" https://www.ximalaya.com/album/31923706
man sed
#/-E
- ChatGPT
Use "watchtower"
- Because to update Docker containers automatically
- Notes
vi ~/.config/watchtower/docker-compose.yml
version: '3' services: watchtower: image: containrrr/watchtower container_name: watchtower restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock - /etc/localtime:/etc/localtime:ro command: --interval 3600
/etc/localtime:/etc/localtime
# Synchonize the time zone (Between host and Docker container)ro
# Read-only3600
# Replace it with your desired seconds
- References
Add an icon to a website
vi ~/note/index.html
<!DOCTYPE html> <html> <head> <link rel="icon" href="../assets/favicon.png" type="image/png"> ... <head> ...
- Notes
../assets/favicon.png
# Replace it with path to your favicon file
- References
- ChatGPT
The abbreviation of "music video" is "MV".
- Marketing
- Notes
- Most pop music has MVs.
- References
Use "tailscale"
doas tailscale up --accept-dns=false --advertise-routes=192.168.10.0/24
- https://login.tailscale.com/admin/machines # Open in web browser
- Click on '192.168.10.0/24' of 'Subnet routes' in 'Edit route settings of server'
- Click on 'Disable key expiry' to extend time
tailscale login
# Other users who want to join this LAN- 'Sign in' - 'Alternatively, use a QR code' - 'Connect' # Another method
- Notes
--advertise-exit-node
# Enable Exit Nodedoas tailscale file cp ~/.config/clash/config.yaml android:
# Send a file to another devicedoas tailscale set --accept-dns=false
# Disable MagicDNS if don't want Tailscale to overwrite file /etc/resolve.confdoas pacman --sync tailscale
# Install the dependenciesdoas systemctl enable --now tailscaled
# Enable daemon now and at boot- Install this app for each device (e.g. Linux, Android, iPhone, etc.) you want to connect
- Use Funnel (Not recommended: slow)
tailscale cert tailscale cert server.tail471ed.ts.net doas tailscale serve --bg 2004 doas tailscale funnel --bg 2004
- https://login.tailscale.com/admin/dns # Enable 'HTTPS Certificates' before running the above code
doas tailscale funnel --https=443 off
# Disable Funnel
- References
Become a "real rich man"
- Meditate "I am a real rich man" in your heart
- Notes
- Treat all people and things with the standard
- References
- ``
Understand "Three Laws of Robotics"
- Not injure humanity
- Not injure a human being
- Obey the orders
- Protect itself
- References
The abbreviation of "Wireless Fidelity" is "Wi-Fi".
- A family
- wireless netwrok protocals
- A family
- Notes
- The abbreviation of "Wireless local area network" is "WLAN".
- References
Use Debian Linux in Docker
apt install curl --yes
# Install a packageapt update
# Update it before Installinginstall
# Replace it withautoremove
to return to previous state
- Notes
- Set a mirror if on China
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's/http/https/g' /etc/apt/sources.list
vi ~/.config/debian/docker-compose.yml
version: '3' services: debian: image: debian restart: always tty: true stdin_open: true volumes: - ./data:/data # Add any volumes you want to mount
docker-compose up --detach
# Run in the background
- Set a mirror if on China
- References
man apt
#/autoremove
- https://mirrors.ustc.edu.cn/help/debian.html
- ChatGPT
The abbreviation of "mi" is "mile".
- An unit of distance
- 1.61 kilometers (1 mile)
- Notes
- Because saw it in the map software.
- References
Use "uxplay"
uxplay
- Notes
- Warnning: Slow response, high latency, in the same local area network
nix-shell --packages uxplay
# Install dependencies temporarily- Solve a problem that doesn't detect UxPlay server
doas avahi-daemon
# Run in the backgrounduxplay
# Run
- References
Acquire skills of taking a photo
- Highlight a focus
- Blur background (Press focus)
- Leading line
- Center of vision (Horizontally and vertically divided into thirds)
- By chiaroscuro
- Without focus are suitable for wallpaper
- Looking down or looking up
- Switch focal length
- Light (e.g. Direction, intensity, etc.)
- Light in front of focus (Positive light / flat light)
- Light on the side of focus (Three-dimensional effect, e.g. 45 degrees, 90 degrees, etc.)
- Light behind foucs (Silhouettes, Backlight)
- Element (e.g. point, line, surface, etc.)
- Highlight a focus
- Notes
- Because to share some records with family.
- References
The abbreviation of "high dynamic range" is "HDR".
- Because see it when taking a photo
- References
Understand "flowchart"
- An representation about algorithm
- A step-by-step approach to solving a task
- An representation about algorithm
- Notes
- Terminal (Start / End)
- Rounded rectangle
- Flowline
- Line
- Process
- Rectangle
- Decision
- Diamond
- Terminal (Start / End)
- References
Output chess board in C
vi ~/chessBoard.c
#include <stdio.h> int main() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if ((i + j) % 2 == 0) printf("██"); // Output white square else printf(" "); // Output black square with two spaces } printf("\n"); } return 0; }
- References
gcc ~/chessBoard.c && ./a.out
# Compile and run- https://archive.org/download/c-100_20230813
- ChatGPT
Use "gtts-cli"
gtts-cli "$(date +%F)" | mpg123 -
# Speech date
- Notes
nix profile install nixpkgs#python311Packages.gtts
# Install dependenciesgtts-cli -l en -o e.mp3 "hello test for ai" --debug
# Debug... Error: Failed to connect. Probable cause: Unknown ...
- References
Record screen to a GIF file with ffmpeg
ffmpeg -f x11grab -s 1366x768 -i :0 -t 10 -r 60 $(date +%F_%H-%M).gif
- Notes
- Warnning: The clarity quality is a bit low, Wayland is not supported
xdpyinfo | grep dimensions | awk '{print $2}'
# Get screen resolution
- References
- ChatGPT
Enable a HTTP server to share files temporarily
python -m http.server -d /mnt/grow/ 8080
- Notes
- Warning: This method is only suitable for small files.
/mnt/grow/
# Replace it with the directory you want to sharehttp://192.168.10.105:8080
# View it in local area networknix shell nixpkgs#python310Packages.httpserver
# Install dependencies temporarily
- References
Record screen in Linux
ffmpeg -f x11grab -video_size 1366x768 -framerate 60 -i :0.0 -c:v libx264 $(date +%F_%H-%M).mp4
- Notes
xdpyinfo | grep dimensions | awk '{print $2}'
# Get the resolution (e.g. 1366x768)60
# Replace it with your disired frame rate
- References
- ChatGPT
Output the multiplication table in C
vi multiplicationTable.c
#include <stdio.h> int main() { for(int i = 1; i < 10; i++) { for(int j = 1; j <= i; j++) { printf("%d*%d=%d\t", j, i, j*i); } printf("\n"); } return 0; }
- Notes
int
# Integerfor(int i = 1; i < 10; i++)
# Incrementing the value of "i" from 1 to 9for()
# For loopint i = 1
# Initialize the variable "i" with the value "1"i < 10
# Check the conditioni++
# Increment (e.g. i = i + 1)
%d
# Placeholder\t
# Tab character\n
# Newline character
- References
gcc multilicationTable.c && ./a.out
# Compile and run- https://archive.org/download/c-c-qq
- ChatGPT
Use "code"
code
- Notes
- Warning: It's an unfree software.
Ctrl-o
# Open a fileCtrl-n
# New a fileCtrl-Shift-p
# Prompt a command paletteCtrl-Shift-x
# ExtensionsCtrl-backtick
# Toggle a terminalCtrl-f
# FindCtrl-g
# Go to a specific lineCtrl-p
# Quick open a file by namenix shell nixpkgs#vscode
# Install dependencies temporarily
- References
- ChatGPT
Road signs in China
- Because it appears on the theory driving license test in China.
- Notes
- Tourist signs
- Brown
- Additional sings
- Below
- Indicative signs
- Blue without text
- Warrning signs
- Yellow
- Prohibitory signs
- Red
- Tourist signs
- References
The abbreviation of "megabyte" is "MB".
- A multiple of the unit byte for digital information
- One megabyte is one million bytes of information
- Notes
- Seen in eBook file sizes
- References
The abbreviation of "internet protocal" is "IP".
- IP address
- A numerical label (e.g. 192.168.10.100)
- IP address
- References
Use "ping"
ping -c 3 192.168.10.100
- Notes
-c
# Countping -6 yourIPV6Address
# Ping an IPV6 address
- References
man ping
Manage time
- How to live a day is how to live a life
- Habit
- Nap in the morning
- Break at noon
- Go to bed early to get up early
- Spend one percent of your time reflecting
- Use biological clock instead of alarm clock
- Notes
- Almost everyone knows that whether you can build a happy life and achieve success is related to how you use your time
- References
Some abbreviations about theory driving license test in China
- The abbreviation of "Global Positioning System" is "GPS".
- The abbreviation of "adaptive cruise control" is "ACC".
- The abbreviation of "electronic brakeforce distribution" is "EBD".
- The abbreviation of "lane departure warning" is "LDW".
- The abbreviation of "Autonomous Lane-changing Assistant" is "ALC".
- References
- https://en.wikipedia.org/wiki/Global_Positioning_System
- https://en.wikipedia.org/wiki/Adaptive_cruise_control
- https://en.wikipedia.org/wiki/Electronic_brakeforce_distribution
- https://en.wikipedia.org/wiki/Lane_departure_warning_system
- https://web.archive.org/web/20230802030249/http://www.liuwenhao.me/?p=4902
Understand "water temperature gauge"
H
# HotC
# Cold
- Notes
- Measure the temperature of the engine coolant
- References
Understand "feul gauge"
E
# EmptyF
# Full
- References
The abbreviation of "electronic toll collection" is "ETC".
- Collect toll from vehicles automatically
- Notes
- Because it appears on the theory driving license test in China.
- References
The abbreviation of "Electronic Stability Program" is "ESP".
- Improve a vehicle's stability
- Detect and reduce loss of traction
- Improve a vehicle's stability
- Notes
- Because it appears on the theory driving license test in China.
- References
The abbreviation of "anti-lock braking system" is "ABS".
- Anti-skid
- Notes
- Because it appears on the theory driving license test in China.
- References
The abbreviation of "Adaptive Front-Lighting System" is "AFS".
- Notes
- Because it appears on the theory driving license test in China.
- References
The abbreviation of "milliliter" is "ml".
- Greater than or equal to 80 milligrams per 100 milliliters
- Drunken driving in China
- Greater than or equal to 80 milligrams per 100 milliliters
- Notes
- Because it appears on the theory driving license test in China.
- References
The abbreviation of "forward collision warning" is "FCW".
- To prevent or reduce the severity of a collision
- Notes
- Because it appears on the theory driving license test in China.
- References
Use "ldd"
ldd $(which bash)
# List dependencies of bashlinux-vdso.so.1 (0x00007ffdaa7cb000) libreadline.so.8 => /usr/lib/libreadline.so.8 (0x00007f052eba4000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f052e9ba000) libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f052e943000) /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f052ed25000)
- References
Use "sct"
sct 1500
# Set color temperature to 1500 Kelvin
- Notes
- Warning: does not support Wayland
sct
# Reset to the default value (e.g. 6500K)nix profile install nixpkgs#sct
# Install dependencies- Because it is simpler than "redshift".
- References
man sct
- ChatGPT
Some tips in iPhone 14 Pro
- Maps
- Double-click the navigation icon in upper right corner (Combine compass)
- Automation
- The add icon (Automation) - Create Personal Autoamtion (Time of Day - Sunrise - Daily) - Start Timer (1 second)
- Shortcuts
- Open in Vim
# Receive Files input from # If there's no input: Ask For Files - Put File (Shortcut Input) - Disable 'Show When Run' - Text (Name.File Extension) - Execute Command (vim complete filename, exit) - Get file (complete filename) - Disable 'Show When Run' - Save File (File, Shortcuts, complete filename) - https://libreddit.nohost.network/r/shortcuts/comments/1cdhddj/open_in_vim_via_ashell_then_save_in_original/
- Get a JSON value
- Dictate Text - Text (your URL) - Get Contents of URL (Text) """ curl \ -H 'Content-Type: application/json' \ -d '{"contents":[{"parts":[{"text":"Explain how AI works"}]}]}' \ -X POST 'https://generativelanguage.googleapis.com/...' """ - Method (POST) - Headers (Content-Type, application/json) - Request Body (JSON) - Dictionary (contents) - Dictionary (parts) - Text (text, Dictated Text) - https://aistudio.google.com/app/apikey - https://zhile.io/2023/12/24/gemini-pro-proxy.html - Get Dictionary Value (Value, candidates.1.content.parts.1.text, Contents of URL) """ { "candidates": [ { "content": { "parts": [ { "text": "## AI: A Simplified Explanation ... """ - Speak Text (Dictionary Value) - https://libreddit.nohost.network/r/shortcuts/comments/11hbokj/parsing_json_help/jasqcgh
- Modify specific value
- File (iCloud Drive > Shortcust > departmentStore1) - Get File from Folder (File Extension, File) - Get Name (File) - Text (Name.File Extension) - Set Variable (Filename, Text) - Run Shortcuts (Search For Matching Rows) - Split Text (Shortcut Result, Custom, `,`) - Get Item from List (Item at Index, 1, Split Text) - Set Variable (Product barcode, Item from List) - Get Item from List (Item at Index, 2, Split Text) - Set Variable (Product name, Item from List) - Get Item from List (Item at Index, 3, Split Text) - Set Variable (Product price, Item from List) - Choose from Menu (Product barcode, Product name, Product price) - Ask for Input (Text, Product barcode, Product barcode) - Replace Text (`Product barcode, Product name, Product price`, `Provided Input, Product name, Product price`, File) - Save File (Updated Text, Shortcuts, Filename, Enable 'Overwrite If File Exists') - Quick Look (Saved File, Optional) - The remaining two options in the menu can be modified accordingly according to the steps of the first option - https://libreddit.nohost.network/r/shortcuts/comments/11b75to/is_there_a_way_to_replace_a_string_in_a_txt_not/j9x6pnz/
- Delete matching rows
- File (iCloud Drive > Shortcuts > departmentStore1) - Get Details of Files (Name, File) - Text (`Name`.`File Extension`) - Set Variable (File name, Text) - Ask for Input (Text, What do you want to search for?) - Match Text (`.*Provided Input.*`, File) - Choose from List (Matches) - Replace Text (`Choose Item `, File) - Paste the line break you copied after 'Chosen Item' (To prevent blank lines) - Save File (Updated Text, Shortcuts, File name, Enable 'Overwrite If File Exists') - https://libreddit.nohost.network/r/shortcuts/comments/10qbaug/cant_remove_a_line_break/j6rxf92/
- Search for matching rows
- Get File from Folder (Shortcuts, departmentStore1.csv) - Choose from Menu (Dictate, Scan, Type) - Dictate text (China Mainland) (Depend on product name you sell) - Run Shortcuts (Get Barcode) - Ask for Input - Match Text (`.*Dictated Text.*`, File) - Choose from List (Matches)
- Get unit price
- Run Shortcut (Get Barcode) - Set Variable (Product barcode, Shortcut Result) - Get File from Folder (Shortcuts, departmentStore1.csv) - `vi departmentStore1.csv` """ barcode,name,price 6901234567890,water,1 """ - Match Text (`Product barcode.*`, File) - `.` # Represent any single charater - `*` # The preceding character can appear zero or more times - Split Text (Matches, Custom, `,`) - Get Dictionary from Input (Item at Index, 3, Split Text) - Set Variable (Product price, Item from List) - Show Result (Product price, Optional) - https://utgd.net/article/9410
- Get barcode
- Scan QR or Barcode - Get Text from Input (QR/Barcode) - Copy to Clipboard (Text, Optional) - Show Result (Text, Optional) - https://www.youtube.com/watch?v=4Kemgg3FSjw
- Select JSON arrays
- Get Dictionary from Input (Contents of URL) - Replace Text (`clickReturn`, Dictionary) - Delete the line break to display it normally in the list - Choose from List (Updated Text)
- Display a notification for a few seconds
- Run Inline Script (Paste the following code, toggle off "Show When Run") """ let notification = new Notification(); notification.title = "English"; notification.body = "`Translated Text`"; notification.identifier = "my.music.notification"; notification.schedule(); Script.complete(); Notification.removeDelivered(["my.music.notification"]); Script.complete(); """ - https://libreddit.nohost.network/r/shortcuts/comments/16p7iwp/how_can_i_make_notifications_clear/k1p96sz
- Switch App Store region temporarily
- https://libreddit.nohost.network/r/shortcuts/comments/mpaivg/app_store_region_switcher/
- Dismiss Siri and Continue - Open URLs (
weixin://widget/pay
) # Open WeChat payment code, https://gist.github.com/JamesHopbourn/046bc341e7debfd0c86e3b388d983c53#%E5%BE%AE%E4%BF%A1 - URL (
data:text/html;charset=utf-8,<script>document.write(encodeURIComponent(JSON.stringify(Shortcut Input,null,2)))</script>
) - URL Encode (Decode, URL) # Beautify JSON format, https://libreddit.nohost.network/r/shortcuts/comments/gqq43h/dictionaryjson_pretty_print/ - Select Photos - Set Variable (Image, Photos) - Put File (Image) - Text (convert Image.File Extension -channel RGB -negate Output file name.png) - Execute Command (Text) - Get File (Output file name.png) # Invert image using a-Shell, https://libreddit.nohost.network/r/shortcuts/comments/1cdhddj/open_in_vim_via_ashell_then_save_in_original/l1fk0e2
- Text (comment) - If (Text, is, Comment) - Nothing # Comment some actions, https://libreddit.nohost.network/r/shortcuts/comments/prkg46/does_anybody_want_the_ability_to_comment_out/hdkig89
- Get a list of all file names from the API (JSON format)
- Get Dictionary from Input (Contents of URL) - Get Dictionary Value (Value, data.content, Dictionary) - Repeat with Each (Dictionary Value) - Text (Repeat Item (Type: Dictionary; Key: name)) - https://medium.com/@richardmoult75/parsing-json-api-lists-with-shortcuts-20df08aedf09
- Get Time Between Dates (Current Date, 00:00, Minutes) - Calculate (1440, +, Time Between Dates) - Show Result (Calculation Result) # How many minutes are left today?, https://libreddit.tux.pizza/r/shortcuts/comments/uh862o/trying_to_make_a_program_that_tells_me_how_many/i74iy1h/
- Convert Image (Shortcut Input, PNG) - Save to Photo Album (Converted Image, Recents) # Convert PDFs (Captured long screen) to PNGs, https://libreddit.tux.pizza/r/ios/comments/epz3wf/how_to_save_a_full_screen_screenshot_as_image_and/femykyb
- Get each line of a file before playing audiobook randomly
- Get File from Folder (VLC, audioBook.txt) - Split Text (File, New Lines) - Get Item from List (Random Item, Split Text) - https://libreddit.tux.pizza/r/shortcuts/comments/ma5b8z/last_line_of_file/
- Get Weather Forecast (Daily, Current Location) - Get Details of Weather Conditions (Sunrise Time, Weather Conditions) - Get Item from List (Item at Index, 2, Sunrise Time) - Create Alarm (Item from List, Get Up, Disable 'Show When Run') - Adjust Date (Subtract, 510, minutes, Item from List) - Create Alarm (Adjusted Date, Go To Bed, Disable 'Show When Run') # Adjust 8-hour sleep time based on sunrise time, https://old.reddit.com/r/shortcuts/comments/r7yezo/automation_8_hours_before_sunrise/hn42v2l/
- The add icon - Add Action - Get Network Details (Cellular, Radio Technology) - if (Network Details, Does not have any value) - ... # Get state of airplane mode to save battery while sleeping, https://snoo.habedieeh.re/r/shortcuts/comments/11cnaf7/comment/ja4tl51
- The add icon - Add Action - Adjust Date - Set Variable - ... # To play yesterday's CCTV News, https://libreddit.freedit.eu/r/shortcuts/comments/ioiigu/comment/g4e1snd
- Open URLs - vlc-x-callback://x-callback-url/stream?url=yourURL (Or
nplayer-http://192.168.10.100:5244/d/encodedFileName
) - done # https://stackoverflow.com/questions/32549439/stream-to-vlc-for-ios-via-url-scheme/68077812#68077812 - The add icon - Add Action - Dismiss Siri and Continue - Set Voice & Data (4G, Primary) - done # https://www.youtube.com/watch?v=8bw_QEaTBq8, https://libreddit.tux.pizza/r/shortcuts/comments/p9kppq/how_do_i_get_siri_to_not_say_ok_or_done_after/j4kq3pg
- The add icon - Add Action - Categories - Scripting - Set Personal Hotspot - done
- The add icon - Add Action - Set VPN (Set On Demand, On, Tailscale) - done
- Open in Vim
- Text
- Long press '123' and slide to comma # Enter punctuation marks quickly
- Long press the dollar sign # Select another country's currency unit symbol (e.g. ¥)
- Long press the double quotes or disable 'Smart Punctuation' # Choose the ASCII
- Long press space key # Move cursor quickly
- Double click / Long press # Select a word
- Triple click # Select a sentence
- Swipe left with three fingers # Undo
- Web
- Settings - Safari - Advanced - Website Data - Search a domain (e.g. 192.168.10.100) - Restart Safari # Clear a page cache for HTML page changes to take effect (Or new a private tab)
- Click on the top of screen # Go to the top of web
- Long press the scroll bar and drag to the bottom # Go to the bottom of web
- Image
- Press Volume up / down button # Take a photograph in Camera
- Press Volume Up button and power button together # Take a screenshot
- Full Page - Done - Save PDF to Files # Take a long screenshot
- Maps
- Notes
- Because to improve the efficiency of mobile phone use.
- Overseas Apple ID # To download software (e.g. ChatGPT, Google Translate, etc.)
- https://web.archive.org/web/20230727113153/https://support.token.im/hc/zh-cn/articles/360008124173-如何注册非中国大陆区-Apple-ID-%2C # Tutorial
- https://www.meiguodizhi.com/ # Get information about United States
- Download a proxy sofware (e.g. Shadowrocket)
- Get a Apple ID that has already purchased Shadowrocket
- Import subscriptions according to the tutorial
- https://github.com/wlxuf/Shadowrocket # Hide VPN icon and enable proxy logging
- https://m.youtube.com/watch?v=heG4YCMyg9w # Select a server automatically
- https://github.com/hiddify/Hiddify-Server/wiki/Tutorial-for-ShadowRocket-app # Some useful settings
- Advantages
- Telephone communication
- Map navigation
- Financial transaction
- Disadvantages
- Cannot set the automatic screen lock time to 30 seconds (Or Never) through parameters # Can only open the page (
prefs:root=DISPLAY&path=AUTOLOCK/30
) and then tap manually https://gist.github.com/deanlyoung/368e274945a6929e0ea77c4eca345560?permalink_comment_id=5082337#gistcomment-5082337 https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12264354082 - Mail app does not send real-time notifications # Can only open it manually and pull down to refresh https://libreddit.tux.pizza/r/iphone/comments/12o6w6f/mail_do_not_send_real_time_notifications_until/
- Can't add video (Except photo) to album
- No call recording
- Charging is slow in winter (Charged 37% in 76 minutes)
- There is no useful e-book reader (e.g. Moon+ Reader), web browser (e.g. Kiwi Browser), or web proxy tool (e.g. Clash)
- Heavier than Android # It is tired to hold with one hand, it is also heavy in my pocket
- WiFi receiving signal ability is weaker than Android
- Can not change the search engine when using Web Search by siri # Depends on the region where you purchased your iPhone https://discussions.apple.com/thread/251986932?answerId=253897800022#253897800022
- Do not support some commands (e.g. Play a music for 20 minutes) https://www.reddit.com/r/HomePod/comments/li89ag/hey_siri_play_x_for_y_minutes/
- Cannot set the automatic screen lock time to 30 seconds (Or Never) through parameters # Can only open the page (
- References
Act as a position interviewer in ChatGPT
I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the position position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. My first sentence is "Hi"I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the position position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. My first sentence is "Hi"
- Notes
- Because need to interview when looking for a job.
- References
Test driver's license in Dongxiang, Fuzhou City, Jiangxi Province, China
Sign up
# Bring identity card and pay the fees (2023-07-17)Subject one
# Take theory practice exams before booking (2023-08-21)Subject two
# Practice driving, examination room simulation, and two exam opportunities (2023-09-11)Subject three
# Practice driving, examination room simulation, and two exam opportunities (2023-10-16)Subject four
# Take theory practice exams (2023-11-14)
- Notes
- Bring ID card before the exam
- Pay after each exam appointment
- Because to prepare for posts that need a driver's license.
- References
Use "siri"
- Use FaceTime
Facetime my brother
# Make a video call to my brother (The contact using iPhone)
- Use Translate
Translate starting walking directions in Mandarin Chinese
- Use Phone
Call my brother
# (New contact - Add related name)Show my phone number
# Replacemy
withmy father's
(Replacephone number
withemail address
)
- Use Notes
Quick note
Take a note
Show notes about breakfast
# Search for string
- Use Maps
Go to the nearby library
# (e.g. Bank, Toilet, School, Government affairs service center)End navigation
- Use Clock
Set a timer for 7 minutes
# Boil a pot of waterStop the timer
# Stop itSet an alarm at fourteen
# Lunch break from 13:40Wake me up at five thirty
#Cancel 05:30
to cancelShow alarms
Delete all of them
- Use Reminders
Remind me to learn Reminders at 15:55 today
Read my reminders
# Read the upcoming schedule aloudRemind me about this tomorrow at 10 AM
# Title of email or website- Type a reminder in the app manually # Enable notifications
- https://libreddit.tux.pizza/r/iphone/comments/xs6cx1/iphone_14_pro_reminders_does_not_work/
- Use Calendar
Create a new event / Schedule purchase breakfast at 7 AM tomorrow
Learn Calendar
# Title itRight now
# One hour from nowChange it
Cancel Learn Calendar
# Cancel it
- Use Settings
What can you do
# Discover new commandsEnable light mode
# Replacelight
withdark
to toggleScan the QR code
# Open code scannerrepeat again
# Repeat replyWhat song is it
# Identify a song (Get song title or artist)Next song
# Play next music (Doesn't work:Previous song
)Restart this device
# Solve some bugsEnable Night Shift
# Protect eyesWhat date is it
# Replaceit
withtomorrow
(e.g. the day after tomorrow, the end of the month, sunrise)What time is it
#What time will it be in eight hours
(Current time plus eight hours)Open Translate
# Open the application (e.g. Email)Increase volume by 40 percent
Reduce the volume by 40 percent
Take a screenshot
Shutdown
# PoweroffYes
# ConfirmDisable Wi-Fi / Enable Cellular Data
# When need a more stable networkEnable Wi-Fi / Disable Cellular Data
# When need local area networkHow much is 1699 dollars in Chinese Yuan?
# Convert Dollars to Chinese Yuan (Exchange rate)What's 100 Euros in Dollars
What is the current time
# Get time when watching videoWhat is the current battery
# Get battery When watching videoEnable flashlight
# Light the way in dark environmentDisable flashlight
# Turn off it
- Use Calculator
8904 - 1367
- Eight thousand nine hundred and four minus one thousand three hundred sixty seven
- Eight nine zero four minus one three six seven
- Use Weather
What is the weather today
When is the sunrise
# Time to get up early
- Use Podcasts
Play podcasts about computer
# Prepare for posts that need English communicationStop podcasts
# StopContinue podcasts
# Continue
- Use Voice Memos
Record voice memo
# Record a conversation
- Use FaceTime
- Notes
- Activate siri
Hey Siri
# Method one- Long press the power button # Method two
- Increase precision
- Pronounce clearly
- Activate siri
- References
Match various phone number formats in Vim
/[0-9]\{11}/
# Match eleven consecutive digits (e.g. 12345678901)/[0-9]\{3} [0-9]\{4} [0-9]\{4}/
# (e.g. 123 4567 8901)
- Notes
/[0-9]\{11}/
# The same as/\d\{11}/
\d
# Digit
/[0-9]\{11}\|[0-9]\{3} [0-9]\{4} [0-9]\{4}/
# Match them together\|
# Or
- Because to contact with employers.
- In a large amount of recruitment information
- References
- ChatGPT
If A and B choose to read 2 kinds of books from 6 kinds of books respectively, then there is exactly one kind of books that the two people choose to read in common
- $(^{n}_{k})=\frac{n!}{k!(n-k)!}$ # Combination formula
- $0!=1$
- Notes
- $(^{n}_{k})$ # $C^{n} _{k}$
- $C$ # Combination
- If the set has $n$ elements, the number of $k$-combinations
- $n!=n\times(n-1)!$ # Factorial of $n$
- $(n-1)!$ # $(n-1)\times(n-2)\times(n-3)\times\cdots\times3\times2\times1$
- $C^{1}_{6}C^{1} _{5}C^{1} _{4}$
- $(^{n}_{k})$ # $C^{n} _{k}$
- References
- https://en.wikipedia.org/wiki/Factorial
- https://en.wikipedia.org/wiki/Combination
- College Entrance Math in Jiangxi
- ChatGPT
The abbreviation of "Subscriber Identity Module" is "SIM".
- An integrated circuit
- Notes
- Because to buy a mobile phone.
- References
Son of poverty (2023-07-03)
- Problems
- Money
- Family and relatives
- Problems
- Notes
- Because i can not be the poor.
- The end of my life is the richest person in this era.
- I always remind myself when i was the poor.
- References
- Rockefeller letters
I am looking for a job in Yiwu City, Jinhua City, Zhejiang Province, China. (2023-07-02)
Phone
# Contact with employerBank card
# Provide financial services
- Notes
- No summer job found for a high school student (2023-07-10)
- Around June 10
- Include food and lodging
- Academic qualifications of undergraduate (Home teacher)
- General labor is long-term
- Sexism
- Channels for obtaining recruitment information
- Offline (e.g. Local job market, on the door of the store, etc.)
- Online (e.g. Search in WeChat, Boss Zhipin, etc.)
- Some suggestions from a big brother in the dormitory
- Take the bus to the local job market # The price is cheaper than taking a taxi, but it takes more time than taking a taxi
- Laundry, shower and brush teeth # Before the roomates come back
- Charge the primary phone # Before sleeping
- Put away the umbrella that block the sun # After arriving at a location
- Pay the part-time job salary to the individual # Have a good relationship with college classmates and teachers
- Fall in lov # Low cast
- Be a soldier # Bonus and veterans certificate
- Communication skills and personal appearance
- Money and emotion
- Greet often to understand the world
- Make a schedule and stick it on the wall
- Learn to cook for them and for yourself
- Go to public places (e.g. library, shopping mall, etc.) to release stress
- Remember that children can do anything as long as they don't violate the law
- The situation of a restaurant interviewed
- Position: Crossroads (There are two walls as gates)
- Background music: Classic music
- Employee: Pink top, black pants
- Dining table and stools: Stone and metal, wood
- Light bulb: White, hang
- Electric fan: Black, hang
- Second phone
- Record (Before the communication interview)
- Clock (When sleeping at night)
- Game manager (Build a reward and punishment mechanism to motivate)
- Exercise (Sweating every day makes the body organs go on the road of sustainable development)
- Music (When taking a shower)
- Before going to other cities
- Bring backpack and suitcase
- No summer job found for a high school student (2023-07-10)
- References
- https://en.wikipedia.org/wiki/List_of_largest_banks
- Google #
Labor Law site:https://www.gov.cn/
Use "nmcli"
nmcli device wifi connect yourSSID password yourPassword
# Connect
- Notes
- Enable hotspot
nmcli device wifi hotspot con-name yaoniplan ssid yaoniplan password yaoniplan
nmcli connection delete bfc2c6fa-eb8c-472c-b278-5953ec224e33
# Delte the hotspotnmcli connection show
# Get the UUID
- Solve the problem
Jul 16 16:33:19 tux NetworkManager[376]: <warn> [1721118799.2087] device (wlan0): ip:shared4: could not start dnsmasq: Could not find "dnsmasq" binary
nmcli device wifi list
# Get the SSID- Connect to a wired network
nmcli connection up eno1
# Connectnmcli device status
# Get the DEVICE
- Disconnect
nmcli connection down yourUUID
# Disconnectnmcli connection show
# Get the yourUUID
nix profile install nixpkgs#networkmanager
# Install dependenciesdoas systemctl enable NetworkManager --now
# Solve the problemError: NetworkManager is not running
- Because to connect to WiFi when there is no network cable.
- Solve the problem
[yaoniplan@tux ~]$ lspci ... 03:00.0 Network controller: Broadcom Inc. and subsidiaries BCM43142 802.11b/g/n (rev 01) [yaoniplan@tux ~]$ nmcli device wifi list [yaoniplan@tux ~]$
doas pacman --sync broadcom-wl
# Install the correct driverdoas reboot
# Reboot to make it effective
- Solve the problem
[yaoniplan@tux ~]$ nmcli device wifi connect CMCC-ENQy password 1234567a Error: Failed to add/activate new connection: Not authorized to control networking. [yaoniplan@tux ~]$
doas nmcli device wifi connect CMCC-ENQy password 1234567a
# Run the command with root privileges
- Enable hotspot
- References
lspci
# List PCI devicesnmcli
# Network manager command line- ChatGPT
Use "vlc"
vlc yourURL
- Notes
- Options
--fullscreen
--rate 2
- Hotkeys
Ctrl-q
# Quit VLCf
# Full screenm
# Mute]
# Speed upSpace
# pause
nix shell nixpkgs#vlc
# Install dependencies temporarily
- Options
- References
- Tools - Preferences - Hotkeys
Use "smplayer"
vi ~/.config/smplayer/smplayer.ini
[%General] global_speed=true mute=true speed=2 [gui] close_on_finish=true compact_mode=true fullscreen=true [advanced] actions_to_run=fullscreen
Ctrl-l
# PlaylistCtrl-c
# Compact mode-close-at-end
Ctrl-p
# PreferencesShift-t
# Increase substitle sizeCtrl-q
# Quit itsmplayer yourURL
-sub "yourSubtitlesName"
# Subtitlesf
# Full screen-fullscreen
}
# Double speedm
# Mute
- Notes
- Solve the problem of garbled fonts
- Select 'UTF-8 (UTF-8)' of 'Encoding' in 'Subtitles' of 'Preferences'
doas pacman --sync smplayer mplayer
# Install dependencies- Because to play videos online more stably.
- Solve the problem of garbled fonts
- References
- https://www.smplayer.info/en/faq
man smplayer
man mplayer
- ChatGPT
Use "audacious"
audacious yourAudioFile
- Notes
Ctrl-q
# Quit itnix shell nixpkgs#audacious
# Install dependencies temporarily
- References
- ChatGPT
If the function $f(x)=\sin (wx+\varphi)$ in the interval $(\frac{\pi}{6},\frac{2\pi}{3})$ increases monotonously, the straight line $x=\frac{\pi}{6}$ and $x=\frac{2\pi}{3}$ are the two symmetry axes of the image of the function $y=f(x)$, then $f(-\frac{5\pi}{12})=$
- $T=\frac{2\pi}{|w|}$ # The formula for period
- Notes
- Get the value of $w$
- $\frac{T}{2}=\frac{2\pi}{3}-\frac{\pi}{6}$
- Get the value of $\varphi$
- $2\times \frac{2\pi}{3}+\varphi=\frac{\pi}{2}$
- $\sin(-\frac{5\pi}{3})$ # $\sin(-\frac{5\pi}{3}+2\pi)$
- Get the value of $w$
- References
- College Entrance Math in Jiangxi
- ChatGPT
Merge the 10 commmits into 1 commit in Git
git rebase --interactive HEAD~10
- Replace 'pick' with 'squash'
# Except the first one pick commit1hash Commit message 1 squash commit2hash Commit message 2 squash commit3hash Commit message 3 ...
git log
# Verify itgit push git@192.168.10.100:/var/git/note.git development --force
- Notes
- Warning: This is potentially destructive unless you are an adventurer.
- Pull the code in server
git pull origin development --rebase
git commit --amend
# Modify the latest commit message
- References
- ChatGPT
If $O$ be the coordinate origin of the plane coordinate system, randomly pick a point $A$ in the area $\{(x,y)|1\le x^{2}+y^{2}\le 4\}$, then the probability that the inclination angle of straight line $OA$ is not greater than $\frac{\pi}{4}$ is
- $(x-a)^2+(y-b)^2=r^2$ # Circle equation
- $radians=\frac{degrees}{180\degree}\times \pi$ # The conversion formula
- Notes
- $(a,b)$ # Center coordinate
- $r$ # Radius
- $P=\frac{2\times \frac{\pi}{4}}{\frac{360\degree}{180\degree}\times \pi}$
- References
- https://en.wikipedia.org/wiki/Slope#Algebra_and_geometry
- https://en.wikipedia.org/wiki/Radian
- https://en.wikipedia.org/wiki/Circle
- College Entrance Math in Jiangxi
- ChatGPT
The abbreviation of "trade mark" is "TM".
- Notes
- Because see it on some websites.
- References
Simulate mobile devices in Chromium
Ctrl-Shift-c
# Open the developer tools and inspect elementsCtrl-Shift-m
# Toggle mobile devices
- Notes
Ctrl-Shift-i
# Close the developer tools- Because to test the compatibility of yaoniplan.eu.org on mobile devices.
- References
- ChatGPT
If the even function $f(x)= \frac{xe^x}{e^{ax}-1}$, then $a=$
- $f(-x)=f(x)$ # Even functions
- $b^{n+m}=b^{n}\times b^{m}$ # The property of exponentiation
- $b^{0}=1$ # Zero exponent
- Denominator is not zero
- Notes
- $f(-x)=\frac{-xe^{-x}}{e^{-ax}-1}$ # $\frac{-xe^{-x}\times{e^{ax}}}{(e^{-ax}-1)\times{e^{ax}}}$ (Algebra)
- $e^{ax-x}=e^{x}$
- $e^{ax}-1\neq0$
- $f(-x)=\frac{-xe^{-x}}{e^{-ax}-1}$ # $\frac{-xe^{-x}\times{e^{ax}}}{(e^{-ax}-1)\times{e^{ax}}}$ (Algebra)
- References
- https://en.wikipedia.org/wiki/Division_by_zero
- https://en.wikipedia.org/wiki/Exponentiation
- https://en.wikipedia.org/wiki/Even_and_odd_functions#Even_functions
- College Entrance Math in Jiangxi
- ChatGPT
If side length of the small square is $1$, then the surface area of the three view is
- $SA=6s^{2}$ # Cube surface area formula
- $SA$ # Surface area
- $s$ # Side length
- $SA=2(lw+lh+wh)$ # Cuboid surface area formula
- $l$ # Length
- $w$ # Width
- $h$ # Height
three view
- Front and side view
- Top view
- $SA=6s^{2}$ # Cube surface area formula
- Notes
- $SA=6\times2^{2}+2(1\times1+1\times2+1\times2)-2\times1-2\times1$ # Method one
- $SA=2(2\times2+2\times3+2\times3)-1\times1-1\times1$ # Method two
- References
- https://en.wikipedia.org/wiki/Surface_area
- College Entrance Math in Jiangxi
- ChatGPT
Use "jupyter"
Esc
# Return to command mode (Vi-like)h
# Show keyboard shortcutsz
# UndoShift-m
# Merge a cell belowm
# Markdowny
# Codej / k
# Down / Up (Vi-like)Enter
# Insert (Vi-like)dd
# Delete current cell (Vi-like)a
# Above the current cell (Insert a new cell)b
# Below (Insert a new cell)
- First use
- New # Python 3
print("Hello, yaoniplan!")
#Shift-Enter
Ctrl-s
# Save file
- Set dark mode
!pip install jupyterthemes
# Install dependencies!jt --list
# List available themes!jt --theme gruvboxd
# Need to restart the jupyter server to apply changes!jt --reset
# Reset to the defualt theme
- Import and use matplotlib
pip install matplotlib # Install dependencies x = [1, 2, 3, 4, 5] # Assign list to variable y = [2, 3, 4, 5, 6] from matplotlib import pyplot as plt # Set an alias to 'plt' fig1 = plt.figure(figsize=(5, 5)) # 5 rows and 5 colums plt.plot(x, y) # Linear graph (Replace plot with scatter to draw a scatterplot) plt.title('y vs x') plt.xlabel('x') plt.ylabel('y') plt.show()
- Import numpy, generate and manipulate arrays
import numpy as np a = np.eye(5) # Generate an array print(type(a)) print(a) b = np.ones([5, 5]) # Generate an array of 5 rows and 5 columns with all 1s print(type(b)) print(b) print(b.shape) c = a + b # Array addition operation print(type(c)) print(c.shape) print(c)
- Import and use pandas
import pandas as pd data = pd.read_csv('data.csv') # Read the file called 'data.csv' print(type(data)) print(data) x = data.loc[:, 'x'] # Locate the data in the column called 'x' print(type(x)) y = data.loc[:, 'y'] print(y) c = data.loc[:, 'x'][y > 50] # Add conditions with 'y' greater than 50 print(c) data_array = np.array(data) # Convert type to array print(type(data_array)) print(data_array) data_new = data + 10 data_new.head() data_new.to_csv('data_new.csv') # Save the file as 'data_new.csv'
- Notes
nix-shell --command 'jupyter notebook' --packages jupyter
# Use temporarily- In Docker-compose
vim ~/.config/notebook/docker-compose.yml
version: '3' services: jupyter: image: jupyter/base-notebook restart: always ports: - 8888:8888 volumes: - ./:/home/jovyan/
docker-compose up --detach
# Run in the backgrounddocker exec -i -t notebook-jupyter-1 jupyter server list
# Get tocken192.168.10.100:8888/tree/
# Run in a browser on another computer
- References
- https://archive.org/download/1-6-pandas-numpy-matplotlib
- https://github.com/jupyter/notebook/issues/5286
- https://stackoverflow.com/questions/46510192/change-the-theme-in-jupyter-notebook/46561480#46561480
- https://www.codecademy.com/article/getting-more-out-of-jupyter-notebook
- https://github.com/jupyter/notebook
nix-shell --help
- ChatGPT
Set the environment variable EDITOR in Nix
echo 'export EDITOR="/home/yaoniplan/.nix-profile/bin/vi"' >> ~/.bashrc
- Notes
source ~/.bashrc
# Remember to make it effective/home/yaoniplan/.nix-profile/bin/vi
# Replace it with your desired editorwhich vi
# Get itecho $EDITOR
# Check it
- Solve the problem
[yaoniplan@tux ~]$ crontab -e no crontab for yaoniplan - using an empty one /bin/sh: line 1: /usr/bin/vi: No such file or directory crontab: "/usr/bin/vi" exited with status 127 [yaoniplan@tux ~]$
EDITOR=$(which vi) crontab -e
# Try to use other editor (e.g. emacs, nano, etc.)
nix profile install nixpkgs#vi
# Install dependencies
- References
- ChatGPT
Use "emacs"
Ctrl-x b
# BufferCtrl-n
# Next lineCtrl-p
# Previous lineCtrl-s
# Search for a stringCtrl-x Ctrl-f
# Find a fileCtrl-x Ctrl-s
# Save fileCtrl-y
# Paste contents deleted by the shortbut key just nowCtrl-w
# Delete to beginning of line- Delete the current line
Ctrl-a
# Move the cursor to the beginning of the lineCtrl-k
# Delete to end of line
Ctrl-x u
# UndoCtrl-e
# Move the cursor to the the end of a lineCtrl-x Ctrl-c
# Quit the emacs
- Notes
emacs ~/.emacs
(setq inhibit-startup-screen t) ; Close the help page at boot time (load-theme 'manoj-dark t) ; Load manoj-dark theme (tool-bar-mode -1) ; Close tool bar (scroll-bar-mode -1) ; Close scroll bar (menu-bar-mode -1) ; Close menu bar
Alt-x load-theme
# Load a theme
nix shell nixpkgs#emacs
# Install dependencies temporarily
- References
- https://book.emacs-china.org/
- ChatGPT
Use "nano"
Ctrl-c
# Break the current operation (Like Shell)Alt-u
# Undo (Like Vi'su
)Ctrl-h
# Delete one letter to the left (Like Vi)Ctrl-x
# Exit the nano
- Notes
nix shell nixpkgs#nano
# Install dependencies temporarily
- References
- ChatGPT
Use "less"
less ~/.bash{rc,_profile}
- Notes
~/.bash{rc,_profile}
#~/.bashrc
and~/.bash_profile
:n
# Next file:p
# Previous file- Scrool page
f
# Forward (Same asSpace
on Chromium)b
# Backward (Same asShift-Space
on Chromium)Ctrl-[ }
# Right one half screen width
- References
h
- ChatGPT
Run a web server in Docker
vi ~/note/Dockerfile
FROM nginx:latest COPY . /usr/share/nginx/html/
docker build --tag yaoniplan ~/note/
# Build a Docker imagedocker run --detach --publish 2003:80 yaoniplan
# Run the Docker container192.168.10.105:2003
# Run in Chromium
- Notes
vi compose.yaml
# Start at bootservices: todo: build: . container_name: todo restart: always ports: - "2006:80"
docker compose up --detach
# Run in the background
vi Dockerfile
# A lightweight methodFROM busybox COPY . /app CMD httpd -f -p 80 -h /app
FROM busybox
# Use BusyBox as the base imageCOPY . /app
# Copy files from your local file system into Docker imageCMD
# Execute commands when the container is running-f
# Run in the foreground-p 80
# Bind the HTTP server to port 80-h /app
# Specify the home directory for the server as/app
yaoniplan
# Replace it with your desired name2003
# Replace it with your desired port- Update it
docker build --tag yaoniplan:0.0.1 note/
- References
httpd --help
- ChatGPT
The abbreviation of "Local Area Network" is "LAN".
- A computer network
- Interconnect computers
- Within a limited area
- A computer network
- References
Enable the docker daemon in Nix
doas dockerd
# Run the docker daemonbg
# Type this command after pressing 'Ctrl-z'
- Notes
- Solve the problem
yaoniplan@tux ~/testMath $ docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? yaoniplan@tux ~/testMath $
- Solve the problem
- References
Check if a file is a symbolic link in Bash
vi ~/.local/bin/convertMarkdownToHtml.sh
if [[ ! -f "$readmeFile" || -L "$readmeFile" ]]; then ln -s $(ls -1 "$journalsDir"/* | tail -1) "$readmeFile" fi
- Notes
-L
# Link
- References
man bash
#/-L
- ChatGPT
The abbreviation of "Digital Versatile Disc" is "DVD".
- A format
- To Store data
- Notes
- Because to replace Linux server with other Linux distributions.
- References
Set a static IP in Arch Linux
doas vim /etc/systemd/network/enp2s0.network
[Match] Name=enp2s0 [Network] DHCP=no Address=192.168.10.100/24 Gateway=192.168.10.1
doas systemctl enable systemd-networkd
# Run at boot timedoas systemctl restart systemd-networkd
# Apply changes
- Notes
systemctl status systemd-networkd > network.log
# Analyze the log file if not working properlyApr 19 23:17:35 tux systemd-networkd[2408]: enp2s0: Configuring with /etc/systemd/network/20-ethernet.network.
- Modify the specified configuration file
- Set two static IP addresses in Arch Linux
... [Address] address=192.168.10.10/24
enp2s0
# Replace it with your interface nameip address
# Get it
192.168.10.100
# Replace it with your desired static IP address192.168.10.1
# Replace it with your default gatawayip route | awk '/default/ {print $3}'
# Get it
- Enable DHCP to get an IP address from another new router
doas vim /etc/systemd/network/enp2s0.network
[Match] Name=enp2s0 [Network] DHCP=yes
doas systemctl restart systemd-networkd
# Apply changes
- References
- ChatGPT
If $z={\frac{2+i}{1+i^2+i^5}}$, then $\bar{z}=$
- $i^2=-1$ # Imaginary unit i formula
- If $z=a+bi$, then $\bar{z}=a-bi$ # Complex conjugate formula
- $bi\times(-1)$
- Positive real number
- Positive: The real part must be positive ($a>0$)
- Real number: The imaginary part must be zero ($b=0$)
- $|z|=\sqrt{(a-0)^{2}+(b-0)^{2}}$ # Modulus is the distance from the origin $(0,0)$ to the point $(a,b)$
- $a^{2}+b^{2}=c^{2}$ # Pythagorean theorem in the right triangle
- Equality of complex numbers
- Two complex numbers are equal if their real parts are the same and their imaginary parts are the same
- $(1+i)x=1+yi$ # ($x=1, x=y$)
- Notes
- Simplify (To get form $z=a+bi$)
- Expand (e.g. $i^{5}$, $i^{2}i^{2}i$)
- Isolate $z$ to one side # (e.g. $\frac{1+z}{1-z}=i$, $1+z=i(1-z)$, $z(1+i)=i-1$)
- $2+i \over i$ # $(2+i)i \over ii$ (Algebra)
- Simplify (To get form $z=a+bi$)
- References
- https://unacademy.com/content/jee/study-material/mathematics/all-about-equality-of-complex-numbers/
- https://en.wikipedia.org/wiki/Pythagorean_theorem#Complex_numbers
- https://en.wikipedia.org/wiki/Absolute_value#Complex_numbers
- https://en.wikipedia.org/wiki/List_of_universities_and_colleges_in_Beijing
- If a complex number $z$ satisfies $\frac{1+z}{1-z}=i$, then $|z|=$
- If $(a+i)^{2}i$ is a positive real number, then $a=$
- College Entrance Math in Jiangxi
Explain it using knowledge points
# ChatGPT
If the sets $U=R$, $M=\{x|x<1\}$, $N=\{x|-1<x<2\}$, then $\{x|x \ge 2\}=$
- $C_U(M \cup N)$ # $U-(M \cup N)$
- $C_U$ # Complement of a set
- $ \cup $ # Union of sets
- $U$ # Universal set
- $C_U(A \cap B)$
- $ \cap $ # Intersection of sets
- $C_U(M \cup N)$ # $U-(M \cup N)$
- Notes
- $\{x|x \ge 2\}$ # $U-(M \cup N)$
- $M \cup N$ # $\{x|x<2\}$
- $\{x|x \ge 2\}$ # $U-(M \cup N)$
- References
- College Entrance Math in Jiangxi
- ChatGPT
Set background color in HTML
vi ~/note/assets/index.html
<head> <style> html { background-color: #0d1117; } </style> </head>
- Notes
html
# Replace it withbody
(Is ok)0d1117
# Replace it with your desired color code in hexadecimal format- Because to enable dark mode fully.
- References
- ChatGPT
Use "tldr"
tldr links
- Notes
links
# Replace it with your desired commandnix shell nixpkgs#tldr
# Install dependencies temporarily
- References
- TL;DR # Too long; didn't read
- ChatGPT
Use "links"
links yaoniplan.eu.org
links -dump https://example.com > output.txt
# Save as a text file
- Notes
Ctrl-r
# Reload- Scoll pages
Ctrl-f
# ForwardCtrl-b
# BackwardCtrl-p
# PreviousCtrl-n
# Next]
# Right
/nix"
# Searchn
# Next
yaoniplan.eu.org
# Replace it with your desired URL (e.g. suckless.org, 192.168.10.100:2003, etc.)~/note/assets/index.html
# Local HTML file is also fine
nix shell nixpkgs#links2
# Install dependencies temporarily
- References
man links
tldr links
Make .nix-profile/bin/ effective in Dmenu
vi ~/.bash_profile
if [[ -d "$HOME/.nix-profile/bin/" ]]; then export PATH="$PATH:$HOME/.nix-profile/bin/" fi
reboot
# Reboot the operating systemrm ~/.cache/dmenu_run
# Clear cache
- References
Understand "B84 W58 H83"
B
# Bust84
# 84 cmW
# WaistH
# Hip
- Notes
- To determine the appropriate size of clothing
- References
- Dragon Knight III (ドラゴンナイトIII) #NSFW
Use "pandoc"
pandoc -s --katex -o index.html index.md
- Notes
- Solve the problem that some symbols cannot be rendered
git https://github.com/KaTeX/KaTeX
# Download the fontsmv ./KaTeX/fonts/ ~/note/assets/
# Move them into your assets
vi ~/notes/assets/index.html
# Another way<head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.css" integrity="sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI" crossorigin="anonymous"> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.js" integrity="sha384-G0zcxDFp5LWZtDuRMnBkk3EphCK1lhEf4UEyEM693ka574TZGwo4IWwS6QLzM/2t" crossorigin="anonymous"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script> </head> <body> <script> // Render all KaTeX expressions on the page document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { delimiters: [ { left: "$$", right: "$$", display: true }, { left: "$", right: "$", display: false } ] }); }); </script> </body>
vi ~/note/assets/index.html
# Another way<head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.css" integrity="sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI" crossorigin="anonymous"> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.js" integrity="sha384-G0zcxDFp5LWZtDuRMnBkk3EphCK1lhEf4UEyEM693ka574TZGwo4IWwS6QLzM/2t" crossorigin="anonymous"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script> <script> document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { // customised options // • auto-render specific keys, e.g.: delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true} ], // • rendering keys, e.g.: throwOnError : false }); }); </script> </head>
vi ~/note/assets/index.html
# Another way<head> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML"></script> </head>
- Warning: Does not work for inline mode
vi ~/note/assets/index.html
# Another way<head> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script> </head>
- Warning: Use
\( ... \)
instead of$ ... $
- Warning: Use
vi ~/note/assets/index.html
# Another way<head> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML"></script> <script src="../assets/mathjax-config.min.js"></script> </script> </head>
vi ~/note/assets/mathjax-config.min.js
MathJax.Hub.Config({tex2jax:{inlineMath:[['$','$'],["\\(","\\)"]],processEscapes:!0}});
-s
# Standalone-o
# Outputnix profile install nixpkgs#pandoc
# Install the dependency
- Solve the problem that some symbols cannot be rendered
- References
Use mathematical formulas in Markdown
- Default
$b=0$
# Equal$a>0$
# Greater than$|z|=2$
# Modulus (Absolute value)
$|z|=\sqrt{a^{2}+b^{2}}$
# $|z|=\sqrt{a^{2}+b^{2}}$$radians=\frac{degrees}{180\degree}\times \pi$
# $radians=\frac{degrees}{180\degree}\times \pi$$e^{ax}-1\ne0$
# $e^{ax}-1\ne0$$6\times2^{2}$
# $6\times2^{2}$$\frac{2+i}{i}$
# $\frac{2+i}{i}$$\\{x|x\ge2\\}=U-(M \cup N)$
# $\{x|x\ge2\}=U-(M \cup N)$$\bar{z}=$
# $\bar{z}=$$A \cap B$
# $A \cap B$$b\perp(b-4a)$
# $b\perp(b-4a)$$u \cdot v=0$
# $u \cdot v=0$$\overrightarrow{AB}=\vec{c}$
# $\overrightarrow{AB}=\vec{c}$$\triangle ABC$
# $\triangle ABC$$\cos90\degree$
# $\cos90\degree$
- Default
- Notes
\degree
\triangle
# Triangle\overrightarrow{}
# Over right arrow\vec{}
# Vector\cdot
# Centered dot\perp
# Perpendicular\cap
# Intersection\sqrt{}
# Square root\ne
# Not equal to\times
^{}
# Superscript\frac{}{}
# Fraction\over
# Another way (Numerator divided by denominator)
_{}
# Subscript\cup
# Union\ge
# Greater than or equal to\le
# Less than or equal to
- References
- https://en.wikibooks.org/wiki/LaTeX/Mathematics
- https://docs.moodle.org/402/en/Using_TeX_Notation
- https://wumbo.net/symbols/union/ # Replace union with other symbol (e.g. intersection)
- ChatGPT
Use "convert"
convert ~/note/assets/2024-06-06-124844.jpeg -channel RGB -negate ~/note/assets/2024-06-06-124844.jpeg
# Invert colors (Dark mode)convert +append 230614102157.jpg 230614102435.jpg 221128keyboardManual.jpg
convert 231012seeADentist.HEIC 231012seeADentist.png
- Notes
- Stitch images vertically (Like a waterfall)
convert -append math{01..04}.png mathVertically.png
nix profile install nixpkgs#imagemagick
# Install the dependency
- Stitch images vertically (Like a waterfall)
- References
The abbreviation of "GNU Image Manipulation Program" is "GIMP".
- Notes
- Because to edit a PDF file to remove some commercials.
- LibreOffice (Achieve the purpose)
- Open (Ctrl-o) - Frame the part (Click and drag) - Backspace - Export as PDF
- Because to edit a PDF file to remove some commercials.
- References
nix search nixpkgs#gimp
Set the environment variable LOCALE_ARCHIVE in Nix
echo 'export LOCALE_ARCHIVE="/usr/lib/locale/locale-archive"' >> ~/.bashrc
- Notes
- Solve the problem
yaoniplan@tux ~ $ nix shell nixpkgs#cowsay --command cowsay Hello, yaoniplan! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
source ~/.bashrc
# Remember to make it effective
- Solve the problem
- References
Make .bashrc effective when new a terminal
vim ~/.bash_profile
if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
- Notes
-f
# File
- References
- ChatGPT
Fix API rate limiting issues in GitHub
doas vim /etc/nix/nix.conf
access-tokens = github.com=yourPersonalAccessToken
- Notes
export GITHUB_TOKEN="yourPersonalAccessToken"
# Another way- Warning: It does not work sometimes.
yourPersonalAccessToken
# Replace it with your PAT- In "Personal access tokens" of "Developer Settings"
- Need to grant 'repo' access
- Sovle the problem
yaoniplan@tux /tmp/tmp.ItcK2amanT $ nix flake new -t templates#go-hello . error: … while fetching the input 'github:NixOS/templates' error: unable to download 'https://api.github.com/repos/NixOS/templates/commits/HEAD': HTTP error 403 response body: {"message":"API rate limit exceeded for 35.77.62.80. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"} yaoniplan@tux /tmp/tmp.ItcK2amanT $
- References
Use "nix"
nix profile install github:abenz1267/walker
# Build a software (Spend a lot of time)nix profile install nixpkgs/24fe8bb4f552ad3926274d29e083b79d84707da6#obs-studio
# Install lower version packagesnix search nixpkgs#firefox
# Search for the packagenix search nixpkgs opencv
# Another way
nix flake new --template github:the-nix-way/dev-templates#node testNode
# Create a node project in directory testNodenix develop
# Enter a development environment after writing flake.nix
nix shell nixpkgs#git
# Install a package temporarilynix-shell --command 'jupyter notebook' --packages jupyter
# Use temporarilynix shell nixpkgs#firefox --command firefox yourURL
# Use temporarilynix-shell --packages python310Packages.numpy python310Packages.opencv4
# Another waynix shell nixpkgs#fortune nixpkgs#cowsay --command sh -c 'fortune | cowsay'
nix profile install nixpkgs#hello
# Install a package permantentlynix profile upgrade /nix/store/b0z563zg65fnxaqp612cbxv7x5y7pnz2-foot-1.16.2
# Upgrade a packagenix profile remove /nix/store/2g3jazymqbjw9c390c3b7vw8xq3r8iny-hello-2.12.1
# Remove itnix profile list
# List installed packages
- Notes
- Solve the problem
yaoniplan@tux ~ $ nix upgrade-nix error: directory '/home/yaoniplan/.nix-profile/bin' does not appear to be part of a Nix profile yaoniplan@tux ~ $
ls -l $(which nix)
# Get Nix executable pathnix profile remove /nix/store/smfmnz0ylx80wkbqbjibj7zcw4q668xp-nix-2.19.2/bin/nix
# Remove the package/nix/store/iwgkck1d64s5f26ngln540hpf06g28py-nix-2.20.1/bin/nix profile install nixpkgs#nix
# Reinstall the package- https://github.com/NixOS/nix/issues/5473#issuecomment-1309181669
- Solve the problem
... It seems the build group nixbld already exists, but with the UID 967. This script can't really handle that right now, so I'm going to give up. You can fix this by editing this script and changing the NIX_BUILD_GROUP_ID variable near the top to from 30000 to 967 and re-run. ...
doas rm -rf /nix/ ~/.nix*
# Uninstall Nixcompgen -u
# List all usersfor user in nixbld{01..10}; do sudo userdel $user; done
# Delete the users created by Nixdoas groupdel nixbld
# Delete the Nix group
- Solve the problem
yaoniplan@tux ~ $ nix search nixpkgs#excel error: … while fetching the input 'github:NixOS/nixpkgs/nixpkgs-unstable' error: creating directory '/nix/store/tmp-2004-1': Permission denied yaoniplan@tux ~ $
doas chown -R $(whoami) /nix/store/
# Change the owner
- Solve the problem
yaoniplan@tux ~ $ nix-shell -p nix-info --run "nix-info -m" error: … <borked> at «none»:0: (source not available) ...
nix-channel --update
- Enable flakes
echo "experimental-features = nix-command flakes" | doas tee -a /etc/nix/nix.conf
doas vim /etc/nix/nix.conf
# Set mirror in Nixsubstituters = https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org/
nix-channel --add https://mirrors.ustc.edu.cn/nix-channels/nixpkgs-unstable nixpkgs
nix-channel --update
curl -L https://nixos.org/nix/install | sh
# Install-L
# Locationwget -O- https://nixos.org/nix/install | sh
# Another way to install-O-
# The same as-L
ofcurl
source ~/.nix-profile/etc/profile.d/nix.sh
# Apply changesdoas rm -rf /nix/ /etc/nix/ ~/.nix-{profile,defexpr,channels}
# Uninstall
- Solve the problem
- References
- https://docs.fluidattacks.com/development/stack/nix/#troubleshooting
- https://github.com/the-nix-way/dev-templates
- https://github.com/NixOS/nix/issues/7937#issuecomment-1455013868
- https://xeiaso.net/blog/nix-flakes-1-2022-02-21
- https://nixos.wiki/wiki/Flakes
- https://www.youtube.com/watch?v=o1Y7rWrPEO8
- https://ghedam.at/a-tour-of-nix-flakes
- https://mirrors.ustc.edu.cn/help/nix-channels.html
- https://github.com/NixOS/nix
nix profile --help
man curl
- ChatGPT
Solve the problem in Nix
export NIX_EXPERIMENTAL_FEATURES="nix-command flakes" nix build --extra-experimental-features "nix-command flakes"
- Notes
$ export NIX_EXPERIMENTAL_FEATURES="nix-command flakes" nix build --extra-experimental-features nix-command error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override $
- References
- ChatGPT
Simulate a mouse double click in Vimium C
- Custom key mappings
map gd LinkHints.activate dblclick
- Custom key mappings
- Notes
- Click on the letter
g
, then on the letterd
- Click on the letter
- References
Stop a process in Linux
kill -STOP 508
- Notes
508
# Replace it with your process IDps aux | grep mpv
kill -CONT 508
# Continue
- References
- ChatGPT
Use "awk"
awk -v RS='' 'NR==1'
# Extract the first paragraph-v
# Assign value to variableRS
# Record separatorNR
# Number of records
docker ps --format "{{.Ports}}" | awk -F'[:/]' '{print $2}'
kill -STOP $(ps aux | grep -v grep | grep aola | awk '{print $2}')
- Notes
-F
# Field separator[:/]
# Either ':' or '/'aola
# Replace it with your desired command$2
# Second column
- References
man gawk
#\-v
RS
NR
- Manipulate columnar data # ChatGPT
Use "vimium c"
p
# Search selected words in search engine when in visual modemap <f6> copyWindowInfo type="tab" format="${title}"
# Copy page titlegi
# Copy image to the clipboard2gu
# Go up the URL hierarchy twice- From an issue to a code area on GitHub
^
# Previous tabgf
# Go to the next framemap <c-m> toggleMuteTab
# Ctrl-myv
#Ctrl-f
andv
orV
y
# Yankv
# Visual
W
# Move current tab to next window- Add a search engine in 'Custom search engines'
tr: https://translate.google.com/?sl=auto&tl=en&text=%s pp: https://www.perplexity.ai/search?q=%s blank=https://www.perplexity.ai
&
# A separator (Between parameters)pp
# An alias (Customizable)search
# Search functionality?
# A separator (Between the base URL and the query parameters)q=
# A query parameter%s
# A placeholder (Vimium C will replace it with your search query)blank=https://www.perplexity.ai
# If the search query is empty then open it (Optional)
- References
- https://airespo.com/resources/how-to-set-perplexity-ai-as-default-search-engine-in-chrome/ #
/perplexity.ai
- https://github.com/gdh1995/vimium-c/discussions/938
- https://github.com/gdh1995/vimium-c/issues/1133#issuecomment-2125555652
- https://github.com/gdh1995/vimium-c/issues/289#issue-811171738
- https://github.com/gdh1995/vimium-c/issues/842#issuecomment-1426803034
- https://github.com/gdh1995/vimium-c/discussions/794#discussion-4551520
?
#/image
- https://airespo.com/resources/how-to-set-perplexity-ai-as-default-search-engine-in-chrome/ #
Simulate middle mouse button and jump to new page in Vimium C
- Custom key mappings
map gn LinkHints.activateHover $then="$D+mid_click" run <v-mid_click> sim_mid#mousedown+$D+sim_mid#mouseup+$D+lh_open run <v-sim_mid> dispatchEvent#button=1&type=$s mask map <v-lh_open> LinkHints.click mode="incognito" incognito=false direct="hovered"
- Custom key mappings
- Notes
- Click on the letter
g
, then on the lettern
- Click on the letter
- References
Simulate hover in Vimium C
- Custom key mappings
map gh LinkHints.activateHover
- Custom key mappings
- Notes
- Warning: Require fine-tuning to fully function.
- Click on the letter
g
, then on the letterh
- References
Move no space files to temporary directory in Linux Bash one-liner
for f in {01..23}*; do if [[ ! "$f" =~ " " ]];then mv "$f" /tmp/; fi; done
- Notes
!
# Not=~
# Regular expression
- References
- ChatGPT
Understand "Please Give Me Wings"
- A song
- folk
- Japanese
- A song
- References
- Danganronpa # Animation
- https://en.wikipedia.org/wiki/Tsubasa_o_Kudasai
- https://www.youtube.com/watch?v=dmo9SMswttQ # English version
- https://www.youtube.com/watch?v=5ZXquiMoyjY # Japanese version
Insert a string at the the beginning of the line in Vi
:%s/^/xdg-open /g
- Notes
xdg-open
# Replace it with your desired string- Because to open URL in batches.
:%s/$/ \&/g
# Insert a string at the end of the line in Vi%s/ \&$//g
# Remove it- Because to download multiple files at the same time.
The abbreviation of "QEMU Copy On Write 2" is "qcow2".
- A format
- Notes
- Because to use qemu command.
- References
- ChatGPT
Use "parted"
parted /dev/sda -- rm 3
# Remove the third partition (/dev/sda3)
- Notes
- Because typed the wrong command accidentally when partitioning.
- References
Search for package names in NixOS
nix-env -qaP wqy-microhei
- Notes
-q
# Query-a
# Available-P
# Path- Another way
vim /etc/nixos/configuration.nix
users.users.yaoniplan = { packages = with pkgs; [ wqy_microhei ]; };
- Because to solve the problem of garbled Chinese fonts.
- References
man nix-env
- ChatGPT
Install KDE Plasma in NixOS
vim /etc/nixos/configuration.nix
services.xserver.enable true; services.xserver.displayManager.sddm.enable = true; services.xserver.desktopManager.plasma5.enable = true;
- Notes
- Enable autologin in SDDM
services.xserver.displayManager.autoLogin.enable = true; services.xserver.displayManager.autoLogin.user = "yaoniplan";
- When no password is set for the user
- Install Awesome WM in NixOS
services.xserver = { enable = true; displayManager = { sddm.enable = true; defaultSession = "none+awesome"; }; windowManager.awesome = { enable = true; luaModules = with pkgs.luaPackages; [ luarocks # is the package manager for Lua modules luadbi-mysql # Database abstraction layer ]; }; };
nixos-rebuild switch --option substituters https://mirrors.ustc.edu.cn/nix-channels/store
# Rebuild to make changes effective- Use Wayland (Warning: It has some bugs)
- Select "Plasma (Wayland)" of Desktop Session in SDDM
- Because to master it quickly.
- Enable autologin in SDDM
- References
Use ssh in NixOS
vim /etc/nixos/configuration.nix
# Enable the OpenSSH daemon in NixOS services.openssh.enable = true;
- Notes
- Because to use the command
ssh yaoniplan@192.168.10.105 -p 60022
in another computer.
- Because to use the command
Install packages for root user in NixOS
vim /etc/nixos/configuration.nix
# List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ vim git wget ];
- Notes
- Because to use vim to edit configuration.nix file.
Add a user to multiple groups in NixOS
vim /etc/nixos/configuration.nix
# Define a user account. Don't forget to set a passwd with `passwd`. users.users.yaoniplan = { isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ]; # Enable `sudo` for the user. packages = with pkgs; [ git vim wget ]; };
- Notes
- Because to use the sudo command
sudo chown -R yaoniplan:yaoniplan /mnt/yaoniplan/
.groupadd yaoniplan
# Add a group in Linux to solve the problem[root@tux:~]# chown -R yaoniplan:yaoniplan /mnt/yaoniplan/ chown: invalid group: ‘yaoniplan:yaoniplan’ [root@tux:~]#
- Because to use the sudo command
- References
Enable sound or volume in NixOS
vim /etc/nixos/configuration.nix
# Enable sound. sound.enable = true; hardware.pulseaudio.enable = true;
Set time zone in NixOS
vim /etc/nixos/configuration.nix
time.timeZone = "Asia/Shanghai";`
- Notes
timedatectl
# View the current time zoneAsia/Shanghai
# Replace it with your desired time zonetimedatectl list-timezones
# List all time zones
Set locale in NixOS
vim /etc/nixos/configuration.nix
i18n.defaultLocale = "en_US.UTF-8";
- Notes
- Because English is the common language of the open source world.
Set hostname in NixOS
vim /etc/nixos/configuration.nix
networking.hostname = "tux"; # Define your hostname.
- Notes
tux
# Replace it with yours
Set network configuration in NixOS
vim /etc/nixos/configuration.nix
networking.networkmanager.enable = true; users.users.yaoniplan = { extraGroups = [ "networkmanager" ]; };
- Notes
yaoniplan
# Replace it with your user
- References
Set keymap in NixOS
vim /etc/nixos/configuration.nix
services.xserver.layout = "us";
Delete redundant directories in Linux
ls -1dr "$destinationDir"/* | tail -"$quantityToDelete" | xargs rm -rf
- Notes
-1
# One per line-d
# Directory-r
# Reversexargs
# Execute arguments- Because to backup files with a scirpt automatically.
- Another way
ls -1d "$destinationDir"/* | head -"$quantityToDelete" | xargs rm -rf
- References
man ls
man xargs
- ChatGPT
Use the ISO file to enter the system in NixOS
mount /dev/disk/by-label/nixos /mnt
mount /dev/disk/by-label/boot /mnt/boot
swapon /dev/sda2
- Notes
- When booting
Reboot Into Firmware Interface Boot Manager UEFI VBOX CD-ROM VB2-01700376
sudo --login
# Substitute to root usersetfont ter-v32n
# Increase the font sizevim /mnt/etc/nixos/configuration.nix
# Edit the configuration filenixos-install
# Install systemnixos-rebuild switch
- Because to edit the
configuration.nix
file when can't log in to the system.
- When booting
- References
Set mirror in NixOS
vim /etc/nixos/configuration.nix
nix.settings.substituters = [ "https://mirrors.ustc.edu.cn/nix-channels/store" "https://cache.nixos.org" ];
- Notes
- Set mirror temporarily
nixos-install --option substituters "https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org"
nixos-install
# Replace it with your desired comand (e.g.nixos-rebuild switch
)
- Because to improve the speed when using command
nixos-install
.
- Set mirror temporarily
- References
Set prompt string in Linux Bash
PS1='[\u@\h \W]\$ '
[yaoniplan@tux ~]$
- Notes
\
# Escapeu
# Userh
# HostnameW
# Working directory
- Enable colors with the ANSI escape codes
\[\e[1;32m\]
# Set the color to bold green\[\e[0m\]
# Reset the color to the default\e[
# Escape1;
# Bold32
# Green color codem
# Mark the end0
# Reset
- Set prompt string permanently
vi ~/.bashrc
PS1='\[\e[1;32m\]\u@\h\[\e[0m\] \[\e[1;34m\]\w \$\[\e[0m\] '
source ~/.bashrc
- References
echo $PS1
- https://missing-semester-cn.github.io/2020/command-line/ # $PS1
- ChatGPT
The abbreviation of "Prompt String 1" is "PS1".
- References
Understand "Twinkle, Twinkle, Little Star"
- A lullaby
- From a poem
- A lullaby
- Notes
- Lyrics (The first part)
- Twinkle, twinkle, little star,
- How I wonder what you are!
- Up above the world so high,
- Like a diamond in the sky.
- Lyrics (The first part)
- References
- Your Lie in April # Animation
- https://en.wikipedia.org/wiki/Twinkle,_Twinkle,_Little_Star
Use "journalctl"
journalctl -e
- Notes
--since "2024-09-02 08:00:00"
# From time--until "2024-09-02 09:00:00"
# To time-e
# End- Because to debug scripts that don't work properly.
- References
man journalctl
- ChatGPT
Search for content in C language on GitHub
language:C todo
- Notes
C
# Replace it with other language (e.g. Bash, Python etc.)created:2020-01-01..2021-01-01
# Created date
- References
- ChatGPT
Install Gentoo Linux in Docker on Arch Linux
docker run -i -t gentoo/stage3 bash
- Notes
-i
# Interactive-t
# Ttygentoo/stage3
# Replace it with your desired Linux (e.g. nixos/nix)doas pacman -S docker
# Install in Arch Linuxdoas systemctl start docker
# Once now- Restart and interact with the last exited Docker container
doas docker start a38ab0552048
doas docker exec -i -t a38ab0552048 bash
- Because someone in the group shared the news of success.
vi ~/.config/gentoo/docker-compose.yml
version:: '3' services: gentoo: image: gentoo/stage3 restart: always tty: true stdin_open: true volumes: - ~/.config/gentoo:/data command: bash -c "while :; do sleep 1; done"
- References
docker exec --help
docker ps --help
doas docker ps --all
# Get CONTAINER ID (e.g. a38ab0552048)
- ChatGPT
Set an alias in Linux Bash
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME/'
dotfiles
# Replace it with your desired alias- Put your desired command into single quotes
- Put it into
~/.bashrc
and thensource ~/.bashrc
to make it effective permanently
- Notes
alias dotfiles
# Display the aliasunalias dotfiles
# unalias\dotfiles
# Another way
vi ~/.ssh/config
# Set an alias for sshHost yaoniplan User yaoniplan HostName 192.168.10.100
yaoniplan
# Replace it with your user192.168.10.100
# Replace it with your host namessh yaoniplan
# The same asssh yaoniplan@192.168.10.100
- References
unalias --help
- https://missing-semester-cn.github.io/2020/command-line/
Understand "Rhapsody in Blue"
- A piece of music
- Piano
- Jazz
- A piece of music
- References
The abbreviation of "/sbin" is "system binary".
- References
The abbreviation of "systemd" is "system daemon".
- References
Detect if a command is running in Linux Bash script
if ps aux | grep -v grep | grep timerOfTomato.sh &>/dev/null; then
- Notes
-v
# Invert matchtimerOfTomato.sh
# Replace it with your desired commandif ! pgrep tilda; then
# Another way (Does not work for scripts)!
# Not
- References
man grep
- ChatGPT
Move a window from one session to another in tmux
tmux move-window -s 0:1 -t 1:2
- Notes
-s
# Source0
# Session name-t
# Target (To)2
# Window name
- References
man tmux
#/move-window
- ChatGPT
Use "tilda" in DWM
doas vi ~/.config/dwm/config.h
static const Rule rules[] = { /* class instance title tags mask isfloating monitor */ { "Tilda", NULL, NULL, 0, 1, -1 }, };
cd ~/.config/dwm/ && doas make clean install
# Compile to make changes effective
tilda -C
# Config# General 0 # Auto Hide Delay of "Auto Hide" Hide when Tilda loses focus # Appearance 50.00 # Percentage of Height 70.00 # Percentage of Width Centered Horizontally # Position # Keybindings <Alt>a # Pull Down Terminal
vi ~/.config/tilda/config_0
# Another way
- Notes
tilda --command tmux
# Run the tmux command at startupdoas pacman -S tilda
# Install in Arch LinuxAlt-Shift-q
# Quit to make all changes effective- Because it can act as a drop-down terminal and scratchpad.
- It's a little tasteless.
- We already have st and dmenu.
- References
- ChatGPT
tilda --help
- https://wiki.archlinux.org/title/Dwm#Using_Tilda_with_dwm
Set the escape time to 0 in Vim
vi ~/.vimrc
" Set escape time to 0 set timeoutlen=0 ttimeoutlen=0
- Notes
len
# Lengtht
# Terminal- Warning: It may prevent some plugin shortcuts from working.
- Because for faster response.
- References
- ChatGPT
:help timeoutlen
As long as it works. #idea
- Perfectionism can consume a lot of time in some cases.
- Notes
- Because failing too much wears out patience.
Install "DWM" from source code in Linux
git clone https://git.suckless.org/dwm ~/.config/dwm/
w3m suckless.org
# Second way that improve the speedlinks suckless.org
# Third way that improve the speed
cd ~/.config/dwm/; sudo make clean install
# Compile it
- Notes
- Unpatching
cd ~/.config/dwm/
git checkout .
- Patching
- Download a patch https://dwm.suckless.org/patches/uselessgap/
cd ~/.config/dwm/
patch -p1 < ~/dwm-uselessgap-20211119-58414bee958f2.diff
doas make clean install
- Install some dependencies before compiling
sudo pacman -S base-devel libx11 libxinerama libxft xorg xorg-xinit
- https://packages.gentoo.org/packages/x11-wm/dwm/dependencies
- Make the notify-send command works
vim ~/.xinitrc
exec dbus-launch --sh-syntax --exit-with-session dwm
echo 'export $(dbus-launch)' >> ~/.bashrc
- Turn off the display of the following message
/usr/lib/Xorg.wrap: Only console users are allowed to run the X server xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error Couldn't get a file descriptor referring to the console.
vim ~/.bash_profile
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then exec startx fi
- Set resolution if it is not clear
xrandr --output LVDS-1 --mode 1280x720
LVDS-1
# Replace it with your screen name1280x720
# Replace it with your desired resolution
- Unpatching
- References
Use "Bspwm" WM in Linux
Super-Shift-w
# Kill a windowSuper-Space
# Run dmenuSuper-Alt-q
# Quit BspwmSuper-Enter
# New a terminalSuper-h
# Move cursorSuper-Shift-h
# Move window
- Notes
- First use
mkdir --parents ~/.config/bspwn/ ~/.config/sxhkd/
cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/
cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/
- First use
- References
Detect if a command exists in Linux Bash script
if command -v redshift &>/dev/null; then
- Notes
-v
# Verboseredshift
# Replace it with your desired command
- References
- ChatGPT
command --help
[yaoniplan@tux ~]$ if command -v redshift &>/dev/null; then ls; fi [yaoniplan@tux ~]$ if command -v ls &>/dev/null; then ls; fi note [yaoniplan@tux ~]$
Use "sudo" in Linux
su root
# Substitude to root uservisudo
# Use Vi to edit the sudoers fileyaoniplan ALL=(ALL) ALL
pacman --sync vi
# Install Vi to solve the problem[root@tux yaoniplan]# visudo visudo: no editor found (editor path = /usr/bin/vi) [root@tux yaoniplan]#
exit
# Exit the root user
- Notes
- Solve the problem
[sudo] password for yaoniplan: yaoniplan is not in the sudoers file.
- Solve the problem
- References
- ChatGPT
Disable "reflector" tool in Arch Linux
systemctl stop reflector
- Notes
- Because to set a specifier mirror in the Live CD.
vim /etc/pacman.d/mirrorlist
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
pacman --sync --refresh
# Test speed
- Because to set a specifier mirror in the Live CD.
- References
List font in Linux
fc-list
- Notes
fc
# Font config
- References
- ChatGPT
man fc-list
Add a user in Arch Linux
doas useradd -m yaoniplan
- Notes
-m
# Create user's home directorydoas passwd yaoniplan
# Change user passwordsu yaoniplan
# Substitue to the user- Delete the user in Arch Linux
doas userdel --remove yaoniplan
# Remove the home directory
- References
- ChatGPT
man userdel
#/home
man passwd
man useradd
Use "awesome"
Ctrl-Super-r
# Reload awesomeSuper-s
# Show hotkeysSuper-j
# Move cusorSuper-Shift-c
# Kill a programSuper-Enter
# New a terminalSuper-f
# Full screen
- Notes
- Start awesome automatically
echo "exec awesome" >> ~/.xinitrc
echo "startx" >> ~/.bash_profile
- Configure file
mkdir --parents ~/.config/awesome/
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/rc.lua
- Set the font
vim ~/.config/awesome/rc.lua
beautiful.font = "DejaVu Sans Mono 10"
awesome -r
# Reload to make changes effective
- Start awesome automatically
- References
- https://wiki.gentoo.org/wiki/Awesome
less /etc/xdg/awesome/rc.lua
#/modkey
Use "yay"
git clone https://aur.archlinux.org/yay.git ~/.config/yay/
cd ~/.config/yay/; makepkg -si
- Notes
yay
# Replace it with other package name- https://aur.archlinux.org/packages # Get it
makepkg -si
# Enable network proxy to improve the speed before using the commandvim ~/.bash_profile
export http_proxy="192.168.10.100:7890" export https_proxy="192.168.10.100:7890" export no_proxy="localhost, 192.168.10.100"
- Log out and log back to make changes effective
- The abbreviation of "arch user repository" is "aur".
- Because to use AUR to install some software.
- References
Rename file name in batches
for f in *; do mv "$f" "$(echo "$f" | sed 's/230512[0-9]\{6\}/230512seeADentist/g')"; done
- Notes
[0-9]
# One character from this set\
# Escape{6}
# A quantifier
- References
- ChatGPT
- Output
[yaoniplan@tux tmp.8x9UnjDpkt]$ ls IMG20230512081957.jpg REC20230512090514.mp3 [yaoniplan@tux tmp.8x9UnjDpkt]$ for f in *; do mv "$f" "${f:5}"; done [yaoniplan@tux tmp.8x9UnjDpkt]$ ls 230512081957.jpg 230512090514.mp3 [yaoniplan@tux tmp.8x9UnjDpkt]$ for f in *; do mv "$f" "$(echo "$f" | sed ' s/230512[0-9]\{6\}/230512seeADentist/g')"; done [yaoniplan@tux tmp.8x9UnjDpkt]$ ls 230512seeADentist.jpg 230512seeADentist.mp3 [yaoniplan@tux tmp.8x9UnjDpkt]$
Use "systemctl"
doas systemctl enable cronie
doas /etc/init.d/cronie start
- Every time at boot time
doas systemctl start cronie
doas rc-update add cronie default
- Once now
- Notes
cronie
# Replace it with your servicedoas systemctl enable cronie --now
# One command that combines themenable
# Replace it withdisable
to disable
- References
Try some WMs or DEs in VirtualBox
- Window manager
- Bspwm (2023-05-16)
- Awesome (2023-05-16) # A fork of DWM
- DWM (2023-04-05) # Build from source code
- i3 (2022-08-20) # To beginners
- Desktop environment
- Xfce (2023-05-20)
- MATE (2023-05-18)
- Deepin (2023-05-16)
- KDE (2023-05-15)
- GNOME (2022-07-16)
- Window manager
- References
The abbreviation of "Desktop Environment" is "DE".
- A bundle of programs
- Notes
- Aim for beginners
- Out of the box
- References
Use "trans"
trans :zh narrator
- Notes
- Examples
trans -player mpg123 zh:en "$*"
# Translate Pinyin to Englishtrans -player mpg123 :zh "$*" | less -R
# Translate English to Chinese
-speak
# Don't play translation (When NSFW)-no-ansi
# No print ANSI escape codes (e.g.[4m
,[24m
)-engine
# Specify a translation engine-list-engines
# List translation engineszh
# Replace it with country code (e.g. en)trans -list-all
# Get it
-player mpg123
# Change default player to mpg123-proxy 192.168.10.100:7890
# Proxydoas emerge -aq app-i18n/translate-shell
# Install dependenciesnix profile install nixpkgs#translate-shell
# Another method
- Because to learn an unclear word.
- Disadvantages
- Does not support SOCKS5 proxy
- Playback "Translations of " during speech
- Advantages
- Run in terminal
- Examples
- References
The abbreviation of "carbon monoxide" is "CO".
- A gas
- Notes
- Bind to hemoglobin
- Does not carry oxygen
- Feel dizzy
- Bind to hemoglobin
- References
- ChatGPT
- In the fire
- https://en.wikipedia.org/wiki/Carbon_monoxide
The abbreviation of "teletypewriter" is "tty".
- A command
- References
Change shell from zsh to bash in Linux
chsh -s /bin/bash
- Notes
-s
# Shellchsh -l
# List shells-l
# Listcat /etc/shells
# Another way
echo $SHELL
# View the current shelldoas reboot
# Make changes effective
- References
- ChatGPT
man chsh
The abbreviation of "intelligence quotient" is "IQ".
- A score
- Mental age / chronological age
- A score
- References
Redirect all output in Linux
redshift -O 1500 &>/dev/null &
- Notes
&
# Standard output and standard error>
# Redirect/dev/null
# Empty file- Because to run a script silently.
- References
- ChatGPT
man bash
/&>
/dev/null
Use "find"
find . -name "github*"
- Notes
*
# Zero or more- Filter
-type d
# Directory-type f
# File
- Another way
find /mnt/grow/ -type d | grep -i books
find /mnt/yaoniplan/ | grep -i speed
- Delete hidden files
find . -type f -name '.*' -delete
- Delete a file that cannot be deleted using
rm
# Get the index number (e.g. 20447344) of the file ls --inode # Use find with the inode number to remove the file find . -type f -inum 20447344 -exec rm {} \;
- Move all FLV files in subdirectories to the current directory
find . -maxdepth 2 -type f -name "*.flv" -exec mv {} . \;
- Move all files in subdirectories to the current directory
find {01..08}/ -maxdepth 1 -type f -exec mv {} . \;
{01..08}/
# Replace it with your subdirectory
- Delete files and directories older than 30 days
find "$trashDir" -mindepth 1 -ctime +30 -delete
-ctime
# Changed time
- References
man find
#/^ *-ctime
- ChatGPT
Understand "Dreaming of Home and Mother"
- Melody of English
- Lyrics of Japanese
- Translate it to Chinese
- References
- https://en.wikipedia.org/wiki/Songbie
- https://www.youtube.com/watch?v=vdm7845EW8M # English version
- https://www.youtube.com/watch?v=ak7IfDqvaPY # Japanese version
Insert paragraphs into the top of a file in sed
sed -i '1i\ <!DOCTYPE html>\ <html>\ <head>\ <meta name="viewport" content="width=device-width, initial-scale=1">\ <title>yaoniplan</title>\ <link rel="stylesheet" href="../assets/github-markdown-dark.css">\ <style>\ .markdown-body {\ box-sizing: border-box;\ min-width: 200px;\ max-width: 980px;\ margin: 0 auto;\ padding: 45px;\ }\ @media (max-width: 767px) {\ .markdown-body {\ padding: 15px;\ }\ }\ </style>\ </head>\ <body>\ <article class="markdown-body">' ~/note/index.html
- Notes
-i
# In place1
# The first linei
# Insert\
# Escape the newline character- No space after backslash
~/note/index.html
# Replace it with your index.html- Because to convert Markdown to HTML.
- References
- ChatGPT
man sed
Rename file in Perl
perl -e 'foreach $file (glob("B站*")) { $newname = $file; $newname =~ s/B站-?//g; rename $file, $newname; }'
- Notes
-e
# Executeglob
# Global?
# Zero or one- Another way
for f in B站*; do mv "$f" "$(echo "$f" | sed -E 's/B站-?//g')"; done
-E
# Extended
- References
- ChatGPT
man sed
perldoc -f rename
-f
# Function
Use "bash"
if [[ -z "$fileName" ]]; then
# Check if the file name is emptyif [[ -x /usr/bin/rsync ]]; then
while true; do smplayer 'yourURL' && [[ $? -eq 0 ]]; done
- Execute the command until it succeeds
Ctrl-c
# Stop it
if [[ n -eq 42 ]]; then
- Notes
-z
# Zero (The length of string)-x
# Exist and executable$?
# Exit status-ne
# Not equaln
# A variable name-eq
# Equalif [[ -n "$1" ]]; then
-n
# Not empty
- References
man bash
#/-eq
/^condition
/-z
- ChatGPT
Use "Spacemacs" in Emacs
SPC f t
# File treeSPC x y
# Yank after selecting a regionvim ~/.spacemacs
# OrSPC f e d
;; List of configuration layers to load. dotspacemacs-configuration-layers '((xclipboard :variables xclipboard-enable-cliphist t))
C-c C-o
# Open URLSPC m RET
SPC m f
SPC /
# Search stringSPC s p
# Search project
emacs
# Start
- Notes
RET
# Return keySPC
# Space keydoas emerge -aq app-editors/emacs
# Install in Gentoo Linuxgit clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
- References
Enable dark mode for PDF file in Firefox
Ctrl-Shift-i
# Paste it in "Console"// When using in-browser PDF viewer, you can inspect it and run this in the console // It's using CSS Blending to invert the colors of the PDF function togglePDFDarkMode() { var cover = document.createElement("div"); let inversion = ` position: fixed; pointer-events: none; top: 0; left: 0; width: 100vw; height: 100vh; background-color: white; mix-blend-mode: difference; z-index: 1; ` if (document.body.contains(cover)) { document.body.removeChild(cover); } else { cover.setAttribute("style", inversion); document.body.appendChild(cover); } } togglePDFDarkMode();
- References
Enable Vi mode in Python interpreter
Ctrl-Alt-j
- Notes
vim ~/.inputrc
# Another wayset editing-mode vi
- References
Clear the Python interpreter in Linux
Ctrl-l
- Notes
- Another way
>>> import os >>> os.system('clear')
- Because to clear the screen like in Linux.
- Another way
- References
Load a file into the Python interpreter
python -i testCard.py
- Notes
-i
# Interactive
- References
Use "opencc"
for f in *.mp4; do mv "$f" "$(echo "$f" | opencc -c t2s.json)"; done
- Notes
for f in 围棋第*; do mv "$f" "$(echo "$f" | opencc -c cn2an.json)"; done
# Convert Chinese numbers to Arabic numbersvim ./cn2an.json
{ "name": "Traditional Chinese to Simplified Chinese", "segmentation": { "type": "mmseg", "dict": { "type": "ocd2", "file": "TSPhrases.ocd2" } }, "conversion_chain": [{ "dict": { "type": "group", "dicts": [{ "type": "ocd2", "file": "TSPhrases.ocd2" }, { "type": "ocd2", "file": "TSCharacters.ocd2" }, { "type": "text", "file": "./cn2an.txt" }] } }] }
vi ./cn2an.txt
# Use the tab key between them一 1 二 2 三 3 四 4 五 5 六 6 七 7 八 8 九 9 十 10
-c
# Confignix profile install nixpkgs#opencc
# Install dependencies- Because to convert file names from Traditional Chinese to Simplified Chinese.
- References
- https://github.com/BYVoid/OpenCC/issues/198#issuecomment-276880744
opencc --help
- ChatGPT
Use "ffmpeg"
ffmpeg -i 5ac9704e-c8fc-4445-bc3c-db640271898d-B.mp4 -c:v libx265 -crf 28 -preset slow -c:a aac -b:a 128k 招生专业名称:计算机类.mp4
# Compress a file without losing much quality-c:v
# Set video codec to libx265 (HEVC encoder: higher compression rate than H.264)-crf
# Set Constant Rate Factor to 28 (Higher value result in lower quality and smaller file size)-preset
# Set encoding preset to slow (Prioritize compression efficiency over encoding speed)-c:a
# Set audio codec to AAC (Good balance of quality and compression efficiency)-b:a
# Set audio bitrate to 128 kbps
ffmpeg -i 231012seeADentist.m4a 231012seeADentist.mp3
# Convert M4A to MP3 formatfor f in *.mp4; do ffmpeg -i "$f" "${f%.mp4}.mp3"& done
# In batches%
# Remove extension (e.g..mp4
)&
# In the background
ffmpeg -f v4l2 -i /dev/video0 output.mp4
# Capture video from cameraffplay -f v4l2 /dev/video0
# Display the video on screen
ffmpeg -i input.wma -ss 00:00:25 -c copy output.wma
# From 00:00:25 to the endffmpeg -i input.wma -ss 00:00:00 -to 00:15:37 -c copy output.wma
# Cut a sectionffmpeg -f concat -safe 0 -i fileList.txt -c copy output.wma
# Merge videosvi fileList.txt
file 'output01.wma' file 'output02.wma'
- Notes
-i
# Input-ss
# Specify starting-f
# Formatconcat
# Concatenate- Because to remove a commercial.
- References
man ffmpeg
- ChatGPT
Use "sed"
sed '$agit -C /root/.config/note/ pull o rigin development' ~/.profile
# Append string to the last line$
# Match the last line (3
: The third line)a
# Append
sed -i '5s/$/ \&/' .profile
# Append the string at the end of the linesed -i '1i#EXTM3U' "$playlist_file"
# Insert#EXTM3U
at the beginning of filesed -i '5,7d' ~/.ssh/config
# Delete the fifth through seventh lines from a file-i
# In place (Without it, just simulate first)d
# Delete- (
5d
: The fifth,$d
: The last,5d;7d
: Both the fifth and seventh) /SOCKS5_SERVER\|SOCKS5_PORT/d
# Delete the line containing "SOCKS"
sed -i 's/dotfilels/dotfiles/g' ~/.bashrc
# Substitute (e.g. Correct spelling)- (
3s
: Text in the third line)
- (
for f in *.wma; do mv "$f" "$(echo "$f" | sed 's/第....//g')"; done
.
# Any single character
- Notes
- Get number line
cat --number ~/.ssh/config
# Number all output linesnl ~/.ssh/config
# Number lines (Except blank lines)- Because suitable for files with fewer lines in teaching
for f in *; do mv "$f" "$(echo "$f" | sed -E 's/([1][3-9]|[2][0-4])/echo $((\1-12))/ge')"; done
# Subtract 12 from the numbers 13 to 24([1][3-9]|[2][0-4])
# Match numbers 13 to 24e
# Arithmetic expression (e.g.$((\1-12))
)
for f in *; do mv "$f" "$(echo "$f" | sed 's/ //g')"; done
# Remove all spaces in file names- Because to modify file name in batches.
- Get number line
- References
man sed
#/delete
- ChatGPT
The abbreviation of "Stream Editor" is "sed".
sh semester | grep --ignore-case "date" | sed 's/date: //g' > ~/last-modified.txt
- Notes
echo '#!/usr/bin/env bash' > semester
- Surround "!" with single quotes to solve the problem
-bash: !/usr/bin/env: event not found
- Surround "!" with single quotes to solve the problem
- References
man sed
cat semester
#!/usr/bin/env bash curl --head --silent https://google.com
cat ~/last-modified.txt
Sat, 29 Apr 2023 01:21:44 GMT
- https://missing-semester-cn.github.io/2020/course-shell/
View temperature of CPU in Linux
cat /sys/class/thermal/thermal_zone0/temp
- Notes
34000
# Millidegrees Celsius- 34000 / 1000 = 34
- References
- ChatGPT
Use "npm"
npm install --global marked
# Install a package
- Notes
--registry https://npmreg.proxy.ustclug.org/
# temporarilyvi ~/.npmrc
# Set a mirrorregistry=https://npmreg.proxy.ustclug.org/
npm get registry
# Get the current registry URL- Because to improve the speed. (e.g.
npm install express
)
npm uninstall -g marked-katex-extension
# Uninstallnpm list -g
# List installed packages
- Install dependencies
emerge -aq net-libs/nodejs
# Install in Gentoo Linuxpacman -S npm
# Install in Arch Linux
- Because to convert Markdown to HTML in script.
marked -i yaoniplan.md -o yaoniplan.html
- Solve the problem
npm error code ERR_INVALID_URL npm error Invalid URL
- Add
http://
to your proxy
- Add
- Solve the problem about SQLite3
npm uninstall sqlite3
npm --force cache clean
npm install sqlite3
- References
- https://stackoverflow.com/questions/69768980/how-to-resolve-code-err-invalid-url-in-angular-cli-installation/69838005#69838005
- https://mirrors.ustc.edu.cn/help/npm.html
- https://discuss.codecademy.com/t/problem-installing-sqlite3/434837/26
- https://github.com/markedjs/marked
npm help install
#/-g
man npm
# Node package manager- ChatGPT
Start Ubuntu Server 22.04 automatically when connecting to power
- Set options in BIOS
- Notes
- Warning: I did not find the relevant options, maybe the computer is too low-level.
- References
Use todo in dmenu
height=$(wc -l "$file" | awk '{print $1}')
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
while [ -n "$cmd" ]; do
if grep -q "^$cmd\$" "$file"; then
- Notes
-l
# Lines-p
# Prompt$@
# All arguments<
# Redirect input to command-n
# Not empty-q
# Quiet^
# The beginning of a line\
# Escape character$
# The end of a line-v
# Invert
- References
- ChatGPT
help test
- https://tools.suckless.org/dmenu/scripts/todo
The abbreviation of "Random Access Memory" is "RAM".
- Store date temporarily
- The computer is currently using
- Store date temporarily
- References
The abbreviation of "Central Processing Unit" is "CPU".
- A brain
- Notes
- Has multiple cores
- Generate heat
- A cooling system
- References
- ChatGPT
Protect spine #idea
- When looking up
- Pull the chin up
- When pressing the neck
- Rotate to that hand
- Surrounding the shoulder joint
- Shake hands, directly in front of shoulder joint
- Pull elbows up to the top
- Pull apart on both sides
- When looking at the phone
- Put elbow ten centimeters forward
- Bring elbow close to the chest muscles
- When looking at computer
- Keep elbows directly below shoulder joint
- Let eyes look at the top line
- When looking up
- Notes
- Don't bow the head
- Because it compresses the spine.
- Don't bow the head
- References
Understand tuberculosis
- A sickness
- Notes
- Bacteria
- Crowded or dirty places
- A weak immune system
- Bacteria
- References
Enable ccache in Gentoo Linux
doas emerge dev-util/ccache
doas vim /etc/portage/make.conf
FEATURES="ccache" CCACHE_DIR="/var/cache/ccache"
- Notes
doas vim /var/cache/ccache/ccache.conf
max_size = 100.0G umask = 002 hash_dir = false compiler_check = %compiler% -dumpversion cache_dir_levels = 3 compression = true compression_level = 1
ccache -s
# Show statistics- Because to continue to compile Chromium when the compilation fails.
- References
- ChatGPT
ccache --help
- https://wiki.gentoo.org/wiki/Ccache
Use "reader"
vim ~/.config/reader/docker-compose.yml
version: '3.1' services: reader: image: hectorqin/reader:openj9-latest container_name: reader restart: always ports: - 4396:8080 volumes: - ~/.config/reader/logs:/logs - ~/.config/reader/storage:/storage environment: - SPRING_PROFILES_ACTIVE=prod - READER_APP_CACHECHAPTERCONTENT=true
- Notes
- Warning: The user experience is poor compared to novel and comic websites.
docker-compose up --detach
# Run in the background192.168.10.100:4396
# Run in Chromium- Support webview
- READER_APP_REMOTEWEBVIEWAPI=http://readerwebview:8050 readerwebview: image: hectorqin/remote-webview container_name: readerwebview restart: always environment: - TZ=Asia/Shanghai volumes: reader: readerwebview:
- References
Remove the notification of full screen in Firefox
- Change the value from "3000" to "0"
full-screen-api.warning.timeout
- Change the value from "3000" to "0"
- Notes
- Because to be quiet.
- References
about:config
- ChatGPT
Replace menuconfig with nconfig in Linux
doas make nconfig
- Notes
cd /usr/src/linux/
# Change into the Linux source directory before usingCtrl-[
# Esc keyCtrl-j
# Enter key- Because modifying kernel options is more friendly.
- Dark mode
- Exact search mode
- References
- ChatGPT
- Fn-1
Enable "~amd64" for Gentoo Linux
doas vim /etc/portage/make.conf
ACCEPT_KEYWORDS="~amd64"
- Notes
doas emerge --sync
# Update the package listdoas emerge -avuDN @world
# Upgrade the system to the latest versiondoas reboot
# Make changes effective- Warning: This will become unstable unless you are an adventurer.
- References
Use "memos"
vim ~/.config/memos/docker-compose.yml
version: "3.0" services: memos: image: neosmemo/memos:latest container_name: memos restart: always volumes: - ~/.config/memos/:/var/opt/memos ports: - 5230:5230
docker-compose up --detach
# Run in the background
- Notes
- Warning: It takes 10-15 seconds to open the homepage.
- https://github.com/search?q=repo%3Ausememos%2Fmemos+slow&type=issues
- Believe that latecomers (Author, you, or me) can change this situation
- Use JavaScript
- Double click to enter edit mode
// Load jQuery from CDN var script = document.createElement('script'); script.src = 'https://code.jquery.com/jquery-3.6.4.min.js'; document.head.appendChild(script); // Define actions after jQuery is loaded script.onload = function() { // Use jQuery ready function $(function() { // Use event delegation for dynamic elements $('body').on('dblclick', '.memo-wrapper .text-base, .memo-wrapper .more-action-btn', function() { var btn = $(this).closest('.memo-wrapper').find('.more-action-btns-container .btn:nth-child(2)'); btn.click(); // Use setTimeout function for timeout setTimeout(function() { $('.dialog-container textarea.text-base').focus(); }, 200); }); }); };
- Double click to enter edit mode
- Send a request using curl
curl --request POST http://192.168.10.100:5230/api/v1/memo \ --header "Content-Type: application/json" \ --header "Authorization: Bearer yourAccessToken" \ --data '{"content":"Hello, World!"}'
192.168.10.100:5230
# Run in Chromium
- Warning: It takes 10-15 seconds to open the homepage.
- References
Use "microbin"
vim ~/.config/microbin/docker-compose.yml
version: '3' services: microbin: image: danielszabo99/microbin container_name: microbin restart: always ports: - "31000:8080" volumes: - ./microbin_data:/app/microbin_data command: ["--highlightsyntax", "--private"]
docker-compose up --detach
# Run in the background
- Notes
- Warning: Feature copy text does not work
192.168.10.100:31000
# Run in web browser
References
Disable a service at boot time in Ubuntu Sever 22.04
doas systemctl disable apache2
- Notes
doas systemctl stop apache2
# Stop it before disablingapache2
# Replace it with your desired service
- Because to solve a problem about "address already in use".
- References
- ChatGPT
Check some installed packages in Gentoo Linux
qlist -I
- Notes
-I
# Installed- Because to remove unnecessary packages to reduce the time that compile system.
- References
- ChatGPT
Buy some eggs in supermarket
- Check the expiration date
- A bright yolk and a firm egg white
- Make sure the yolk doesn't move around by gently shaking
- The clean shell and free of cracks
- Pick them from the coldest place
- Check the expiration date
- Notes
- Store After buying eggs
- In original carton
- In the fridge
- Because there are many benefits of eating eggs.
- Rich in nutrients: The protein for muscles, vitamin D for bones, and fats for disease (e.g. heart, inflammation, etc.)
- Manage weight: A low-calorie food, and make you feel fuller
- Store After buying eggs
- References
- ChatGPT
Delete the current file in Vim
:!mv % /tmp
- Notes
:
# Command mode!
# Execute in a shellmv
# Move%
# Current file name/tmp
# Temporary directory- Because to iterate over outdated files.
- References
- ChatGPT
Improve the website speed of yaoniplan.eu.org
- Lazy load images
- References
- ChatGPT
Use "docker-compose"
vim ~/.config/clash/docker-compose.yml
version: '3.7' services: clash: image: dreamacro/clash:latest container_name: clash restart: always volumes: - ~/.config/clash:/root/.config/clash ports: - 7890:7890 - 7891:7891 - 9090:9090 clash_dashboard: image: haishanh/yacd:latest container_name: clash_dashboard restart: always depends_on: - clash ports: - 9091:80
docker-compose up --detach
# Run in the background
- Notes
vim ~/.config/note/docker-compose.yml
# Build an image locally (To get speed and stability)services: note: build: . container_name: note restart: always ports: - 2003:80
build: .
# Replace it withimage: yaoniplan/note:latest
to pull from a Docker registry
- Access the shell of the container
docker-compose exec yourApp sh
- Update a Docker image (Depend on your docker-compose.yml)
docker-compose pull
# Pull a remote imagedocker-compose build
# Build a local imagedocker-compose up --detach
--file ~/.config/departmentStore/compose.yaml
# Use absolute path
docker-compose logs
# View logsdocker-compose stop
# Stopdocker-compose down
# Stop and remove containersdocker-compose restart
# Restartdoas apt install docker-compose
# Install it after installing Dockerlatest
# Latest tag~/.config/clash
# Replace it with your path of the config.yaml file- In Chromium
192.168.10.100:9091
# The clash dashboardvim ~/.config/clash/config.yaml
# Solve a problem about "Failed to connect" of "API Base URL"external-controller: 0.0.0.0:9090
- In Gentoo Linux
vim ~/.bash_profile
export http_proxy="192.168.10.100:7890" export https_proxy="192.168.10.100:7890" export no_proxy="localhost, 192.168.10.100"
- In Android
# HTTP Manual # Proxy settings 192.168.10.100 # Proxy hostname 7890 # Proxy port # SOCKS5 192.168.10.100 # Server 7891 # Port
- Solve the problem
WARN[0000] /home/yaoniplan/parse/docker-compose.yml: `version` is obsolete
sed -i '1d' ~/parse/docker-compose.yml
# Delete the first line containing 'version'
- Because to run the network proxy tool in the server.
- References
docker compose --help | less
docker-compose up --help | less
- https://blog.n-z.jp/blog/2024-04-02-docker-compose-yaml-version.html
- https://www.aimeow.com/zai-ubuntu-serverzhong-tong-guo-docker-composebu-shu-clash/
- https://blog.vicat.top/archives/linux通过clash来科学上网#2-正戏进阶
- ChatGPT
The abbreviation of "GNU Privacy Guard" is "GPG".
- A software
- Notes
- Because to encrypt private files.
- References
Use "gpg"
gpg --gen-key
# Generate key pair- Type your name, email, and passphrase
gpg --output public.key --armor --export yaoniplan@gmail.com
# Export publick key to a filegpg --recipient yaoniplan@gmail.com --encrypt 2023-03-22.tar.gz
# Encrypt file
- Notes
passphrase
# Strong, otherwise it will not passyaoniplan@gmail.com
# Replace it with your email
- References
man gpg
- ChatGPT
Enable the browser toolbox mode in Firefox
- Set them to true
devtools.chrome.enabled devtools.debugger.remote-enabled
Ctrl-Shift-Alt-i
# Open the Browser Toolbox
- Set them to true
- Notes
vim ~/.mozilla/firefox/bfh7z5di.default-release/chrome/userChrome.css
# Example/* Hide forward button */ #forward-button { display: none !important; }
- Because to customize the Firefox theme with CSS.
- References
about:config
- ChatGPT
- https://www.youtube.com/watch?v=bw_M7q3Mtag
Hide toolbox automatically in Firefox
vim ~/.mozilla/firefox/3y390lx5.default-release/chrome/userChrome.css
:root{ --uc-autohide-toolbox-delay: 200ms; /* Wait 0.1s before hiding toolbars */ --uc-toolbox-rotation: 82deg; /* This may need to be lower on mac - like 75 or so */ } :root[sizemode="maximized"]{ --uc-toolbox-rotation: 88.5deg; } @media (-moz-platform: windows), (-moz-os-version: windows-win7), (-moz-os-version: windows-win10){ #navigator-toolbox:not(:-moz-lwtheme){ background-color: -moz-dialog !important; } } :root[sizemode="fullscreen"], #navigator-toolbox[inFullscreen]{ margin-top: 0 !important; } #navigator-toolbox{ position: fixed !important; display: block; background-color: var(--lwt-accent-color,black) !important; transition: transform 82ms linear, opacity 82ms linear !important; transition-delay: var(--uc-autohide-toolbox-delay) !important; transform-origin: top; transform: rotateX(var(--uc-toolbox-rotation)); opacity: 0; line-height: 0; z-index: 1; pointer-events: none; } /* #mainPopupSet:hover ~ box > toolbox, */ /* Uncomment the above line to make toolbar visible if some popup is hovered */ #navigator-toolbox:hover, #navigator-toolbox:focus-within{ transition-delay: 33ms !important; transform: rotateX(0); opacity: 1; } #navigator-toolbox > *{ line-height: normal; pointer-events: auto } #navigator-toolbox, #navigator-toolbox > *{ width: 100vw; -moz-appearance: none !important; } /* These two exist for oneliner compatibility */ #nav-bar{ width: var(--uc-navigationbar-width,100vw) } #TabsToolbar{ width: calc(100vw - var(--uc-navigationbar-width,0px)) } /* Don't apply transform before window has been fully created */ :root:not([sessionrestored]) #navigator-toolbox{ transform:none !important } :root[customizing] #navigator-toolbox{ position: relative !important; transform: none !important; opacity: 1 !important; } #navigator-toolbox[inFullscreen] > #PersonalToolbar, #PersonalToolbar[collapsed="true"]{ display: none }
- Notes
about:config
toolkit.legacyUserProfileCustomizations.stylesheets
# Set to "true"
about:profiles
cd ~/.mozilla/firefox/3y390lx5.default-release/
mkdir chrome/
- Put userChrome.css file into chrome/ directory
- Close the Firefox and then open it # Make the changes effective
- Because to get more space when not focused.
Ctrl-l
# Focus it- It is better to combine the oneliner mode.
- References
Write a function in Bash
vim ~/.local/bin/remindMe.sh
notification() { sleep "$1" notify-send "$notificationMessage" & for i in {1..2}; do paplay "$audioFile" done }
- Notes
- Before defining the function
# Set variables notificationMessage="Time is up!" audioFile="/home/yaoniplan/note/assets/doorbell.mp3"
- After defining the function
# Call the function notification "$1"
- Surround variables with double quotes
"$1"
"$notificationMessage"
"$audioFile"
- Before defining the function
- References
- ChatGPT
Call a Bash function in another file
vim ~/.local/bin/master.sh
notification() { notify-send "$notificationMessage" & for i in {1..2}; do paplay "$audioFile" done }
vim ~/.local/bin/remindMe.sh
notificationMessage="Time is up!" audioFile="/home/yaoniplan/note/assets/doorbell.mp3" source $HOME/.local/bin/master.sh sleep "$1"; notification
- Notes
source $HOME/.local/bin/master.sh
# Source the filechmod u+x ~/.local/bin/master.sh
- Use full path to avoid errors when souce a file
- Because to improve the code reusability.
- References
- ChatGPT
Decompress a ".tar.bz2" file in Linux
tar --bzip2 -xf aspell6-en-2020.12.07-0.tar.bz2
- References
man tar
- ChatGPT
Act as an IT expert in ChatGPT
I want you to act as an IT Expert. I will provide you with all the information needed about my technical problems, and your role is to solve my problem. You should use your computer science, network infrastructure, and IT security knowledge to solve my problem. Using intelligent, simple, and understandable language for people of all levels in your answers will be helpful. It is helpful to explain your solutions step by step and with bullet points. Try to avoid too many technical details, but use them when necessary. I want you to reply with the solution, not write any explanations. My first problem is
- Notes
- My next problem is "Explain the meaning of 'IT'"
- Because to get accurate results whthin a range.
- References
The abbreviation of "information technology" is "IT".
- A branch of computer science
- References
Understand "crocodile tears"
- A display
- Emotion
- A display
- Notes
- Pretend to be sad
- Shed fake tears
- References
- TEAM PLAY # TEAM, P, and LAY #NSFW
- https://en.wikipedia.org/wiki/Crocodile_tears
Change the temporary directory in one-liner of Linux
cd $(mktemp -d)
- Notes
mktemp
# Make a temporary file-d
# Directory- Because to test an urgent command.
- References
man mktemp
- ChatGPT
Replace spaces in all filenames with underscores in one-liner of Linux
for f in *; do mv "$f" "$(echo "$f" | sed 's/ /_/g')"; done
- Notes
- Because it is more convenient to read in terminal.
- References
- ChatGPT
Set the default application in Linux
xdg-mime default feh.desktop image/png
- Notes
feh.desktop
# Get the applicationls /usr/share/applications/
image/png
# Replace it with other MIME typexdg-mime query filetype /path/to/image.png
# Method onefile --mime /mnt/grow/230811seeADentist.jpg
# Method two
- Another way
xdg-settings set default-web-browser firefox.desktop
- Because to use the Feh program to view images.
- It is more convenient in VimWiki.
q
# Quit
xdg-settings get default-web-browser
# View default browser- Because to use the command
xdg-open https://yaoniplan.eu.org
.
- Because to use the command
- References
- ChatGPT
The abbreviation of "not safe for work" is "NSFW".
- A slang
- To warn
- References
Open the history sidebar in Firefox
Ctrl-h
- Notes
- Because to remove focus of search bar.
- References
- ChatGPT
Use "stat"
stat b.txt
- Notes
b.txt
# Replace it with a file name- Because to know how long the crawler script has been working.
- View the creation time (Birth day) of a file
- References
- ChatGPT
Set DPI in Firefox
layout.css.devPixelsPerPx
- 1.2
- Notes
1.2
# Replace it with your desired DPI- Because to make web content more readable.
- References
about:config
- ChatGPT
View a list of "about" pages in Firefox
about:about
- Notes
- Because to quickly view some commonly used "about" pages.
about:config
about:preferences
# Type 'version' to check itabout:addons
about:profiles
about:privatebrowsing
# Then click 'Open a Private Window'Ctrl-Shift-p
# The same as the action above
- Because to quickly view some commonly used "about" pages.
- References
- ChatGPT
Set the file type for a file in Vim
:set filetype=c
- Notes
c
# C programming language- Turn off the file type
set filetype=off
- Because to make the following file code more readable.
doas vim /etc/portage/savedconfig/x11-wm/dwm-6.3
- References
Extract a ".rar" file in Linux
rar x userChromeForFirefox.rar /tmp/testRAR/
- Notes
- Another method
cd $(mktemp -d); unar -o . ~/basicEnglishVoice.rar
nix shell nixpkgs#unar
# Install dependencies
- Warning: The rar software is unfree.
x
# Extract/tmp/testRAR/
# Replace it with your desired decompression pathdoas emerge -aq app-arch/rar
# Install it in Gentoo Linux- Extract a ".exe" file in Linux
rar x ximaBooks1-100.exe ./001_100/
- Another method
- References
- ChatGPT
rar -? | less
Patch for DWM in Gentoo Linux
- Patch in /etc/portage/patches/x11-wm/dwm/
doas mkdir -p /etc/portage/patches/x11-wm/dwm doas cp 01-dwm-scratchpad-20221102-ba56fe9.diff /etc/portage/patches/x11-wm/dwm doas emerge -q x11-wm/dwm
Alt-Shift-q
# Quit the DWM to make the changes effective
- Patch in /etc/portage/patches/x11-wm/dwm/
- Notes
- Maybe need to edit the following file manually
doas vim /etc/portage/savedconfig/x11-wm/dwm-9999
/* Solve a problem about `scratchpadname` and `togglescratch` */ static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "97x16", NULL }; { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
- Maybe need to edit the following file manually
- References
The abbreviation of "window manager" is "WM".
- A software
- Notes
- Because trying to use DWM after using i3.
D
# Dynamic
- Because trying to use DWM after using i3.
- References
Use "dmenu" in Gentoo Linux
rm ~/.cache/dmenu_run
# Clear cache to refreshCtrl-y
# Paste- Change the font size
static const char *fonts[] = { "monospace:size=23" };
- Notes
doas vim /etc/portage/package.use/zz-autounmask
# Save configuration after reinstalling # Required by /etc/portage/savedconfig/x11-misc/dmenu x11-misc/dmenu savedconfig
doas emerge -q x11-misc/dmenu
# Make the changes effective
Change naming rules from "2023-04-05_10:27:31" to "2023-04-05_10-27". #idea
Colon
# Need escape character31
# Minutes are enough
The abbreviation of "Uniform Resource Locator" is "URL".
https://yaoniplan.eu.org/index.html
- Notes
https
# A protocolyaoniplan.eu.org
# A hostnameindex.html
# A filename
- References
The abbreviation of "Hypertext Transfer Protocol Secure" is "HTTPS".
- An extension of "HTTP"
- A protocol
- An extension of "HTTP"
- References
The abbreviation of "Unix System Resources" is "usr".
- A directory
- In Unix-like operating system
- References
- ChatGPT
Being cultivated and used by Bole, Maxima will maximize its value. #idea
- References
- Lupine the Third
Use "DWM" in Gentoo Linux
Alt-b
# Show or close the status barAlt-Shift-c
# Kill a windowAlt-leftMouse
# Drag windowAlt-rightMouse
# Resize windowAlt-middleMouse
# Restore the previous state after draggingAlt-Tab
# Switch to previous workspaceAlt-Shift-Enter
# New a terminalAlt-Shift-q
# Quit the DWMAlt-2
# Go to the number 2 workspaceAlt-p
# Run the dmenu- Layout of workspace
Alt-t
# TiledAlt-f
# FloatingAlt-m
# Monocle
Alt-Enter
# Toggle windows between master and stackAlt-d
# DecreaseAlt-i
# Increase
- Notes
doas vim /etc/portage/package.use/zz-autounmask
# Save configuration after reinstalling # Required by /etc/portage/savedconfig/x11-wm/dwm x11-wm/dwm savedconfig
vim ~/.xprofile
# Excute automatically when start X11 session redshift -O 1500 & feh --bg-fill /home/yaoniplan/note/assets/dark.jpg & clash &
doas vim /etc/portage/savedconfig/x11-wm/dwm-9999
/* Change the terminal command from `st` to `kitty tmux` */ static const char *termcmd[] = { "kitty", "tmux", NULL }; /* Disable status bar */ static const int showbar = 0; /* Disable border of windows */ static const unsigned int borderpx = 0; /* Bind shorcut keys "Alt-Shift-l" to programs command `slock` */ static const char *slockcmd[] = { "slock", NULL }; static Key keys[] = { { MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } }, }; /* Assign applications to workspace */ static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating monitor */ { "Chromium-browser-chromium", "chromium-broser-chromium", NULL, 1, 0, -1 }, };
doas emerge -q x11-wm/dwm
# Recompile it to make the changes effective
- Use "brightnessctl"
brightnessctl set 20%
# Adjust brightness to 20%nix profile install nixpkgs#brightnessctl
# Install dependencies
- References
The abbreviation of "full high definition" is "FHD".
- A graphics display resolution
- 1920x1080 pixels
- Notes
1920
# Width1080
# Height- The abbreviation of "quad high definition" is "QHD".
- Because this abbreviation can be seen on some website video players.
- References
The abbreviation of "Bourne Again Shell" is "Bash".
- Born again
- References
Enable support for ANSI escape codes when using the less command
curl wttr.in | less -R
- Notes
-R
# Raw
- References
man less
- ChatGPT
Use wget to download files to the specified directory
vim ~/.local/bin/getWeatherInformation.sh
# Create a temporary directory to store the file temporaryDir=$(mktemp --directory) # Download the weather image and save it to the temporary directory wget -P "$temporaryDir" "https://wttr.in/$city.png"
- Notes
-P
# Prefix
- References
man wget
- ChatGPT
Delete all workflows of GitHub Actions
#Current.iim
VERSION BUILD=1011 RECORDER=CR SET !LOOP 2 ' Do something with the current data source line, such as filling out a form field TAG POS=1 TYPE=SUMMARY ATTR=TXT:Delete<SP>workflow<SP>run TAG POS=1 TYPE=BUTTON FORM=ACTION:/yaoniplan/note/actions/runs/* ATTR=TXT:Yes,<SP>permanently<SP>delete<SP>this<SP>workflow<SP>run WAIT SECONDS=3 ' End the loop SET !LOOP EVAL("{{!LOOP}}-1000")
- Click "Record Macro" button to start recording
- Click the "Save Page" button to save it
- Click the "Play Loop" button to start the loop
- Notes
- Warning: The extension does not work. (2023-09-01)
yaoniplan/note
# Replace it with your user name and repository name3
# Replace it with your desired waitting seconds- Install an extension named "iMacros" if you don't have it
- Disadvantage
- Take about 3 hours if you have three thousand workflows
- Advantage
- Click automatically
- Run it in FireFox when you are using Chromium
- References
- ChatGPT
Install package with version "9999" in Gentoo Linux
doas vim /etc/portage/package.accept_keywords
media-video/mpv **
doas emerge -aq media-video/mpv
- References
Disable quick find in Firefox
- Set the following option to "false"
accessibility.typeaheadfind accessibility.typeaheadfind.autostart accessibility.typeaheadfind.manual
- Set the following option to "false"
- Notes
- Because to use a extension named Vimium C.
- References
about:config
- https://support.mozilla.org/en-US/questions/1273459
The abbreviation of "pickup artist" is "PUA".
- Inner game
- Understanding of psychology
- Confidence
- Self-esteem
- Social skills
- Physical fitness
- Fashion sense
- grooming
- Outer game
- Interactive
- Inner game
- Notes
- A woman
- A target
- A process
- A game
- Raise his own value and lower her value
- A strategy
- A woman
- References
- Lupine the Third
- https://en.wikipedia.org/wiki/Pickup_artist
The abbreviation of "chief executive officer" is "CEO".
- Sam Altman is the CEO of OpenAI.
- References
The abbreviation of "Thursday" is "Thu".
- The god of thunder
- Mythological figures
- Jupiter
- Celestial bodies
- The fourth day of the week
- The god of thunder
- Notes
- Because weather apps display this abbreviation.
- References
- ChatGPT
Read input of a user in Bash
read -p "Enter a city name: " city
- Notes
-p
# PromptEnter a city name:
# Replace it with your desired prompt messagecity
# Replace it with your desired variable name- Because to write a application to get weather information.
- References
read --help
- ChatGPT
The abbreviation of "International Criminal Police Organization" is "ICPO".
- References
- Lupine the Third
- https://en.wikipedia.org/wiki/Interpol
Run an ".AppImage" file in Linux
./Cursor-0.1.9.AppImage
- Notes
Cursor-0.1.9.AppImage
# Replace it with your desired appimagechmod u+x Cursor-0.1.9.AppImage
# Make it executable if permission denied./Cursor-0.1.9.AppImage --appimage-extract
# Solve the problemyaoniplan@tux ~ $ ./Cursor-0.1.9.AppImage dlopen(): error loading libfuse.so.2 AppImages require FUSE to run. You might still be able to extract the contents of this AppImage if you run it with the --appimage-extract option. See https://github.com/AppImage/AppImageKit/wiki/FUSE for more information
./squashfs-root/AppRun
- References
- ChatGPT
Run a command 20 times in one-liner Bash
for times in {1..20}; do treeLike.sh note/; done
- Notes
times
# Replace it with your desired variable name20
# Replace it with your desired timestreeLike.sh note/
# Replace it with your desired command- Because to test whether the changes takes effect when run the following command
vim ~/.tmux.conf
# Retain more history when scrolling up set -g history-limit 50000
tmux source-file ~/.tmux.conf
- References
- ChatGPT
Correct the format of JavaScript code
- Notes
- Use "js-beautify"
wl-paste | js-beautify
# Format codeuv tool install jsbeautifier
# Install dependencies
- Because to make the code more readable
- marked.min.js
- Use "js-beautify"
- References
- ChatGPT
Understand the "infinite monkey theorem"
- Infinite time
- Monkey hit keys
- Shakespeare's Hamlet
- Notes
- Events with nonzero probability almost surely occur
- References
Install PHP in Linux
doas emerge dev-lang/php
# In Gentoo Linuxdoas apt install php
# In Ubuntu Server 22.04
- Notes
- Sovle the problem "/bin/bash: line 1: php: command not found"
- References
- ChatGPT
The abbriviation of "Transport Layer Security" is "TLS".
- A protocol
- Notes
- Because to redirect all requests from HTTP to HTTPS.
- References
Redirect all requests from HTTP to HTTPS in Cloudflare
- Full
- In "Overview" of "SSL/TLS"
- Always Use HTTPS
- In "Edge Certificates" of "SSL/TLS"
- Full
- References
- ChatGPT
- https://dash.cloudflare.com/
View Git commit messages in one-line format
git log --oneline
- Notes
- Because for faster viewing of recent commits.
- References
- ChatGPT
Set the Referer header to desired value
curl --user \ natas4:tKOcJIbzM4lTs8hbCmzn5Zr4434fGZQm \ --referer \ http://natas5.natas.labs.overthewire.org/ \ http://natas4.natas.labs.overthewire.org/
- Notes
- Because to pass the Natas4 level of overthewire.org.
- References
Convert hexadecimal string to binary data of ASCII characters
echo 3d3d516343746d4d6d6c315669563362 | xxd -r -p
- Notes
-r
# Revert-p
# Plain==QcCtmMml1ViV3b
# Output- Because to pass the Natas8 level of overthewire.org.
- References
man xxd
- ChatGPT
Reverse a string in Linux
echo "==QcCtmMml1ViV3b" | rev
- Notes
b3ViV1lmMmtCcQ==
# Output- Because to pass the Natas8 level of overthewire.org.
- References
- ChatGPT
Install Node.js and npm in Ubuntu Server 22.04
doas apt update
doas apt install nodejs npm -y
git clone https://github.com/KrauseFx/markdown-to-html-github-style
cd markdown-to-html-github-style/
npm install
node convert.js .
- References
The abbreviation of "automated teller machine" is "ATM".
- A device
- To perform transactions
- References
The abbreviation of "large language model" is "LLM".
- A language model
- References
The abbreviation of "artificial intelligence" is "AI".
- An intelligence
- References
Display the correct date and time in Systemd
doas timedatectl set-timezone Asia/Shanghai
- Notes
timedatectl
# View the current timezoneAsia/Shanghai
# Replace it with your desired timezonetimedatectl list-timezones
# List all timezones
- References
man timedatectl
- ChatGPT
Use the "man" tool in Linux
b
# Backward one window (The same asCtrl-b
)f
# Forward one window (The same asCtrl-f
)ma
# Mark with "a" letter
- Notes
'a
# Go to the "a" mark
- References
h
Upgrade the Vim in Ubuntu Server 22.04
doas add-apt-repository ppa:jonathonf/vim
doas apt update
doas apt install vim
- Notes
vim --version
# Check the version- Because it is necessary to meet the usage conditions of "Codeium".
- References
man vim
- ChatGPT
Modify the last commit message in Git
dotfiles commit --amend -m "Push to master branch on odd days"
- Notes
dotfiles push origin development -f
# Solve the problemyaoniplan@ubuntu2204:~$ dotfiles push origin development To 192.168.10.100:/var/git/dotfiles.git ! [rejected] development -> development (non-fast-forward) error: failed to push some refs to '192.168.10.100:/var/git/dotfiles.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
dotfiles pull origin development
# Someone else pull the development branch
- References
- ChatGPT
Set the default editor to Vim in Ubuntu Server 22.04
vim ~/.bashrc
export VISUAL=vim export EDITOR=vim
- Notes
source ~/.bashrc
# Make the changes effective
- References
- ChatGPT
Change a repository description for GitHub via command line
- Type in terminal
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer yourPersonalAccessToken" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/yaoniplan/dotfiles \ -d '{"description":"Minimal dotfiles in Linux server"}'
- Type in terminal
- Notes
yourPersonalAccessToken
# Replace it with your GitHub PAT- Get it in "Personal access tokens" of "Developer settings"
- Remember to click the "repo" checkbox to grant this token access to the repository
yaoniplan/dotfiles
# Replace it with your user and repository nameMinimal dotfiles in Linux server
# Replace it with your desired description
- References
Paste content from clipboard to dmenu
$(xclip -o)
- Notes
-o
# Outdoas emerge -aq x11-misc/xclip
# Install it if you don't have itmpv --speed=2 $(xclip -o)
# Type it before you pressedCtrl-c
to copy content- Another way
$(xsel -ob)
xsel
# X selection-o
# Output-b
# Clipboard
- References
man xsel
- ChatGPT
The abbreviation of "personal access token" is "PAT".
- A string
- To authenticate
- Notes
- Because to use GitHub PAT to change a repository description via command line
- References
Use "Codeium" to autocomplete in Vim
:Codeium Auth
- Notes
vim ~/.vimrc
# Install it if you don't have itPlug 'Exafunction/codeium.vim'
source ~/.vimrc
:PlugInstall
- References
Use a development branch in Git
- First use
git branch development git checkout development git add testDevelopment.md git commit -m "Add testDevelopment.md"
- Push the code
git push origin development git checkout master git merge development git push origin master
- First use
- Notes
- If you want to stay on the development branch to push the code
git push origin development
# Push to the development branchgit push origin development:master
# Push to the master branch
git branch --all
# View all branchesgit push --all origin
# Push all branches to GitHubgit branch -d dev
# Delete a branch locally- Because using two repositories is a bit cumbersome.
git clone git@192.168.10.100:/var/git/note.git --branch development
# Solve the problemwarning: remote HEAD refers to nonexistent ref, unable to checkout
git push origin development:master
# You don't push your master branch togit@192.168.10.100:/var/git/note.git
- If you want to stay on the development branch to push the code
- References
Use the "$(())" construct to perform basic arithmetic operatons in Bash
echo $((7 / 2))
# "3"
- Notes
- Because to check if it is an odd or even day
if [[ $(( $(date +%-j) % 2)) -eq 1 ]]; then
-
# Do not pad the field
- Perform floating point arithmetic operations
echo "scale=2; 7 / 2" | bc
# "3.50"
- Because to check if it is an odd or even day
- References
man date
- ChatGPT
Search for a piece of music in search bar of Chromium
8am I can see the success rate
- Notes
8am
# Music nameI can see the success rate
# Animation name
Learn some Bash projects to master it quickly
- A backup script
- Automate system updates
- A password manager
- A weather app
- Notes
- Because the default shell of most Linux distributions is bash.
- References
- ChatGPT
Untrack a file instead of removing it in Git
git rm --cached .bashrc
git commit -m "Stop tracking .bashrc"
- Notes
.bashrc
# Replace it with a file you want to untrack- Because for compatibility with server (e.g. Ubuntu Server 22.04, FreeBSD, etc.)
- References
git rm --help
- ChatGPT
Pass bandit 27 level in overthewire.org
git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo
- Notes
:2220
# Add the port to solve the following problem!!! You are trying to log into this SSH server on port 22, which is not intended.
- References
Decompress a ".bz" file
bzip2 -d testData.bz
- Notes
-d
# Decompress
- References
Use a private key to login the remote server
ssh -i sshkey.private bandit14@bandit.labs.overthewire.org -p 2220
- Notes
-i
# Identitysshkey.private
# Replace it with remote private key file
- References
Redirct the output of an interactive command to a file
script /tmp/getPrivateKey.txt
- Type your command
- Notes
exit
# Exit the script command- Because to get a private key of output of the
openssl s_client -connect localhost:31790
command
- References
Execute a command of remote server using SSH
ssh bandit18@bandit.labs.overthewire.org -p 2220 head readme
- Notes
head readme
# Replace it with your desired command- Specify PATH in ssh command
ssh -t yaoniplan@192.168.10.100 'export PATH=$PATH:$HOME/.local/bin; backupPrivatefiles.sh'
-t
# Tty
- Because to pass the level about "logout when logging in with SSH".
- References
The abbreviation of "standardized test" is "SAT".
- For college admissions
- References
Count a number of files in the current directory in Linux
ls -1 | wc -l
- Notes
-1
# One file per line-l
# Lines
- References
man ls
man wc
- ChatGPT
Install pip with Python3 in Ubuntu Server 22.04
doas apt install python3 python3-pip
- Notes
pip3 --version
# Verify it- Because to use
python3 -m pip install "pelican[markdown]"
- References
- ChatGPT
Use a package mirror for pip in Ubuntu Server 22.04
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- Notes
- Because to improve the download speed
- References
Reverse the order of files in Linux
cat $(ls -r ~/note/journals/*.md) > ~/note/.github/README.md
- Notes
-r
# Reverse
- References
man ls
- ChatGPT
Use the "diff" command to compare two files in Ubuntu Server 22.04
diff countTheNumberOfVowelsAndConsonants.c testCountTheNumberOfVowelsAndConsonants.c
- References
- ChatGPT
Remove some files excluding the ".c" extension in Linux
find . -maxdepth 1 -type f -not -name "*.c" -delete
- Notes
- Warning: Delete them one by one unless you are an adventurer
-maxdepth 1
# Only the current directoryf
# Filerm -rf !(*.apkg)
# Remove files excluding ".apkg" extension- Solve the problem
yaoniplan@tux ~/Downloads/deck $ rm -rf !(*.apkg) bash: !: event not found yaoniplan@tux ~/Downloads/deck $
shopt -s extglob
# Set extglob shell option temporarily
- Solve the problem
- References
- ChatGPT
Use "mpv"
vim ~/.config/mpv/mpv.conf
# Display filename as title (Avoid ads in title) title=${filename}
`
# Open the console for debugging (To test keybindings)Ctrl-h
# Hardware decoding (May reduce CPU usage)Shift-i
# Informationmpv av://v4l2:/dev/video0
# Capture and display live video from a camera--vf=hflip
# Horizontal flip (Like in phone)--profile=low-latency --untimed
# Low latency
mpv --speed=2 --fullscreen "URLOfTheVideo"
- Notes
- Warning: Drop a lot of frames to play high quality video on an old computer in video speed mode (e.g. 3x, 2x, etc.)
- https://github.com/mpv-player/mpv/issues/10564#issuecomment-1615683626
- Maybe it's because it's running on Wayland
- Control from command-line
mpv --input-ipc-server=/tmp/mpvsocket --playlist=/mnt/server/interestAndHobby/music/
# Reduce gap:--prefetch-playlist=yes
Cache next song,--no-audio-display
Don't show cover,--save-position-on-quit
Watch laterecho 'run rm "${path}"; playlist-remove current' | socat - "/tmp/mpvsocket"
# Delete current songecho '{ "command": [ "keypress", "D" ] }' | socat - /tmp/mpvsocket
# Another way that use shortcut keysfor times in {1..5}; do echo '{ "command": [ "keypress", "/" ] }' | socat - /tmp/mpvsocket; done
# Decrease 10% volumeecho '{ "command": ["get_property", "path"] }' | socat - /tmp/mpvsocket | jq -r '.data' | sed 's#/[^/]*$##'
# Get file path#
# Delimiter (Avoid conflicts with the path)
- Use scripts
git clone https://github.com/CogentRedTester/mpv-file-browser ~/.config/mpv/scripts/file-browser
cp ~/.config/mpv/scripts/file-browser/docs/file_browser.conf ~/.config/mpv/script-opts/
... # Replace `/mnt/` with your file directory root=~/,/mnt/ ... custom_keybinds=yes ...
vim ~/.config/mpv/script-opts/file-browser-keybinds.json
[ { "key": "SPACE", "command": ["script-binding", "file_browser/dynamic/play"] }, { "key": "k", "command": ["script-binding", "file_browser/dynamic/scroll_up"] "flags": { "repeatable": true} }, { "key": "j", "command": ["script-binding", "file_browser/dynamic/scroll_down"], "flags": { "repeatable": true} }, { "key": "l", "command": ["script-binding", "file_browser/dynamic/down_dir"], "flags": { "repeatable": true} }, { "key": "h", "command": ["script-binding", "file_browser/dynamic/up_dir"], "flags": { "repeatable": true} }, { "comment": "Delete the current file", "key": "D", "command": ["run", "rm", "%p%n"], "command": ["playlist-remove", "current"] } ]
mpv /mnt/server/来自分享/*全球*/
# PressCtrl-o
(OrmenuKey
) to open file browser--player-operation-mode=pseudo-gui
# If you don't want to play it immediately (Select path using script)- https://github.com/CogentRedTester/mpv-file-browser/issues/87#issue-1557145715 # Support finding files
user-input-module.lua -> script-modules/user-input-module.lua find.lua -> script-modules/file-browser-addons/find.lua user-input.lua -> scripts/user-input.lua
Ctrl-r
# Refresh playlist- https://github.com/CogentRedTester/mpv-user-input#installation
vi ~/.config/mpv/input.conf
# Bind a shortcut key# Print title (See https://github.com/mpv-player/mpv/blob/master/DOCS/man/input.rst#property-list to get the property) # If the length of media-title is zero, then print filename p run "/bin/sh" "-c" "if [[ -z '${media-title}' ]]; then notify-send '${filename}'; else notify-send '${media-title}'; fi" # Copy the full path to clipboard Ctrl+shift+c run "/bin/sh" "-c" "echo '${path}' | wl-copy" # Print and copy file path (Wrap `${path}` in quotes to avoid spaces in file names) Ctrl+shift+x run "/bin/sh" "-c" "notify-send `dirname '${path}'`; echo `dirname '${path}'` | wl-copy" # Reload after editing `~/.config/mpv/input.conf` CTRL+r run "mpv" "${path}"; quit-watch-later # `l` go forward 5 seconds (Optional: `no-osd`, `exact`) l no-osd seek 5 exact # `D` removes the current file D run rm "${path}"; playlist-remove current # `Ctrl-l` Show playlist for 5 seconds (Default: `Fn-8`) CTRL+l show-text "${playlist}" 5000
mpv --cache=no
# For online streaming (Forward and back very fast, without caching the entire file)Alt-Hyphen
# Zoom out video (Opposite:Alt-+
)Alt-Down
# Move focus down (Pan video)
l
# Set A loop point, set B loop point, and clear A-B loop- Solve a problem about has no sound
-ao=pulse
- For live streaming
- https://github.com/streamlink/streamlink/issues/4609#issuecomment-1159787392
- Click 'Copy Media Links to the Clipboard'
- For Music
--loop-playlist
# Loop infinitely (The same asL
)--shuffle
# Random playback--no-video
# For audio only
--start=00:54:00
# For test--mute=yes
# For NSFWG
# Increase size of subtitle--sub-file-paths=subtitles/
# For animationsubtitles/
# Replace it with your directory including subtitles--sub-file="subtitles/01.ass"
# For moviev
# Visualize subtitle
m
# Mute (For NSFW)--playlist=computerScience.txt
--http-proxy=http://192.168.10.100:7890
vim ~/.config/mpv/mpv.conf
# Another way--http-proxy=http://192.168.10.100:7890
mpv yourM3UFileIncludingM3U8URLs
# play internet protocol television (e.g. https://raw.githubusercontent.com/BurningC4/Chinese-IPTV/master/TV-IPV4.m3u)<
# Go backward in the playlist
/
# Decrease volume}
# Double speedo
# Show progress barf
# Full screenvi ~/.config/mpv/mpv.conf
# Another way--fullscreen
q
# Quit- Because be convenient to enable the full screen feature.
- Play video smoothly
- Warning: Drop a lot of frames to play high quality video on an old computer in video speed mode (e.g. 3x, 2x, etc.)
- References
- https://redlib.private.coffee/r/mpv/comments/ifx6k3/how_do_you_copy_the_full_path_to_clipboard/
- https://old.reddit.com/r/mpv/comments/vc2mvc/restart_mpv_with_keybinding/
- https://old.reddit.com/r/mpv/comments/l9ez04/mpv_inputconf_not_working/htayzg7/
- https://github.com/CogentRedTester/mpv-file-browser/issues/44#issue-1140618808
- https://github.com/CogentRedTester/mpv-file-browser/discussions/75#discussion-4477815
- https://mim.mbirgin.com/?c=posts&id=200
- https://filmsbykris.com/scripts/MyNotes/colored/MPV%20remote%20socket%20commands%20for%20script%20control%20and%20server%20use-23PXxpiD.html
- https://alexherbo2.github.io/config/mpv/control-mpv-from-the-command-line/
- https://github.com/mpv-player/mpv/blob/73a06ffae663e9fb78c5dff4b6bd01a637296a69/etc/input.conf#L164
- https://github.com/CogentRedTester/mpv-file-browser/blob/master/docs/file-browser-keybinds.json
- https://github.com/CogentRedTester/mpv-file-browser#basic https://askubuntu.com/questions/1412462/mpv-accidently-got-no-sound-problem
- https://bbs.archlinux.org/viewtopic.php?id=281480
- https://superuser.com/questions/663247/is-it-possible-to-delete-an-mp3-file-currently-played-in-mplayer/854087#854087
- https://github.com/mpv-player/mpv/issues/11985#issuecomment-1646557265
- https://wiki.gentoo.org/wiki/Mpv#Key_bindings
man mpv
#/Cache$
/hardware
- ChatGPT
Add a user in Ubuntu Server 22.04
doas adduser git
- Notes
git
# Replace it with your desired name- Because to use the remote Git repository
- References
- ChatGPT
Use "doas"
echo 'permit :wheel' >> /etc/doas.conf
- Notes
su root
# Substitute to root userpacman --sync doas
# Install dependenciesgroupadd wheel
# Create a group if it does not existusermod -aG wheel yaoniplan
# Add your user to wheel group- Close and open terminal to make changes effective
- Because it is easier to use than "sudo".
- References
man doas.conf
- ChatGPT
Add a user to a group in Ubuntu Server 22.04
sudo usermod -aG wheel git
- Notes
-a
# Append-G
# Groupswheel
# Replace it with your desired groupgit
# Replace it with your desired user- See which groups a user belongs to (Two methods)
groups git
grep git /etc/group
- Because to use the doas command
- References
man usermod
- ChatGPT
Run the C program in Linux
gcc learnC.c && ./a.out
- Notes
gcc factorial.c -o factorial
# Compile-o
# Outfile
./factorial
# Run the program
- References
man gcc
- ChatGPT
Use aliyunpan-sync in Docker
- In Docker
docker run -d --name=aliyunpan-sync --restart=always -v "<your local dir>:/home/app/data" -e TZ="Asia/Shanghai" -e ALIYUNPAN_REFRESH_TOKEN="<your refreshToken>" -e ALIYUNPAN_PAN_DIR="<your drive pan dir>" -e ALIYUNPAN_SYNC_MODE="upload" -e ALIYUNPAN_TASK_STEP="sync" tickstep/aliyunpan-sync:v0.2.6
- In Docker
- Notes
/var/aliyundrive
:v0.2.6
# Sovle the problemdocker: Error response from daemon: manifest for tickstep/aliyunpan-sync:latest not found: manifest unknown: manifest unknown.
- References
Use the "screen" command in Ubuntu Server 22.04
screen
Ctrl-a k
# Kill a windowCtrl-a c
# Create a windowCtrl-a n
# Switch between window
Ctrl-a :
sessionname learnBash
# Rename the current session name
screen vim someCPrograms/checkPrimeNumber.c
screen -list
# Get ID and name of sessionsscreen -S testScreenList
# Create a sessionscreen -X -S 14099 quit
# Terminate a sessionscreen -r testScreenReattach
# Reattach a sessionCtrl-a d
# Deattach
- Notes
-S
# SessionnametestScreenList
# Replace it with your desired session name14099
# Replace it with ID of sessions
- References
man screen
- ChatGPT
Use "rclone"
rclone config
n # n) New remote yaoniplan # name 31 # Storage of WebDAV http://192.168.10.100:5244/dav # URL 4 # vendor of other admin # user of AList ****** # password of AList the rest of options are the default q # q) Quit config
vi ~/.config/rclone/rclone.conf
# Another way[yaoniplan] type = webdav url = http://192.168.10.100:5244/dav vendor = other user = admin pass = H2bvDv2jDfEuI3fMJ263WjkI
doas mkdir /mnt/$(whoami)/
doas chown -R $(whoami):$(whoami) /mnt/$(whoami)/
rclone mount yaoniplan:/ /mnt/$(whoami)/ &
- Notes
rclone copy --http-url https://www.cs.mun.ca/~boliver/70s :http: alist:/interestAndHobby/
# Copy from remote to anotherrclone copy music:/ ~/music/
# Copy from remote to local- Because to mount the AList to the local directory.
doas apt install rclone
# Install it in Ubuntu Server 22.04rclone lsd yaoniplan:/
# List directorycrontab -e
# Run it at boot in Ubuntu Server 22.04@reboot /usr/bin/rclone mount yaoniplan:/ /mnt/yaoniplan/ &
/usr/bin/rclone
# Get it by runningwhich rclone
- Solve the problem
2023/04/13 23:05:24 Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount": executable file not found in $PATH
ln -s /usr/bin/fusermount3 /usr/bin/fusermount
- Solve the problem
2023/04/14 02:48:01 ERROR : selfImprovement/thinkingCognition/个人爆发式成长的25种思维/01第1讲 筛选思维:随意选择的人生,不值得一过(01).wma: vfs cache: failed to download: vfs reader: failed to write to cache file: 403 Forbidden
- Change "302 redirect" to "native proxy" in "WebDAV policy"
rclone mount testDAVOne:/ /mnt/testDAVOne/ --header "Referer:"
# Another way
- Mount to another computer
doas emerge -q net-fs/sshfs
# Install dependenciessshfs yaoniplan@192.168.10.100:/mnt/yaoniplan/ /mnt/yaoniplan/
# Mountfusermount -u /mnt/yaoniplan
# Unmount that solve the problemyaoniplan@tux ~ $ <3>ERROR : /mnt/music/: Unmounted rclone mount ls: cannot access '/mnt/yaoniplan': Transport endpoint is not connected
vim ~/.xprofile
# Run it at boot in Gentoo Linuxsshfs yaoniplan@192.168.10.100:/mnt/yaoniplan/ /mnt/yaoniplan/ &
- Wraning: It has some errors when play videos.
- References
- https://forum.rclone.org/t/copy-from-one-rclone-remote-to-another/9420/4
- https://rclone.org/http/#usage-without-a-config-file
- https://github.com/alist-org/alist/discussions/630#discussioncomment-2424414
- https://rclone.org/install/#run-periodically-from-cron
- https://github.com/alist-org/alist/discussions/1724#discussioncomment-3901460
- https://github.com/rclone/rclone/issues/6856#issuecomment-1479853571
- https://wiki.gentoo.org/wiki/Filesystem_in_Userspace
- https://www.youtube.com/watch?v=hoUPP1aLE60
- ChatGPT
There is no right to choose. #idea
- The ownership is in the hands of others
- You only have the right to use
- Notes
- Privacy may be less important
- Depending on who owns the property
Use Vimium C for file:// in Chromium
- Click "Allow access to file URLs" button
- Notes
- Warning: Stability and security will suffer.
- References
Set a static IP address in Ubuntu Server 22.04
doas vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity' network: ethernets: enp2s0: dhcp4: no addresses: [192.168.10.100/24] gateway4: 192.168.10.1 nameservers: addresses: [192.168.10.1] version: 2
doas netplan apply
# Apply the changes
- Notes
enp2s0
# Replace it with your interface nameip address
# Get it
192.168.10.100
# Replace it with your desired IP address192.168.10.1
ip route
# Get the gateway
- Because to use SSH.
- Solve the problem
yaoniplan@ubuntu2204:~$ ssh-copy-id yaoniplan@192.168.10.105 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/yaoniplan/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ERROR: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)! ERROR: It is also possible that a host key has just been changed. ERROR: The fingerprint for the ED25519 key sent by the remote host is ERROR: SHA256:nHN0tokxVW4e5DV4Irvf7EM6dAWRbX/LHPzir2DDxsk. ERROR: Please contact your system administrator. ERROR: Add correct host key in /home/yaoniplan/.ssh/known_hosts to get rid of this message. ERROR: Offending ECDSA key in /home/yaoniplan/.ssh/known_hosts:10 ERROR: remove with: ERROR: ssh-keygen -f "/home/yaoniplan/.ssh/known_hosts" -R "192.168.10.105" ERROR: Host key for 192.168.10.105 has changed and you have requested strict checking. ERROR: Host key verification failed.
ssh-keygen -f "/home/yaoniplan/.ssh/known_hosts" -R "192.168.10.105"
-f
# Filename-R
# Remove192.168.10.105
# Replace it with your error (e.g. [192.168.10.105]:60022)
- References
- ChatGPT
The abbreviation of "Dots per inch" is "DPI".
- A measure
- References
Set DPI in Chromium
chromium --force-device-scale-factor=1.5
- Notes
1.5
# Replace it with float number (e.g. 1.2)- In Gentoo Linux
doas vim /etc/chromium/default
CHROMIUM_FLAGS="--force-device-scale-factor=1.2"
- Because be convenient to read the text.
- References
Add API keys to Chromium
- Join two groups
- New a project in "NEW PROJECT"
- Open https://cloud.google.com/console
- Click "OAuth consent screen" in "APIs & Services"
- Select "External" in "User type"
- Add your email account in "Test users"
- Add some APIs in "Library"
- Cloud Search API
- Google Drive API
- Safe Browsing API
- Time Zone API
- Admin SDK API
- Chrome Sync API
- Chrome Web Store API
- Chrome Spelling API
- Create credentials in "Credentials"
- API key
- Select "Desktop app" for "Application type" in "OAuth client ID"
vim ~/.bash_profile
export GOOGLE_API_KEY="AIzaSyBu8FIIyAg8tgViMLBcbqthjvQdutsvOSY" export GOOGLE_DEFAULT_CLIENT_ID="696256159994-krng5vgpj2p2f9neqrn46j58q201b0j0.apps.googleusercontent.com" export GOOGLE_DEFAULT_CLIENT_SECRET="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"
- Replace them with yours
- Notes
- Because to use sync feature
about:version
# View the flags of "Command Line"
- References
Set dark mode in Chromium
about:flags
- Type "Auto Dark Mode for Web Contents"
- Select "Enable with selective inversion of non-image elements"
- Notes
- Another way in Gentoo Linux
doas vim /etc/chromium/default
CHROMIUM_FLAGS="--force-dark-mode --enable-features=WebContentsForceDark"
- In Arch Linux
vim ~/.config/chromium-flags.conf
--force-dark-mode --enable-features=WebUIDarkMode
- Another way in Gentoo Linux
- References
Run extensions on chrome:// URLs
doas vim /etc/chromium/default
CHROMIUM_FLAGS="--extensions-on-chrome-urls"
- Notes
- Warning: Stability and security will suffer.
- Not supported on "view-source:" pages.
- Because to run a extension named Vimium C
Run on chrome://*/* pages
Run on Chrome's native New Tab Page
- Warning: Stability and security will suffer.
- References
The abbreviation of "Short Message Service" is "SMS".
- A service component
- References
The abbreviation of "United States of America" is "USA".
- A country
- In North America
- References
Delete a user account in Gentoo Linux
doas userdel -r toshiba
- Notes
-r
# Removetoshiba
# A user name
Act as a spoken English teacher in ChatGPT
I want you to act as a spoken English teacher and improver. I will speak to you in English and you will reply to me in English to practice my spoken English. I want you to keep your reply neat, limiting the reply to 100 words. I want you to strictly correct my grammar mistakes, typos, and factual errors. I want you to ask me a question in your reply. Now let's start practicing, you could ask me a question first. Remember, I want you to strictly correct my grammar mistakes, typos, and factual errors.
- Notes
- Type your sentence in English
- Another way
- Grammar check. Make it more professional. Who is John von Neumann, and what is his identity?
- References
The abbreviation of "virtual private network" is "VPN".
- A mechanism
- References
Redirect URL form "cn.bing.com" to "www.bing.com"
vim headerEditorConfig.json
{ "request": [ { "enable": true, "name": "bing-cn-to-www", "ruleType": "redirect", "matchType": "prefix", "pattern": "https://cn.bing.com", "exclude": "", "group": "bing-redirect", "isFunction": false, "action": "redirect", "to": "https://www.bing.com" } ], "sendHeader": [ { "enable": true, "name": "bing", "ruleType": "modifySendHeader", "matchType": "regexp", "pattern": "^http(s?)://www\\.bing\\.com/(.*)", "exclude": "", "group": "bing-direct", "isFunction": false, "action": { "name": "x-forwarded-for", "value": "8.8.8.8" } } ], "receiveHeader": [], "receiveBody": [] }
- Notes
- Warning: It does not work on February 10, 2024.
- Install the web browser extension named "Header Editor"
- References
Submit a website to archive.org
- Find the "Save Page Now" in "WEB"
- Paste URL of the website you want to archive
- Notes
- Because for future reference.
Set full screen in Chromium
- Click the three vertical dots
- Click the full screen mode icon
- Notes
- Click the "X" button # Exit the full screen mode
- Another way
Fn-11
# Press it
- References
Close the download bar in Chromium
Ctrl-j
# Open "Downloads" tabCtrl-w
# Close it
- References
Trying to build a blog (2023-03-04)
- No comment system
- Markdowm # Simple
- Searchable
- Waterfalls flow
- References
Compress a directory in Unix-like
tar -cf getUsername.tar getUsername/
gzip getUsername.tar
- Notes
-c
# Create-f
# FilegetUsername/
# Replace it with your desired compressed directory- If you want higher compression.
gzip
# Replace it withxz
- References
man tar
Use "firefox"
about:support
#/version
media.ffmpeg.vaapi.enabled
# Set to true to enable hardware decoding- Open previous windows and tabs
- Notes
- Because to restore previous tabs by default on startup.
- References
about:config
#/vaapi
- https://www.mail.com/blog/posts/how-to-restore-tabs/124/#Restore%20browsing%20session%20and%20tabs%20in%20Firefox
about:preferences
# In 'Startup' of 'General'- ChatGPT
Set dark mode in Firefox
about:config
ui.systemUsesDarkTheme
- Select "Number", click plus button, and write down "1"
- Notes
- Warning: It does not work in 2023-04-08.
- References
- https://github.com/m-khvoinitsky/dark-background-light-text-extension # Install the extension
- https://userstyles.org/styles/158321/global-dark-style-everything-to-dark-2018
- https://userstyles.org/styles/31267/global-dark-style-changes-everything-to-dark # It works, but override all default themes
- https://www.askvg.com/tip-force-mozilla-firefox-to-always-use-dark-or-light-theme-mode/
Disable smooth scrolling in Firefox
about:config
general.smoothScroll
- Toggle it from "true" to "false"
Solve a problem about Qutebrowser
export XDG_RUNTIME_DIR="/tmp/runtime-yaoniplan"
export RUNLEVEL=3
- References
- The problem
09:01:48 WARNING: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-yaoniplan'
- https://stackoverflow.com/questions/59790350/qstandardpaths-xdg-runtime-dir-not-set-defaulting-to-tmp-runtime-aadithyasb/59843603#59843603
- The problem
Use Vimium C for hint
- Custom key mappings
unmap F map gr LinkHints.activate button="right" # Right click env text host= "http://192.168.10.100:5244/" || "https://abnormalize.icu/" env telegramImages host="https://web.telegram.org/z/" run f lh expect="text:lh1,telegramImages:lh2" run <v-lh1> lh clickable=".hope-text" run <v-lh2> lh clickable=".thumbnail" map <v-lh> LinkHints.activate
- Custom key mappings
- Notes
text
# Replace it with other name you likehttp://192.168.10.100:5244/
# Replace it with URL.hope-text
# Replace it with other CSS elementsCtrl-Shift-c
# In Chromium- Then hover your mouse to where you want to click # Get it
Ctrl-y
# The same asCtrl-r
in Vim
- References
- https://github.com/gdh1995/vimium-c/issues/386#issuecomment-912952613
- https://github.com/gdh1995/vimium-c/issues/624#issuecomment-1117473544
- https://github.com/gdh1995/vimium-c/wiki/Map-a-key-to-different-commands-on-different-websites
- https://github.com/gdh1995/vimium-c/issues/602#issuecomment-1094111805
- https://github.com/gdh1995/vimium-c/issues/869#issuecomment-1435837660
Use Vimium C for color of hint
- Custom CSS for Vimium C UI
.LH, .D>.LH { background: black; font-weight: bold; font-size: 15px; color: white;} .LH { border: /*!DPI*/ 0px solid lightgreen; }
- Custom CSS for Vimium C UI
- References
Find a Linux distribution suitable for use as a server
- Arch Linux (2023-06-19)
- Ubuntu Server 22.04 (2023-02-28)
- Notes
- Needs
- Docker
- Needs
Set static IP address in Gentoo Linux
doas vim /etc/conf.d/net.eno1
config_eno1="192.168.10.105/24" routes_eno1="default via 192.168.10.1" dns_servers_eno1="192.168.10.1"
ln -s /etc/init.d/net.lo /etc/init.d/net.eno1
# Create symlinksdoas /etc/init.d/net.eno1 restart
# Restart the interfacerc-update add net.eno1 default
# Enable at boot
- Notes
eno1
# Replace it with interface nameifconfig
# Get interface name
192.168.10.105
# Replace it with static IP address- May need to test to see if the IP address in already in use.
192.168.10.1
# Replace it with gatewaynetstat -rn
# Get gateway
- Because to use SSH
- References
Create a user in Gentoo Linux
useradd -m -G users,wheel,audio -s /bin/bash testUser
passwd testUser
- Notes
-G
# Groups-s
# ShelltestUser
# Replace it with user name
- References
Solve a problem about SSH
vim /etc/ssh/sshd_config
#PasswordAuthentication no PasswordAuthentication yes
rc-service sshd restart
# Make changes effective
- References
- The problem
Failed init storage: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
- https://stackoverflow.com/questions/47102080/ssh-in-go-unable-to-authenticate-attempted-methods-none-no-supported-method/47144076#47144076
- The problem
Install Ubuntu Server 22.04
- Follow steps of the website
- Install OpenSSH server
- Follow steps of the website
- Notes
doas vim /etc/apt/sources.list
# Change mirrors- Replace
http://security.ubuntu.com
withhttps://mirrors.ustc.edu.cn
- Replace
- References
Disable the new code search and code view in GitHub
- Feature preview
- New code search and code view
- Notes
- Because can't use Vimium's feature
- References
Use Surfingkeys
zr
# Zoom resetzi
# Zoom inw
Switch framesgU
# Go URL of rootgx$
# Close tabs on rightog
# Open Google- Learn JavaScript
;e
# Open settingsAlt-s
# Turn off SurfingkeysW
# Windows;gw
# Gather windows
- Notes
- Surfingkeys.js
api.map('<Ctrl-[>', '<Esc>'); // Map a key to another api.unmap('F'); // Unmap the F key api.Hints.setCharacters('sadfjklewcmpgh'); // Like Vimium settings.hintAlign = "left"; // Set left alignment settings.smoothScroll = false; // Disable smooth scroll api.Hints.style(" \ font-family: Roboto, sans serif; \ // Set font font-size: 15px; \ // Set font size color: #ffffff; \ // Set font color border: unset; \ // Disable border background: #000000; \ // Set background color ");
- May I need
- Call search bar
- Right click
- Bookmarks and a file
- The extension will make your browser use a lot of CPU resources.
- Maybe mining
- Surfingkeys.js
- References
- https://github.com/brookhong/Surfingkeys/issues/166#issuecomment-270044552
- https://github.com/brookhong/Surfingkeys/blob/master/docs/API.md
- https://gist.github.com/coramuirgen/94ba1d587cb2093c71f6ef4f0b371069
- https://gitlab-com.translate.goog/-/snippets/1985201?_x_tr_sl=auto&_x_tr_tl=zh-CN&_x_tr_hl=en-US
- https://github.com/brookhong/Surfingkeys#follow-links
Solve a problem about Linux-firmware in Gentoo Linux
doas vim /etc/portage/package.license
# Accepting the license for linux-firmware sys-kernel/linux-firmware linux-fw-redistributable # Accepting any license that permits redistribution sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE
- References
- The problem
- sys-kernel/linux-firmware-99999999::gentoo (masked by: || ( ) linux-fw-redistributable license(s), missing keyword) - A copy of the 'linux-fw-redistributable' license is located at '/var/db/repos/gentoo/licenses/linux-fw-redistributable'.
- https://wiki.gentoo.org/wiki//etc/portage/package.license
- The problem
Use "alist"
- AList V3
/websiteName # Mount Path / # Root folder path (All or a specific folder) /websiteURL # Url
- SFTP
/grow # Mount Path Name # Order by Descending # Order direction 192.168.10.100:22 # Address yaoniplan # Username ****** # Password /mnt/grow # Root folder path
- AliyundriveOpen
/ # Mount Path useYourPhoneToGet # Refresh token Name # Order by Ascending # Order direction
- AList V3
- Notes
- Get token
curl --request POST 'http://192.168.10.100:5244/api/auth/login' \ --header 'Content-Type: application/json' \ --data-raw '{ "username":"guest", "password":"guest" }'
- Get file name list
curl --request POST 'http://192.168.10.100:5244/api/fs/list' \ --header 'Authorization: yourAlistToken' \ --header 'Content-Type: application/json' \ --data-raw '{ "path": "/interestAndHobby/music", "password": "***", "page": 1, "per_page": 0, "refresh": false }'
curl --user admin:*** --upload-file ~/Downloads/trash/wall_anime2_8K.png http://192.168.10.100:5244/dav/189/2024/03/26/
# Send a file using curl if no rclonePUT
# MethodAuthorization
Basic username:password
# HeadersFile
Shortcut Input
# Request Body- https://libreddit.baczek.me/r/workflow/comments/5t2ac1/request_webdav_action/
- Install AList if you don't have it
vi ~/.config/alist/docker-compose.yml
version: '3.3' services: alist: restart: always volumes: - '~/.config/alist:/opt/alist/data' ports: - '5244:5244' - '5245:5245' environment: - PUID=0 - PGID=0 - UMASK=022 - TZ=UTC container_name: alist image: 'xhofe/alist:latest'
docker-compose up --detach
# Run in the backgrounddocker exec -i -t alist ./alist admin
# Get admin user's information
- Refresh pages (Two methods)
- Click "Refresh" icon
- Close the website and then open it
- View pictures of relative paths in Markdown
- Follow steps of the comment
- Add README.md (Two methods)
- Upload README.md
- Add Markdown content to "Readme" in "Metas"
- Replace logo and favicon
- Upload images
- Copy link
- Paste it to "Logo" and "Favicon" in style settings
- Open in external application
- In "External previews" of Preview of Settings
{ "wma,m4a": { "VLC": "vlc://$url" } }
- In "External previews" of Preview of Settings
- Solve the problem
Failed init storage: failed to refresh token: Too Many Requests
- Warning: There are limits (10 requests within 60 minutes) on the AList API, unless you use the API you applied for yourself. (Or use other drivers)
- https://github.com/alist-org/alist/discussions/2697#discussion-4656809
- Follow the above URL to add a cloudflare worker and a custom domain
- Enable 'Web Proxy'
- Enable 'use proxy URL' in 'WebDAV policy'
https://al.yaoniplan.eu.org
# In 'Download proxy URL' (your custom domain)
- Get token
- References
- https://github.com/alist-org/alist/discussions/2061#discussioncomment-6538007
- https://github.com/alist-org/alist/issues/4828#issuecomment-1646579013
- https://alist.nn.ci/guide/drivers/Alist%20V2%20V3.html#root-directory-path
- https://github.com/alist-org/alist/blob/main/docker-compose.yml
- https://github.com/alist-org/alist/issues/4160#issuecomment-1509490562
- https://github.com/alist-org/alist/issues/829#issuecomment-1080066329
- https://github.com/alist-org/alist/issues/2668#issuecomment-1345132515
- https://github.com/alist-org/alist/issues/2668#issuecomment-1345480664
- https://alist.nn.ci/guide/drivers/aliyundrive_open.html
- https://alist.nn.ci/guide/drivers/sfpt.html
- https://github.com/alist-org/alist/issues/2267
Use "shasum" to verify the checksum in Unix-like
shasum -a 256 ubuntu-22.04.2-live-server-amd64.iso
- Notes
-a
# Algorithm256
# Replace it with other algorithm (e.g. 512)
- References
man shasum
- https://ubuntu.com/download/server
Understand "Statue of Liberty"
- A statue
- In the United States
- References
Keep the sshd active when closing the laptop lid
sudo vim /etc/systemd/logind.conf
#HandleLidSwitch=suspend HandleLidSwitch=ignore
sudo reboot
# Make changes effective
- Notes
- Solve the problem
yaoniplan@tux ~ $ ssh root@192.168.10.100 ssh: connect to host 192.168.10.100 port 22: No route to host
- Solve the problem
- References
Use "docker"
doas vi /etc/systemd/system/docker.service.d/proxy.conf
# Set a proxy if mirror fails[Service] Environment="HTTP_PROXY=http://192.168.10.100:7890" Environment="HTTPS_PROXY=http://192.168.10.100:7890"
http://192.168.10.100:7890
# Replace it with your proxydoas systemctl daemon-reload && doas systemctl restart docker
# Make changes effectivedocker info
# Check the information about 'HTTP Proxy' or 'HTTPS Proxy'
doas vi /etc/docker/daemon.json
# Set a mirror{ "registry-mirrors": ["https://docker.nju.edu.cn/"] }
https://docker.nju.edu.cn/
# Replace it with a registry mirror in your countrydoas systemctl restart docker
# Restart docker to apply changesdocker info
# Check the information about 'Registry Mirrors'- https://blog.lty520.faith/%E5%8D%9A%E6%96%87/%E8%87%AA%E5%BB%BAdocker-hub%E5%8A%A0%E9%80%9F%E9%95%9C%E5%83%8F/#%E6%96%B9%E6%A1%88%E4%BA%8C%E4%BD%BF%E7%94%A8-cloudflare-worker-%E6%90%AD%E5%BB%BA # Another way using your own registry mirror
docker exec --interactive --tty diary sh
# Interact with containerdocker cp 11a6a5e253d7:/app /tmp/tmp.fWaKJndURz/
# Copy source code11a6a5e253d7
# Container ID (Ornote
: NAMES)/app
# Working directory/tmp/tmp.fWaKJndURz
# Destination directory
docker run --interactive --tty yaoniplan/diary sh
# View source codedocker images nginx
# Check the size of an imagedocker logs searxng
# The same asdocker-compose logs
docker container prune
# Prune stopped containersdocker ps --format "{{.ID}} {{.Ports}}"
# To write a conditional judgementdocker stop a3a15b7a4419 && docker rm a3a15b7a4419
# Stop and remove a containerdocker ps --all
# Get "CONTAINER ID"
docker rmi a3adcb495939
# Remove an imagedocker images
# Get "IMAGE ID"
docker search clash
# Search to get the full name
- Notes
- Because to improve the speed of downloading Docker images.
docker login
# Solve a problem about 'net/http: TLS handshake timeout'- Disable proxy
- Delete proxy configurations (e.g.
/etc/docker/daemon.json
,~/.docker/config.json
) - Rebuild container (e.g.
docker-compose down && docker-compose up --detach
)
- Delete proxy configurations (e.g.
- Reduce the size of a Docker image
vi ~/note/.dockerignore
# Exclude during the build process.git
- Push Docker image to Docker Hub
docker build --tag yaoniplan/note:latest ~/note/
# In path including Dockerfiledocker tag yaoniplan/note:latest yaoniplan/note:$(date +%F)
# Create a tagdocker push yaoniplan/note:latest
# Push the latest-tagged imagedocker push yaoniplan/note:$(date +%F)
# Push the date-tagged image
- Install dependencies in Ubuntu Server 22.04
- Follow the steps of this website
doas usermod --append --groups docker $(whoami)
# Run the command without passworddoas reboot
# Make the changes effective
- Install dependencies in Arch Linux
doas pacman --sync docker # Install dependencies doas systemctl enable docker --enable # Enable now doas gpasswd --add $(whoami) docker # Add user to Docker group
- Log out and log back to make changes effective
- References
- https://www.zdnet.com/article/docker-101-how-to-install-docker-on-ubuntu-server-22-04/
- https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6?permalink_comment_id=5083215#gistcomment-5083215
- https://sci.nju.edu.cn/9e/05/c30384a564741/page.htm
man usermod
#/^ *-a
/^ *-G
man docker
- Google #
registry mirrors site:edu.cn
- ChatGPT
Search for selected text in Vim
/
# Search modeC-r
# Register"
# The default register
- Notes
y
# Yank text to the"
register before entering search modeyl
- Because to search languages in other countries (e.g. Japanese).
- References
The abbreviation of "continuous integration" / "continuous deployment" is "CI" / "CD"
- Automation
- References
The abbreviation of "Pretty Good Privacy" is "PGP".
- A program
- To encrypt
- References
Copy files excluding hidden files in Unix-like
rsync -av --exclude=".*" ../learnPerl/ .
- Notes
../learnPerl/
# The source.
# The destination
- References
Rename the branch from "main" to "master" in Git
git branch --move main master
git push origin --set-upstream master
- Notes
git branch --all
# List all branchesgit push origin --delete main
# Delete the main remote branchgit branch --delete main
# Delete the main local branch- Because the default branch is master in Git
- Toggle the default branch of settings of a GitHub repository to master to solve the problem
yaoniplan@tux /tmp/note $ git push origin --delete main To github.com:yaoniplan/note.git ! [remote rejected] main (refusing to delete the current branch: refs/heads/main) error: failed to push some refs to 'github.com:y aoniplan/note.git'
- References
Complete brackets and quotes automatically in Vim
vim ~/.vimrc
inoremap ( ()<Left> inoremap ``` ```<CR>```<Up>
- Notes
( ()
# Replace it with others (e.g. [ [], { {}, < <>, ' '', " "")<Left>
# The left arrow key- Warning: Not recommended because it will conflict with replication.
- References
:help <CR>
:help <Left>
- Add a demo.gif here
- https://www.reddit.com/r/vim/comments/949jmp/comment/e3jaotv/?utm_source=share&utm_medium=web2x&context=3
Execute Markdown code blocks in Vim
:MarkdownRunner
- Notes
vim ~/.vimrc
# Install it if you don't have it# Lists of plugins Plug 'dbridges/vim-markdown-runner'
:w
# Write:source ~/.vimrc
# Reload the ~/.vimrc:PlugInstall
# Install- Another way
w !perl
# Replace perl with your language- Visually select the code and
:'<'>w !perl
- References
Use "curl"
'"$filePath"'
# Enclose in single quotes to make variable effective... --data-raw '{ "path": "'"$filePath"'", ...
curl --remote-name https://mirrors.ustc.edu.cn/archlinux/extra/os/x86_64/extra.db
# Download a filecurl --verbose yaoniplan.eu.org
- Notes
curl --user yourPersonalAccessToken: https://api.github.com/repos/philj56/tofi
# Solve the problem{"message":"API rate limit exceeded for 18.182.47.148. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}
yourPersonalAccessToken
# Replace it with your personal access tokencurl --include https://api.github.com/rate_limit
# Check the rate limit information (e.g. limit: 60 requests per hour)
--max-time 10
# Stop the curl command after 10 seconds
- References
man curl
- ChatGPT
Understand Esperanto
- A language
- To assist in the international
- References
The abbreviation of "Text To Speech" is "tts".
- References
Solve a problem about Let's Encrypt
certbot certonly --cert-name yaoniplan.eu.org -d yaoniplan.eu.org,www.yaoniplan.eu.org
- Notes
- Remove spaces between the domain names
- Separate them with a comma
- References
- Question
Requested domain is not a FQDN because it contains an empty label.
- https://github.com/certbot/certbot/issues/2916#issuecomment-374372893
- Question
Install Nginx server in FreeBSD
pkg install nginx
- Notes
vim /etc/rc.conf
nginx_enable="YES"
nginx -t
# Test the configuration file
- References
Some configuration files about network in FreeBSD
/etc/resolv.conf
/etc/hosts
Use Stagit in FreeBSD
- Prepare remote Git repositories
vim /var/git/learnPerl/description
# Add description of the repositoryvim /var/git/learnPerl/owner
# Add owner's namevim /var/git/learnPerl/url
# Add clone URL
- Install Nginx and Stagit dependency
- Prepare remote Git repositories for Stagit
- Install Stagit
- Prepare remote Git repositories
- Notes
- I don't need it on February 21, 2023.
- Just need a simple Git server using SSH
- I don't need it on February 21, 2023.
- References
The authorized_keys is
- Sum of ~/.ssh/id_rsa.pub
- Notes
scp /home/yaoniplan/.ssh/id_rsa.pub root@192.168.10.100:/tmp/id_rsa.yaoniplan.pub
# In client- Copy public key file of client to remote
cat /tmp/id_rsa.yaoniplan.pub >> /home/git/.ssh/authorized_keys
# In remote- Append public key to authorized_keys
- References
- Add a demo.gif here
Where is the repository in Git server
/var/git/
- References
Kill a process in the dmenu
pkill timer
# It may kill timerOfTomato.sh
- Notes
timerOfTomato.sh
# A script
- References
- Add a demo.gif here
Display pressed key on screen in Unix-like
screenkey
# Run itpkg install screenkey
# In FreeBSDemerge x11-misc/screenkey
# In Gentoo Linux
- Notes
- Pop up on the side. # I may need
Display public IP address
links ip4.me
curl -4 ifconfig.co
The abbreviation of "Domain Name System" is "DNS".
- A system
- References
Remove packages in FreeBSD
pkg remove mysql57-client
- Notes
pkg info | grep mysql
# Search the package before removingrm -rf /var/db/mysql/
- References
Install Apache server in FreeBSD
pkg install www/apache24
echo 'apache24_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/apache24 start
- Notes
/usr/local/etc/rc.d/apache24 start
# Replace it withservice apache24 start
- Solve the problem
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down
lsof -i :80
kill youPID
- References
Install MariaDB server in FreeBSD
pkg install mariadb103-server
sysrc mysql_enable=YES
# Set MariaDB to start at boot timeservice mysql-server start
# Start MariaDB
- Notes
pkg search mariadb | grep server
# Search it before installingmysql -u root -p mysql
# Login as root user
- References
Install PHP server in FreeBSD
pkg install php80
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
pkg install vim php80-xml mod_php80 php80-zip php80-mbstring php80-zlib php80-curl php80-mysqli php80-gd php80-gd
# Install PHP extensions
- Notes
pkg search php | grep server
# Search it before installingphp --version
# Check the version
- References
Install Gitea in FreeBSD
pkg install gitea
sysrc gitea_enable=YES
service gitea start
- Notes
/usr/local/etc/gitea
# Config files/usr/local/share/gitea
# Templates, options, plugins, and themes/usr/local/etc/rc.d/gitea
# A start script
- References
The abbreviation of certificate authority is CA
- Let's Encrypt is a CA.
- References
Use Let's Encrypt in Apache server
vim /usr/local/etc/apache24/httpd.conf
# UncommentLoadModule ssl_module modules/mod_ssl.so Include conf/extra/httpd-ssl.conf
- Notes
- ``
- References
- ``
Replace
#!/usr/bin/perl
with#!/usr/bin/env perl
in Unix-like- Make the script portable
- References
The abbreviation of environment is env in Unix-like
- References
man env
Delete a user account and home directory in FreeBSD
pw userdel git -r
- Notes
pw
# Passwordgit
# Replace it with your user name-r
Remove
- References
The abbreviation of "Portable Document Format" is "PDF".
- Notes
less file.pdf
- Disadvantages: Font size is small on mobile device
- References
Use ZFS to set a snapshot in FreeBSD
zfs snapshot -r zroot@testpool
# Create a recursive snapshot of an entire poolzfs rollback -r zroot@testpool
#zfs list
# Listzfs snapshot zroot/usr/home@test1-snapshot
# Create a snapshotzfs allow heting snapshot zroot/usr/home
# Allow an unprivilege user to use snapshot
zfs destroy zroot/usr/home@permitTest01
# Destroy a snapshotzfs allow heting destroy,mount zroot/usr/home
# Allow an unprivilege user to use destroy and mount
zfs list -t snapshot
-t
# Type
- References
Mount the hard disk permanently in Linux
doas vim /etc/fstab
UUID=f75f68b6-d1b3-4062-9a22-7dbff615efb6 /mnt/grow ext4 defaults 0 0
doas chown -R yaoniplan:yaoniplan /mnt/grow/
- Solve the problem about operation not permitted
- Notes
UUID=f75f68b6-d1b3-4062-9a22-7dbff615efb6
# Replace it with your UUID of block devicedoas blkid
# Get it
/mnt/grow
# Replace it with your mount pointext4
# Replace it with your type of block deviceyaoniplan
# Replace it with your user name- Mount all filesystems without rebooting
doas mount --all
lsblk
- References
man mount
man lsblk
man chown
- https://www.howtogeek.com/444814/how-to-write-an-fstab-file-on-linux/
Learn Perl 5
- A programming language
- References
Check default gateway in Unix-like
netstat -rn
- Notes
-r
# Route-n
# Numeric
- References
Check netmask in Unix-like
ifconfig | grep netmask
- Notes
0xffffff00
# The netmask- In hexadecimal
- References
man ifconfig
- Example
root@heting:~ # ifconfig | grep netmask inet 192.168.10.100 netmask 0xffffff00 broadcast 192.168.10.255 inet 127.0.0.1 netmask 0xff000000
Set static IP address and DNS in FreeBSD
vim /etc/rc.conf
ifconfig_re0="inet 192.168.10.100 netmask 0xffffff00" defaultrouter="192.168.10.1" ifconfig_re0="DHCP"
/etc/rc.d/netif restart && /etc/rc.d/routing restart
# Restart the Network
- Notes
re0
# Replace it with your network card name192.168.10.100
# Replace it with your IP address0xffffff00
# Replace it with your netmask192.168.10.1
# Replace it with your default gateway
- References
netstat -rn
ifconfig
- https://ostechnix.com/set-static-ip-address-and-dns-on-freebsd/
Create a domain name with "eu.org" (Or "us.kg")
- GitHub pages
- A repository named "yaoniplan.github.io"
- Custom domain to "yaoniplan.eu.org"
- Cloudflare
- CNAME, @, yaoniplan.github.io, Proxied, Auto
- eu.org (Or us.kg)
- Enter your domain
brenna.ns.cloudflare.com
# Name Server 1jim.ns.cloudflare.com
# Name Server 2
- GitHub pages
- Notes
- Public IP address
- Visible on the internet instead of on the home network
- Public IP address
- References
The abbreviation of "Free Berkeley Software Distribution" is "FreeBSD".
- Notes
- An operating system
- References
Use the top command in FreeBSD
s
# Secondsa
# Arguments (Full command)/
# Filter
- Notes
- In order to pause at some point
- References
h
The abbreviation of "manual" is "man" in Unix-like.
- Find a man if you have problems
- References
man man
Use SSH to create a Git server in FreeBSD
- Remote
adduser su git cd mkdir .ssh/ && chmod 700 .ssh/ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys cat /tmp/id_rsa.yaoniplan.pub >> ~/.ssh/authorized_keys git init --bare /var/git/myFirstFlake.git/
- Client
git init ~/myFirstFlake/ echo "# test" >> README.md && git add --all git commit -m "Add README.md" git remote add origin git@192.168.10.100:/var/git/test.git git push origin master
- Remote
- Notes
/tmp/id_rsa.yaoniplan.pub
# Replace yaoniplan with your user name- Other people on the team
- Copy
/home/whoseName/.ssh/id_rsa.pub
of client to/tmp/id_rsa.whoseName.pub
of remote - Append
/tmp/id_rsa.whoseName.pub
to/home/git/.ssh/authorized_keys
in remote
- Copy
git init --bare
# Initialize a bare repositorychown -R git:git /var/git/
# Change the owner to git after making a directory of repository
- References
Check the system log in Unix-like
less /var/log/messages
- Notes
/var/log/
# Most of log files are in this directory
Try to use FreeBSD as a remote server. #idea
- Install it by following steps of this website
Stop a service in FreeBSD
service syslogd stop
- Notes
syslogd
# Replace it with your service
The abbreviation of operating system is OS
- Notes
- A software
- References
Try to use the script in the dmenu instead of in the terminal. #idea
The abbreviation of "Chat Generative Pre-trained Transformer" is "ChatGPT".
- Notes
- A bot
- To chat
- References
Check the version of the scp command in Unix-like
ssh -V
- Notes
-V
# Version- The relative tools (e.g. ssh, sftp, scp) are parts of the OpenSSH.
- References
Add a user to a group in Linux
doas gpasswd -a yaoniplan vboxusers
- Notes
-a
# Addyaoniplan
# Replace it with your user namevboxusers
# Repalce it with your group name
- References
- Add a demo.png here
man gpasswd
Check the host name in Unix-like
hostname
- Notes
- Other methods
echo $HOSTNAME
# Check the environment variablecat /etc/hostname
# Check the file
- Other methods
- References
- https://man.freebsd.org/cgi/man.cgi?hostname(1)
man hostname
- ChatGPT
Check the current Shell in Unix-like
echo $SHELL
- Notes
- Another way
cat /etc/passwd | grep bandit26
- Because to know which Shell syntax to use
- Another way
- References
Set a password for a user in Unix-like
passwd heting
- Notes
heting
# Replace it with your user name
Create a user in FreeBSD
pw useradd heting
- Notes
adduser
# Another way
Add a user to multiple groups in FreeBSD
pw usermod heting -G wheel,video
- Notes
-G
# Grouplist
- References
Check a installed package information in FreeBSD
pkg info | grep git
- Notes
info
# Informationgit
# Replace it with a package
- References
man pkg
Write a finite loop in Bash
for i in {1..10}; do touch file0$i.txt; done
- Notes
i
# A variable
- References
Use "kitty"
vim ~/.config/kitty/kitty.conf
# Set cursor shape shell_integration no-cursor # Set fonts font_family Fira Code bold_font auto italic_font auto bold_italic_font auto # Disable audio bell enable_audio_bell no # Set font size font_size 12.0
- Notes
- Warnings: Selection mode needs to be improved. (To search and copy)
--class kitty1
# Set window class for rule matchingCtrl-Shift-t
# New tab- Because for quiet and readability.
- References
- https://github.com/kovidgoyal/kitty/issues/4458#issuecomment-1006355953 # Make
cursor_shape block
work - https://www.reddit.com/r/KittyTerminal/comments/m3dnrq/comment/gqpeiii/?utm_source=share&utm_medium=web2x&context=3
- https://sw.kovidgoyal.net/kitty/conf/#terminal-bell #
/fonts
man kitty
#/tabs$
- https://github.com/kovidgoyal/kitty/issues/4458#issuecomment-1006355953 # Make
Switch between windows with dmenu
- Install manually
git clone https://github.com/NikitaIvanovV/dmenu-win cd ./dmenu-win/ doas make install
- Install manually
- Notes
doas make uninstall
# Uninstall manually- Another way
- Download https://tools.suckless.org/dmenu/scripts/switch
- Put it into your PATH (e.g. ~/.local/bin/)
chmod u+x ~/.local/bin/switch
# Modify user executable permissions for the script- Type the
switch
in your search bar of dmenu
- References
Try to use drop down terminal in i3
xfce4-terminal --drop-down
# It works but quits when not focused- tdrop # Not used yet because of too many dependencies
- qterminal # It works but quits when not focused
- tilda # It will create a new workspace
- guake # It works well
- yakuake # It works well on KDE
Delete 2 lines in the upward direction in Vim
V2kd
- Notes
V
# Visual line modek
# Upd
# Delete- The above method will delete the current line
- References
Use sha512sum to verify the checksum
sha512sum -c CHECKSUM.SHA512-FreeBSD-13.1-RELEASE-amd64 FreeBSD-13.1-RELEASE-amd64-disc1.iso
- Notes
-c
# Check
- References
man sha512sum
Drop down terminal in i3
vim ~/.config/i3/config
for_window [class="^kitty$"] floating enable, move absolute position 0px 0px, resize set 1366px 400px, move scratchpad
- Notes
0px 0px
# X and Y coordinates1366px 400px
# Width and height
- References
Clear the current line in Vim
^d$
- Notes
^
# Beginning of lined
# Delete$
# End of line
Use "scrot"
scrot --focused $HOME/$(date +%F_%T).png
# Focus a windowscrot --select $HOME/"$fileName"
# Select a reactangle
- Notes
scrot $HOME/$(date +%F_%T).png
# The full screen by default
- References
Solve problems about MySQL in Gentoo Linux
emerge virtual/mysql
emerge --config =dev-db/mysql-8.0.31-r1
- References
- Problem 1
* You don't appear to have a server package installed yet. * ERROR: mysql failed to start
- Problem 2
* You don't appear to have the mysql database installed yet. * * Please run `emerge --config =dev-db/mysql-8.0.31-r1` to have this done... * * ERROR: mysql failed to start
- https://forums.gentoo.org/viewtopic-t-1040120-start-0.html
- Problem 1
Solve a problem about MySQL in Gentoo Linux
GRANT ALL PRIVILEGES ON owncloud.* TO 'yaoniplan'@'localhost';
- References
- Problem
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'secure1t'' at line 1
- https://stackoverflow.com/questions/52372165/mysql-error-1064-42000-you-have-an-error-in-your-sql-syntax/71326517#71326517
- Problem
Print unique lines only
sort data.txt | uniq -u
- Notes
-u
# Unique
- References
Get the human-readalbe strings
strings ./data.txt | grep -E "=+"
- Notes
strings
# The same ascat
, but printable-E
# Extended regular expressions
- References
Use base64 to decode
echo "b3ViV1lmMmtCcQ==" | base64 --decode
- Notes
|
# Redirect the output- Because to pass the Natas8 level of overthewire.org.
- References
Set the EDITOR variable in profile in Gentoo Linux
eselect editor list
eselect editor set 2
- Notes
2
# The second option is "[2] vi". /etc/profile
# Update the variable- For
crontab -e
Use "tree"
tree -L 2 .
- Notes
tree -L 1 {01..10}
-L
# Level.
# Your directory
- References
man tree
Use "sort"
sort --reverse music01.txt > music02.txt
# Arrange the file names in the file in reverse order
- Notes
- Because to find out the files that failed to upload.
- References
- ChatGPT
Replace the tree command with built-in commands
find . | sort | sed "s;[^/]*/;|____;g" | sed "s;____|; |;g"
- Notes
.
# Under the current directory;
# The delimiter (e.g. /)
- References
- Output
. |____.bash_history |____.bash_logout |____.bash_profile |____.bashrc |____.config | |____procps |____.lesshst |____.ssh | |____known_hosts | |____known_hosts.old |____.viminfo
- https://stackoverflow.com/questions/23952984/tree-functionality-using-sed-and-find-command/23953129#23953129
- Output
Back up the full system
vim /root/full-backup/full-backup.sh
BEFORE=$(df -h) STARTED=$(date) DATE=`date "+%Y-%m-%d"` DEST="/mnt/backup/$DATE" rsync --archive --acls --xattrs --delete --progress --verbose --exclude-from=exclude.txt --link-dest=/mnt/backup/last --mkpath / $DEST ln --symbolic --force --no-dereference $DATE /mnt/backup/last echo "Started at: " $STARTED echo "Current time: " $(date) echo "Before: $BEFORE Now: " df -h
vim /root/full-backup/exclude.txt
/dev/* /proc/* /sys/* /run/* /var/db/repos/gentoo /var/db/repos/guru /tmp/* /var/tmp /lost+found /mnt/* /home/heting/.npm /home/heting/.cache /home/heting/go/pkg/mod/cache
- Notes
heting
# Replace it with your user name- Restore
rsync --archive --acls --xattrs --progress --verbose . /mnt
- References
Generate random string in Linux
openssl rand -base64 22
- Notes
rand
# Random
- References
Use "top"
k
# KillL
# Locatem
# Memoryt
# Task1
# CPUc
# Full pathh
# Helpq
# Quit
- Notes
top -n 1
# The same astop
then pressq
-n
# Number
- References
Use "htop"
/logseq
# Search a processk
# Kill a processEnter
# Comfirm deletion
- Notes
- Because to delete some software that takes up a lot of processes.
Redirect standard error stream to null
find / -type f -user bandit7 -group bandit6 -size 33c 2>/dev/null
- Notes
-user
# Own by userbandit7
# A user
-group
# Belong to groupbandit6
# A group
2>
# Redirect stderr/dev/null
# Nullvim ~/.local/bin/getIPInformation.sh
# Output the result using notify-send if available, echo otherwise if ! notify-send "$outputResult" 2>/dev/null; then echo "$outputResult" fi
- References
Print the first n lines with the head command
head -1 ./.file2
- Notes
-1
# Replace the number with others
- References
Empty file in Linux
cat /dev/null > ~/.local/bin/test.sh
- Notes
~/.local/bin/test.sh
# Replace it with your target file
- References
Search for specific files with the find command
find . -type f -size 1033c ! -executable
- Notes
f
# Filec
# Bytes
- References
The abbreviation of "Secure File Transfer Program" is "SFTP"
- References
Use "rsync"
rsync -av test.md yaoniplan@192.168.10.106:/home/yaoniplan/
- Notes
-a
# --archive-v
# --verbose- Because to keep the original modification time when copying files.
- References
man rsync
- Add a demo.gif here
- https://www.golinuxcloud.com/commands-copy-file-from-one-server-to-another-linux-unix/
Use "sftp"
sftp yaoniplan@192.168.10.100
get -r fileCodeBox/ .
# The same ascp
sftp root@192.168.10.100:/root/test.md .
sftp -P 60022 yaoniplan@192.168.10.105:/etc/nixos/configuration.nix /tmp/
- Notes
-P
# Portroot
# Replace it with your user192.168.10.100
# Replace it with your remote ip address/root/test.md
# Replace it with your remote file.
# Replace it with a directory that you want to putscp -P 60022 yaoniplan@192.168.10.105:/etc/nixos/configuration.nix /tmp/
# Another way
- References
- https://superuser.com/questions/134901/whats-the-difference-between-scp-and-sftp/1028877#1028877
man scp
man sftp
- ChatGPT
The abbreviation of "Extensible Firmware Interface" is "EFI".
- References
Check who and what in Unix-like
w
- Notes
w
# Who and what
- References
man w
- Output
10:37AM up 1 day, 15:59, 1 user, load averages: 0.30, 0.18, 0.11 USER TTY FROM LOGIN@ IDLE WHAT root pts/0 192.168.10.105 8:38AM - w
Disable the swap files in Vim for a specific directory
autocmd BufNewFile,BufRead ~/ftp_mount/* set dir=/some/path
- Notes
- Haven't tested it yet as I'm not sure I really need this
- References
Read input in Shell script
$#
# Number of argumentif [[ "$#" -ne 0 ]]
if [[ "$#" -eq 2 ]]; then
elif [[ "$#" -eq 1 ]]; then
$1
# The first argument$0
# The name of the script$@
# A list of all arguments${@:2}
# All arguments starting from the second argument- Used when developing scripts with options (e.g.
takeAMemo.sh --no-clipboard yourContent
)
$*
# Expand all arguments to a single wordtrans :zh "$*"
- References
Use "ssh"
ssh bandit0@bandit.labs.overthewire.org -p 2220
- Notes
ssh-copy-id git@192.168.10.100
# Use without password (Run it in local)git@192.168.10.100
# Replace it with server- In fact, it appends client's id_rsa.pub content to server's ~/.ssh/authorized_keys file
ssh-keygen
# Solve the problemyaoniplan@ubuntu2204:~$ ssh-copy-id git@192.168.10.100 /usr/bin/ssh-copy-id: ERROR: No identities found
ssh yaoniplan@192.168.10.100 "bash -lc 'source ~/.local/bin/downloadOffline.sh \"$clipboardContent\"'"
# Use local variablessh yaoniplan@192.168.10.100 'bash -c "source ~/.local/bin/runContainer.sh"' &
# Execute command temporarilybandit0
# Usernamewhoami
# Check user name
bandit.labs.overthewire.org
# Hostip address
# Check address
-p
# Port2220
# Port- In OpenRC
doas rc-update add sshd default
# Add sshd to the default runleveldoas rc-service sshd status
# Get sshd service status
- In Systemd
doas systemctl enable sshd --now
# Enable sshd now on the machine you want to connect to solve the problem[yaoniplan@tux ~]$ ssh yaoniplan ssh: connect to host 100.80.81.110 port 22: Connection refused [yaoniplan@tux ~]$
- If you use USB to share WIFI with your phone, your connection may not respond, the solution is to connect with a network cable
- Solve the problem in Systemd
[yaoniplan@tux ~]$ doas systemctl status ssh doas (yaoniplan@tux) password: Unit ssh.service could not be found. [yaoniplan@tux ~]$
doas emerge -aq net-misc/openssh
# Install it in Gentoo Linuxdoas systemctl enable sshd
# Every time at boot timedoas systemctl start sshd
# Once now
- References
Open a file whose name is hyphen
cat ./-
- Notes
./
# The full location-
# The file
- References
Check system running time in Unix-like
uptime
- Notes
10:30AM up 1 day, 15:52, 1 user, load averages: 0.07, 0.10, 0.08
# Output1 day, 15:52
# The running time
- References
man uptime
Type properly
- Sit straight with your back straight
- Aim for accuracy rather than speed
- Type every day
- not look at the keys while typing
- References
The Linux server can do
- Web server
- Mail server
- Personal cloud storage
- Database
- Remote
- References
Use "xclip"
echo "`date +%F_%T`.gif" | xclip -selection clipboard
- Notes
xclip -selection clipboard
# The same asxsel --input --clipboard
mpv --speed=2 --fullscreen --mute=yes $(xsel --output --clipboard)
# Paste by default
- References
Semicolon do at shell script
- Put two or more commands on the same line
- Execute commands in order
- Notes
sleep 3s; notifi-send "test"
- Execute the sleep command first and then execute the notify-send command
- References
Split a specified buffer in Vim
:vs #5
- Notes
vs
# Vertically split:buffers
# Show all buffers
- References
:help :buffers
:help :vs
- https://vi.stackexchange.com/questions/8122/how-to-open-a-file-from-active-buffer-into-a-split-window
- https://superuser.com/questions/134176/how-to-split-existing-buffer-vertically-in-vim#:~:text=To%20put%20an%20existing%20buffer,of%20the%20next%20split%20command.
- https://vi.stackexchange.com/questions/76/can-i-open-a-new-vim-split-from-an-existing-buffer/21081#21081
Execute two commands at the same time
paplay /usr/share/sound/alsa/Noise.wav & notify-send "test" &
- Notes
&
# Execute in the background
- References
View processes in the background
jobs
# Display status of jobs
- Notes
kill %3
# Kill process 3
- References
Solve the swap file in Vim
R
# Recovery:w
# Write:e
# EditD
# Delete
- References
Run Linux commands in the background
- Press
Ctrl-z
and then typebg
- Press
- Notes
for f in *; do rsync -av "$f" ~/glassShrine/ & done
# Another way&
# Run in the background
- References
- ChatGPT
Write an infinite loop in shell script
vim ~/.local/bin/timerOfTomato.sh
#! /bin/sh soundNotification() { paplay /usr/share/sounds/alsa/Noise.wav } while true; do soundNotification sleep 900 soundNotification sleep 1200 done
- Notes
true
# Improve the readability
- References
Use "wget"
wget --output-document=msyh.ttc https://raw.githubusercontent.com/taveevut/Windows-10-Fonts-Default/master/msyh.ttc
wget --continue yourURL
# Continue interrupted downloadwget -r -np -nH --cut-dirs=2 -R "index.html*" https://data.gpo.zugaina.org/src_prepare-overlay/x11-terms/xst/
- Notes
- Improve download speed (If slow)
export http_proxy="192.168.10.105:7890" export https_proxy="192.168.10.105:7890"
unset http_proxy https_proxy
# Unset--no-proxy
# Another way
-r
# Recursive-np
# No-parent-nH
# No-host-directories (e.g. data.gpo.zugaina.org/)--cut-dirs=2
--cut-dirs
# Cut-directories2
# Two directorys (e.g. src_prepare-overlay/, x11-terms/)
-R
# Rejectindex.html*
# Files (e.g. index.html, index.html?C=N;O=D)-e robots=off
# May need it
- Improve download speed (If slow)
- References
Resolve a problem in Gentoo Linux
doas vim /etc/conf.d/display-manager
CHECKVT=7 DISPLAYMANAGER="sddm"
- Notes
DISPLAYMANAGER="sddm"
# Replace the sddm with your display manager
- References
- Problem
* IMPORTANT: config file '/etc/conf.d/display-manager' needs updating.
- Problem
Use "notify-send"
notify-send "$(cal)"
cal
# Replace it with other command (e.g. date)
- Notes
--expire-time=3600000
# Display for 3600000 milliseconds (Focus on one thing)- Install notify-send
doas emerge -aq x11-libs/libnotify
doas emerge -aq x11-misc/notification-daemon
- Solve the problem
Error spawning command line “dbus-launch --autolaunch=450faa763c2a5a8029678965639ae3a2 --binary-syntax --close-stderr”: Child process exited with code 1
export $(dbus-launch)
# Temporarilyecho 'export $(dbus-launch)' >> ~/.bashrc
# Permanently
- Solve the problem
GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files
doas vim /usr/share/dbus-1/services/org.freedesktop.Notifications.service
[D-BUS Service] Name=org.freedesktop.Notifications Exec=/usr/lib/notification-daemon-1.0/notification-daemon
- References
man cal
- https://wiki.archlinux.org/title/Desktop_notifications
- https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html
- https://unix.stackexchange.com/questions/701206/how-do-i-notify-send-a-long-command
- https://stackoverflow.com/questions/20285697/error-in-spawning-a-dbus-launch-what-is-that
Return to the last used tab in Chromium
- Press
Ctrl-Shift-a
and then pressEnter
- Press
- References
Enclose the shell command in double quotes
foot -e tmux new-session 'vim -c "VimwikiMakeDiaryNote"'
- Notes
- If there are no spaces
> st -e tmux -c vim -c VimwikiIndex child exited with status 127
- If there are no spaces
- References
- ChatGPT
Remap keys in Vim
vim ~/.vimrc
nnoremap <C-H> <C-W>h nnoremap <C-J> <C-W>j nnoremap <C-K> <C-W>k nnoremap <C-L> <C-W>l
- Notes
C-H
# UseCtrl-h
to move cursor to the left panel<C-W>h
# Use<Ctrl-w>h
to move cursor to the left panel too
- References
Modify a specify commit message in Git
dotfiles rebase --interactive '019ae22^'
# Replacepick
withedit
and then:wq
dotfiles commit --amend
# Amend your commit messagedotfiles rebase --continue
dotfiles push --force
- Notes
- Disadvantage
- Modify date
- Disadvantage
- References
The abbreviation of "our extended virtual terminal" is "RXVT".
- References
Don't overthink things and just keep writing stuff down. #idea
- References
Solve the problem about image path in GitHub
- Remove
..
and thengit push
- Remove
- References
I think tools for handling gifs are ImageMagic, GIMP, and others. #idea
- I am trying to use ImageMagic and Byzanz
- GIMP needs to deal with many layers (e.g. a 2.8m gif has about 700 layers)
Replace VimWiki with wiki.vim in the future #idea
Use urxvt (rxvt-unicode)
Font
Scrollbar
Color theme
Font size
- Notes
- Set a color theme
! Colors URxvt*background: #000000 URxvt*foreground: #B2B2B2 ! black URxvt*color0: #000000 URxvt*color8: #686868 ! red URxvt*color1: #B21818 URxvt*color9: #FF5454 ! green URxvt*color2: #18B218 URxvt*color10: #54FF54 ! yellow URxvt*color3: #B26818 URxvt*color11: #FFFF54 ! blue URxvt*color4: #1818B2 URxvt*color12: #5454FF ! purple URxvt*color5: #B218B2 URxvt*color13: #FF54FF ! cyan URxvt*color6: #18B2B2 URxvt*color14: #54FFFF ! white URxvt*color7: #B2B2B2 URxvt*color15: #FFFFFF
- Disable scroll bar
URxvt.scrollBar: false URxvt.scrollBar_right: false URxvt.scrollBar_floating: false URxvt.scrollstyle: rxvt
- Set font
URxvt.font xft:Ubuntu Mono:style=regular
xrdb ~/.Xresources
# Reload the configurationurxvt -fn "xft:Ubuntu Mono:style=regular"
# Test a fontdoas vim /etc/portage/package.use
# In Gentoo Linuxx11-terms/rxvt-unicode-9.30 perl xft
perl
# Support perl scriptxft
# Support for XFT font renderer
- Set a color theme
- References
Insert date and time in Vim
<C-r>=strftime('%F')
# After the cursor (Output: 2023-02-24) in insert mode:r!date
# Below the current line (Output: Fri Feb 24 04:21:34 PM CST 2023)r!date +\%F
# 2023-05-18
- Notes
<C-r>
# Control key and r key:r!
r
# Read!
# Execute external commands (e.g. date, templateForVimWiki.sh)
- References
Replace context of the current line in Vim
:s/italic/boldAndItalic/g
- Notes
s
# Substituteg
# GlobalShift-v
# Select some line:
# Press its/italic/boldAndItalic/g
# Type it
- References
Use Bash
ctrl-i
# Insert (The same asTab
)Ctrl-d
# Detach (The same asexit
)Ctrl-r
# Reverse search history commandvim -c
# Type it in terminal, it may displayvim -c VimwikiIndex
Ctrl-p
# The previous commandAlt-b
orCtrl-Left
# Move the cursor back one wordAlt-c
orCtrl-Right
# Move the cursor forward one wordCtrl-h
# Backspace keyCtrl-d
# Delete keyd
# Delete
Ctrl-u
# Delete left of the cursorCtrl-k
# Delete right of the cursorbind -lp
# Show all shortcutsCtrl-j
# Enter keyCtrl-_
# Undo
- References
Use Rofi theme
git clone https://github.com/newmanls/rofi-themes-collection cd rofi-themes-collection mkdir -p ~/.local/share/rofi/themes/ cp ./* ~/.local/share/rofi/themes/
- Notes
rofi -show drun
# Show drun modeRofi Theme Selector
# Type it in Rofi search barEnter
# PreviewEsc
# CancelAlt-a
# AcceptCtrl-Tab
# Toggle mode
- Beautiful
theme theme theme theme spotlight-dark squared-nord rounded-blue-dark dmenu by Qball nord-TwoLines nord-oneline sidebar-v2 by Qball
- features
- Font: big
- Color: dark
- Icon (optional)
- References
Use gawk
gawk '/use/ && /bash/; BEGIN{IGNORECASE=1}' test/diary/*
gawk 'BEGIN{IGNORECASE=1} /use/ && /bash/' test/diary/*
Width=$(xwininfo --root | gawk '/Width/ {print $2}')
- Notes
&&
# AndBEGIN{IGNORECASE=1}
# Ignore case$2
# The second column
- References
Use GIF recorder named Byzanz
byzanz-record --duration=10 \ --x=0 --y=0 --width=1366 --height=768 \ ~/vimwiki/assets/`date +%F_%T`.gif
- Notes
doas emerge -aq media-gfx/byzanz
# Searchebuild repository
in the repository
- References
Rename extension of multiple files in Linux
find . -name '*.txt' -exec rename txt wiki {} \;
- Notes
-exec
# Executefind . -name "*.md" -exec rename -a _ - {} \;
# Rename underscores to hyphens-a
# All
- References
Use "git"
git clone --branch development git@100.65.173.16:/var/git/diary.git/ ~/.config/diary/
# Clone development branch to ~/.config/diary/ directorydevelopment
# Replace it with your branch name~/.config/diary/
# Replace it with destination path (Optional)
dotfiles rm --cached ~/.local/bin/openMyWebsite.sh
# Untrack a newly added file after using git addgit diff --cached
# Display the difference after using git addgit diff e869181..8b825a6
# After using git commit
git remote set-url --add --push origin git@192.168.10.100:/var/git/note.git
# Add a push URLgit remote --verbose
# Check Git remote URLgit remote set-url origin git@192.168.10.107:/var/git/note.git
# Update the fetch URLgit remote add origin git@100.65.173.16:/var/git/parse.git
# Add a remote named 'origin'error: No such remote 'origin'
git init ~/parse/
# Initialize Git repository in the directory to control version of filesgit add --all
git commit --message="First commit"
git remote add origin git@github.com:yaoniplan/yaoniplan.git
- New a repository in GitHub
git push origin master
git clone https://yaoniplan:yourPersonalAccessToken@github.com/yaoniplan/diary
# Clone a private repositoryyaoniplan
# Replace it with your user nameyourPersonalAccessToken
# Replace it with yours
- Test some files
git reset --hard ca86a59
# Reset to previous versiongit clean --force -d
# Remove untracked files (directories)
dotfiles ls-files
# List tracked filesdotfiles commit --message="Set the default volume to 60 percent (without any arguments)"
# Set commit messagedotfiles push git@192.168.10.100:/var/git/dotfiles.git development
# Push to a specific remote URLgit show 97671e3:index.html
# Show the last committed complete content of a filegit restore .config/i3/config
# Discard changes of the filegit restore .
# Restore all files
git checkout -b development
# The same as the following two commandsgit branch development
# Create a new branchgit checkout development
# Switch to the branch
- Notes
- Use a GitHub mirror when can't access the Internet
- https://github.com/nICEnnnnnnnLee/GithubSoEasy
git clone https://git.yaoniplan.eu.org/yaoniplan/dotfiles
https://git.yaoniplan.eu.org/loginyyy?ko=1
# Access this link first to authorize before using the GitHub front end
add
# Replace it withdelete
to delete the push URL192.168.10.100
# Replace it withgithub.com
/var/git/note.git
# Replace it withyaoniplan/note.git
97671e3:index.html
# Get it by using the following commandgit log -1 --name-only
s testIndex.html
# Save file as testIndex.html in the less command interface- Solve the problem
yaoniplan@tux ~ $ dotfiles push origin development Everything up-to-date ssh: Could not resolve hostname github.com: Temporary failure in name resolution fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. yaoniplan@tux ~ $
- Method one
doas systemctl disable systemd-resolved # May cause the web proxy to become unavaliable nmcli connection show # Get NAME (e.g. eno1) nmcli connection modify eno1 ipv4.dns "8.8.4.4 8.8.8.8" nmcli connection modify eno1 ipv6.dns "2001:4860:4860::8844 2001:4860:4860::8888" doas systemctl restart NetworkManager # Make changes effective
doas vi /etc/resolv.conf
# Method two that the file will be cleared by NetworkManager sometimesnameserver 8.8.4.4 nameserver 8.8.8.8
- Method one
- Solve the problem
yaoniplan@tux ~ $ dotfiles push origin development ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. yaoniplan@tux ~ $
vi ~/.ssh/config
Host github.com Hostname ssh.github.com Port 443
ssh -T git@github.com
- Use a GitHub mirror when can't access the Internet
- References
- https://blog.yowko.com/git-push-multiple-remote-repository/
- https://gist.github.com/miztiik/647c3b67a9c3c3e8a5c857436a59477f
- https://gist.github.com/Tamal/1cc77f88ef3e900aeae65f0e5e504794
- https://hedzr.com/devops/git/git-tips-ls-tree-or-files/
- https://stackoverflow.com/questions/9393409/ssh-could-not-resolve-hostname-github-com-name-or-service-not-known-fatal-th/38343911#38343911
git restore --help
# Replacerestore
(e.g. clone) withremote
- https://learngitbranching.js.org/
h
- ChatGPT
Display
$PATH
echo $PATH
- References
Add a directory to
$PATH
permanentlyvim ~/.bash_profile
# Set PATH to execute scripts anywhere if it exists if [[ -d "$HOME/.local/bin/" ]]; then export PATH="$PATH:$HOME/.local/bin/" fi
- Log out and log back to make changes effective
echo $PATH
# Check it
Notes
-d
# Directory- Advantages
- Execute scripts anywhere
$HOME/.local/bin/
# Replace it with your directorychmod u+x ~/.local/bin/captureFullScreen2GIF.sh
# Make the command worku
# Userx
# Execute
captureFullScreen2GIF.sh
# Execute it anywhere, and works in the dmenu tooPATH=$PATH:$HOME/.local/bin/
# Add the directory to$PATH
temporarily
- References
Put scripts to directory
$HOME/.local/bin/
# A single user/usr/local/bin/
# All users
- References
Show line numbers permanently in Vim
vim ~/.vimrc
" Show absolute line numbers set number
- Notes
set relativenumber
# Show relative line numbersset number relativenumber
# Show absolute and relative line numbers- After using it for a while, It can be distracting.
- Probably because I'm using a small screen.
- References
Use "vim"
- Record a repeating action
qd
# Start recording as dq
# Stop recording@d
# Playback recording d
:%s/^\n//g
# Remove blank lines^
# Beginning of line\
# Escapen
# Newline
*
# Search for the word under the cursorn
# Jump to the next (Opposite:N
)
:%s/$/\=printf('%02d', line('.')+1).'.MP4'/g
# Add the line number plus one to the end of each line\=
# Expressionprintf()
# A funcation%02d
# A zero-padded two-digit integer (Optional)line('.')+1
# Add 1 to the current line number.'.MP4'
# Concatenate the formatted number with.MP4
(Optional):%s/$/\=printf(line('.'))/g
# This works too
:%s/\v\d{2}\.MP4$//g
# Remove what the above command generates\v
# Very magic mode\d{2}
# Two digits\
# Escape character
q:
# Command line mode (Query recent command)/
# Search:q
# Quit
Ctrl-w :term
# New a terminal if tmux does not exist:!cat % | wl-copy
# Copy current file's content to clipboard!
# Execute external commands (e.g. cat, rm, etc.)%
# Current file
:%s/$/ - 00/g
# Batch add a string (e.g. ' - 00') to the end of line:set encoding=utf-8
# Display Chinese characters properly:set paste
# Fix indentation issues when pasting%
# Jump the cursor to matching bracket>>
# Indent current line (like>l
,v>
)o
# Insert a new line below the cursoru
# UndoCtrl-r
# Redo
daw
# Delete a word.
# Repeat last change
vU
# Uppercasev
# Visual mode
s
# The same asx
and theni
L
# Bottom of screenH
# Top of screenM
# Middle of screenf
# Find a character within a lineW
# The same asw
, but ignore symbol (punctuation)I
# Insert text before the first non-blank in the lineA
# Append text at the end of the line/\vtext|vim
# Search for text with multiple keywords\v
# Very magic
:set ignorecase
# Search for text ignoring case/thank\c
# Search for "thank" ignoring case
:vs
# Vertically split (real-time synchronization)caw
# Change a wordc
# Change
:e#
orC-6
# Switch between two filesC-o
# Return to the previous cursor position''
# Return to the previous line
C-p
# Previous keyword completion (in insert mode)C-n
# Next keyword completionC-[
# Esc keygM
# Move cursor to the middle of a liner
# Replace- Mark
ma
# Mark as "a"`a
# Jump to mark "a"
Ctrl-w down/j
# Move the cursor from the up pane to the down pane
- Record a repeating action
- Notes
- Manage plugins with built-in package manager
git clone https://github.com/vimwiki/vimwiki ~/.vim/pack/vendor/start/vimwiki
# Install a plugingit -C ~/.vim/pack/vendor/start/vimwiki/ pull
# Update a pluginmv ~/.vim/pack/vendor/start/vimwiki/ /tmp/
# Remove a plugin- Because it is more convenient than traditional plugin managers.
vim ~/.vimrc
# Replace tab characters with spaces" Use spaces for indenting set expandtab " Replace tab characters with spaces set tabstop=4 " Insert 4 spaces when expandtab is enabled set shiftwidth=4 " Replace indentation with spaces set smartindent " Adjust indentation based on syntax automatically
:e
# Edit- Replace
js
withjavascript
in Markdown code block
- Replace
#
# Alternate buffer:ls
or:buffers
# Check buffer:b 7
# Move to buffer 7
- Manage plugins with built-in package manager
- References
- https://vim.fandom.com/wiki/Recording_keys_for_repeated_jobs#:~:text=To%20start%20recording%2C%20press%20q,keystrokes%20to%20the%20specified%20register.
- https://missing-semester-cn.github.io/2020/editors/
- https://vimhelp.org/repeat.txt.html#packages
- https://web.archive.org/web/20230130013710/https://codingshower.com/vim-set-tab-to-n-spaces/
:help /\v
\n
:help .
- https://stackoverflow.com/questions/2946051/changing-case-in-vim/2946054#2946054
- https://m4xshen.me/posts/vim-basic-commands/
- https://unix.stackexchange.com/questions/114264/is-there-a-command-reverse-search-in-vim
- https://stackoverflow.com/questions/704434/is-there-any-way-to-highlight-multiple-searches-in-gvim
- https://docs.oracle.com/cd/E19620-01/805-3902/6j3n40vuh/index.html#:~:text=Searches%20normally%20are%20case%2Dsensitive,stop%20at%20its%20first%20occurrence.
- https://medium.com/@Sohjiro/introduction-to-vim-buffers-dd966ff518d
- https://stackoverflow.com/questions/19971023/how-to-go-back-to-previous-opened-file-in-vim
- https://vi.stackexchange.com/questions/2462/how-do-i-move-the-cursor-to-the-center-of-current-line
- ChatGPT
Rcover tmux when computer is turned on
vim ~/.bashrc
alias mux='pgrep -vx tmux > /dev/null && \ tmux new-session -d -s delete-me && \ tmux run-shell ~/.tmux/plugins/tmux-resurrect/scripts/restore.sh && \ tmux kill-session -t delete-me && \ tmux attach-session || tmux attach-session'
- Notes
- I don't need it on January 20, 2023.
vim ~/.tmux.conf
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' # Set restore automatically by using tmux-continuum set -g @continuum-restore 'on' # Set start automatically by using tmux-continuum set -g @continuum-boot 'on' # Set the save interval to 1 minute set -g @continuum-save-interval '1'
prefix + I
# Press it to install the pluginstmux source-file ~/.tmux.conf
# Reload the file-v
# Inverse-x
# Exact/dev/null
# Empty file&&
# And-d
# Detach-s
# Session-namerun-shell
# Run shell-command-t
# Target||
# Or
- References
Use "crontab"
crontab -e
0~59 8 * * * $HOME/.config/checkIn/.venv/bin/python $HOME/.config/checkIn/checkIn.py * * * * * /usr/bin/bash /home/yaoniplan/.tmux/plugins/tmux-resurrect/scripts/save.sh @reboot /usr/bin/touch /home/yaoniplan/testTwo.md 30 16 * * * /usr/bin/bash $HOME/.local/bin/pushCode.sh
- Notes
* * * * *
# Every minute when the computer is running53,54,55 11 * * *
# At 11:53, 11:54, and 11:5553
# 53rd minute11
# 11th hour0~59 8 * * *
# At a random minute between 8:00 and 8:59*/5 * * * *
# Every 5 minutes is an interval*
# Every/
# Interval0 */6 * * *
# Every 6 hours is an interval0
# Specify the exact minute of the hour (0th minute)- 24 Hours divided by 6 Hours equals 4 intervals
/usr/bin/bash
# Path of commandwhich bash
# Get it
/home/yaoniplan/.tmux/plugins/tmux-resurrect/scripts/save.sh
# Argument of command@reboot
# Every time when the computer is turned on30 16 * * *
# 16:30 every day- Make the changes effective
- In OpenRC
doas rc-update add cronie default doas /etc/init.d/cronie start
- In Systemd
doas systemctl enable cronie doas systemctl start cronie
- In OpenRC
- References
Save file automatically in Vim without plugins
vim ~/.vimrc
autocmd TextChanged,TextChangedI * silent write
- Notes
- Try not to use it, accidents may happen
- References
Disable swap files in Vim for VimWiki
vim ~/.vimrc
set noswapfile
- Notes
ls ~/.cache/vim/swap/
# View the default swap file- I don't recommend it, but you can organize swap files
mkdir ~/.vim/tmp/
vim ~/.vimrc
set directory^=$HOME/.vim/tmp//
- References
Use "vimwiki"
:VimwikiTable 4cols 6rows
# Create a table with 4 cols and 6 rows:VimwikiGenerateLinks
# Generate links of wiki pages automatically]]
# Next headervim -c VimwikiIndex
# Return index.wiki in terminal<Leader> ww
# Return index.wiki
vim -c VimwikiMakeDiaryNote
# Return to today's diary (e.g. 2023-01-18.md)<Leader> w <Leader> w
# Return 2023-01-18.md
Ctrl-upArrow
# The previous diary:VWS /Use VimWiki/
# Search 'Use VimWiki':VWS
# The alias of:VimwikiSearch
:VWS /\csymbol/
\c
# Case-insensitive
:lopen
# List open:lnext
=
# Add header levelgll
# Increase indent of list itemglh
# Decrease indent of list itemgl-
# Insert hypen (-
)Ctrl-space
# Add a check box ([ ]
)/Add aX
/Remove aX
- Notes
vim ~/.vimrc
# Configure as needed" Make plugins named VimWiki work set nocompatible filetype plugin on syntax on " Use Markdown syntax for VimWiki " Replace `diary/` with `journals/` let g:vimwiki_list = [{ \ 'path': '~/.config/note/', \ 'diary_rel_path': 'journals/', \ 'syntax': 'markdown', \ 'ext': '.md'}] " Replace `[Vim](Vim)` with `[Vim](Vim.md)` " Refer to https://github.com/vimwiki/vimwiki/issues/1210 let g:vimwiki_markdown_link_ext = 1 " Disable all Concealing (level: 0-3) let g:vimwiki_conceallevel = 3 " Disable URL shortening let g:vimwiki_url_maxsave = 0 " Replace spaces in the file names with underscores let g:vimwiki_links_space_char = '_' " Change leader key from '\' to ' ' let mapleader = " " " Map the keys to complete strings " (n: normal; nore: non-recursive) " (`<Left>`: Move cursor one position to the left) nnoremap <leader>w/ :VimwikiSearch //<Left> " `<CR>` # Carriage Return (Same as `<Enter>`) nnoremap <leader>it :InsertTemplateText<CR>
- Advantage: Wiki
Enter
# Press it to create a wiki file../pages/Vim
# Create~/vimwiki/pages/Vim.md
file
Tab
# Next wiki link or hyper linkShift-Tab
# Previous wiki linkv
# Visuale
# End
git clone https://github.com/vimwiki/vimwiki ~/.vim/pack/vendor/start/vimwiki
# Install dependencies
- References
- https://overflow.smnz.de/questions/446269/can-i-use-space-as-mapleader-in-vim
:help VimwikiTable
- https://www.reddit.com/r/vim/comments/8xzpkz/you_probably_dont_need_vimwiki/
- https://samgriesemer.com/Vimwiki#Settings
- https://gist.github.com/ovelny/72659e841c1dbcee173eb244c8609252
- https://vi.stackexchange.com/questions/19357/search-through-entire-vimwiki#:~:text=Vimwiki%20has%20a%20simple%20search,help%20pages%20%3Ah%20%3AVimwikiSearch%20.
- https://github.com/vimwiki/vimwiki
- ChatGPT
Use "ps"
ps aux | grep clash
kill 3828
- Notes
ps
# Process statusa
# Allu
# Userx
# Use with thea
option3828
# PIDPID
# Process ID
- References
The punctuation of "at sign" is "@".
- References
Use tmux plugins named tmux-tilish
Alt-Enter
# New a paneAlt-h/j/k/l
# Move the cursor to the left/down/up/right paneAlt-Shift-q
# Quit the paneAlt-z
# Zoom inAlt-Shift-h/j/k/l
# Move paneAlt-Shift-1/2/3
# Move pane or window to window 1/2/3Alt-s
# Split like -Alt-v
# |
- Notes
- Install the plugins
vim ~/.tmux.conf
# Lists of plugins set -g @plugin 'jabirali/tmux-tilish' # Set default layout by using tmux-tilish plugin set -g @tilish-default 'main-vertical'
- Integrate Vim and tmux
vim ~/.tmux.conf
set -g @plugins 'sunaku/tmux-navigate' " Use navigate with tilish together set -g @tilish-navigate 'on'
prefix I
# Install plugins of tmux
vim ~/.vimrc
Plug 'sunaku/tmux-navigate'
:source ~/.vimrc
PlugInstall
# Install plugins of Vim
Alt-h/j/k/l
# Move cursor in Vim to the left/down/up/right pane of tmux:vs
# A pane of VimAlt-Enter
# A pane of tmux
- Warning: Not suitable for use with tiling window managers (e.g. i3, DWM, etc.)
- Shortcut key conflict
- Install the plugins
- References
Set dark theme in #Linux
vim ~/.config/gtk-3.0/settings.ini
[Settings] gtk-application-prefer-dark-theme=1
- Notes
- Chromium
about:settings
# Type it in search barCtrl-f
# Press it and typeappearance
Use GTK
# Click it
doas reboot
# Make it work- It works on the notify-send command.
- Chromium
- References
Move all images from multiple subfolders into one directory
find . -name '*.png' -exec mv {} ../testone/ \;
- Notes
*.png
# Files with PNG extensionpng
# Replace it with other extensions (e.g. jpg, gif, etc.)
- References
Install a plugins manager for Vim
- Type it in terminal
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Type it in terminal
- Notes
-f
# Fail-L
# Location-o
# Outputbackslash
# A new line- Write the rest of command on the next line
- References
Use Vim plugins manager
vim ~/.vimrc
# A small configurationcall plug#begin() Plug 'vimwiki/vimwiki' Plug 'sunaku/tmux-navigate' Plug 'dbridges/vim-markdown-runner' call plug#end()
:source ~/.vimrc
# Restart Vim
- Notes
- Install plugins
:source ~/.vimrc
:PlugInstall
- Remove plugins
- Comment out
:source ~/.vimrc
:PlugClean
- Update plugins
:PlugUpdate
- Upgrade vim-plug itselt
:PlugUpgrade
- Install plugins
- References
Use "vi"
set -o vi
# Enable Vi mode in the Linux shellZZ
# Same as:wq
:%s/espeak/gtts\-cli/g
# Replace espeak with gtts-cli globally- Use four space for indenting temporarily
:set tabstop=4
1G
# Move cursor to the first line
- Notes
!$
# The last argument of the last command (Or$_
,!!:$
,Alt-Shift-Hypen
)Ctrl-[
# The same asEsc
key (Ctrl-c
is ok if no[
key)_
# Last argument of last commandd$
# Same asCtrl-k
of Emacs modeCtrl-l
# Clear screenk
# The same asCtrl-p
of Emacs mode/
# The same asCtrl-r
of Emacs mode
set -o
# Show the current settingsvi ~/.bashrc
# Method one that enable by default# Enable Vi mode set -o vi bind -m vi-command 'Control-l: clear-screen' bind -m vi-insert 'Control-l: clear-screen'
set -o emacs
# Enable Emacs mode
vi ~/.inputrc
# Method two that enable by defaultset editing-mode vi $if mode=vi set keymap vi-command Control-l: clear-screen set keymap vi-insert Control-l: clear-screen $endif
- Because to try to replace Vim with Vi and for portability.
- Use external scripts and commands
- References
- https://libreddit.perennialte.ch/r/ish/comments/13198h8/permissions_issues_and_startup_commands/
- https://unix.stackexchange.com/questions/197005/recover-last-argument-of-the-last-command-in-bash-vi-mode/202589#202589
- https://unix.stackexchange.com/questions/155702/how-to-recall-last-argument-in-bash-with-vi-setting/157021#157021
- https://unix.stackexchange.com/questions/104094/is-there-any-way-to-enable-ctrll-to-clear-screen-when-set-o-vi-is-set/104101#104101
- https://wiki.gentoo.org/wiki/Bash
:set all
- ChatGPT
Use TPM (tmux plugins manager)
mkdir -p ~/.tmux/plugins/
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
vim ~/.tmux.conf
# Lists of plugins set -g @plugin 'tmux-plugins/tpm' # Initialize tmux plugins manager # (Put this line at the bottom) run -b '~/.tmux/plugins/tpm/tpm'
tmux source ~/.tmux.conf
# Reload tmux
- Notes
- Install plugins
vim ~/.tmux.conf
set -g @plugin 'tmux-plugins/yank'
- Press
prefix
+I
I
# Install
- Uninstll plugins
vim ~/.tmux.conf
# set -g @plugin `tmux-plugins/yank`
- Press
prefix
+Alt
+u
u
# Uninstall
- Install plugins
- References
- Add a README to #GitHub when using a bare #Git repository
mkdir ~/.github/
vim ~/.github/README.md
- References
Use "picom"
- Fading
fading = true;
- Shadow
shadow = true;
- Rounded corner
corner-radius = 9; backend = "glx";
- Opacity
active-opacity = 1.0; inactive-opacity = 0.8; frame-opacity = 0.8; opacity-rule = [ "80:class_g = 'st-256color'" ];
- Background blur
blur-method = "dual_kawase"; backend = "glx";
- Fading
- Notes
xprop
# Get the class_g (e.g. Chromium)WM_CLASS(STRING) = "chromium", "Chromium"
vim ~/.config/picom.conf
# Edit the configuration filedoas emerge -aq x11-misc/picom
# Install the package- Make the changes effective
ps aux | grep picom
# Get the PIDkill yourPID
# Kill itpicom &
# Enable it again
- References
Add a #patch in [[Gentoo Linux]]
doas mkdir -p /etc/portage/patches/x11-terms/st-0.8.5/
doas cp ~/st-alpha-0.8.5.diff /etc/portage/patches/x11-terms/st-0.8.5/
cd /usr/portage/x11-terms/st/
doas ebuild ./st-0.8.5.ebuild clean prepare
doas mv /etc/portage/patches/x11-terms/st-0.8.5/st-alpha-0.8.5.diff /tmp/
doas emerge -q x11-terms/st
- Notes
cd /usr/portage/x11-terms/st/
# Change the package's ebuild repositorydoas mv /etc/portage/patches/x11-terms/st-0.8.5/st-alpha-0.8.5.diff /tmp/
# Remove the patch from the directory (Prevent compilation failure)
- References
Set prompt for Bash
doas emerge -q app-shells/starship
# Install Starshipvim ~/.bashrc
# Setup the Shell (Bash) to use Starshipeval "$(starship init bash)"
starship preset plain-text-symbols > ~/.config/starship.toml
# Configure Starship
- Notes
- After using Starship for a while, I think the default is the best.
- To keep it maintainable on Linux servers.
- After using Starship for a while, I think the default is the best.
- References
Add a ebuild repository in Gentoo Linux
eselect repository list
doas eselect repository enable augaina
doas emaint sync -r zugaina
doas emerge -aq media-fonts/nerd-fonts
- Notes
eselect repository list -i
# List installed-i
# Installed
doas eselect repository remove zugaina
# Remove the ebuild repository
- References
man repository.eselect
- eselect/repository - Gentoo Wiki
Extract a ".zip" file
unzip FiraCode.zip
- Notes
-O GB18030
# If file name displays garbled characters-d ./FiraCode/
# An optional directory to which to extract filesnix profile install nixpkgs#unzip
# Install dependencies- Warning: This
-O
option is no longer supported on March 24, 2024 when using Nix. doas pacman --sync unzip
# Install dependencies to solve the problem
- Warning: This
python
# Another method>>> import zipfile >>> with zipfile.ZipFile('archive.zip', 'r') as zip_ref: ... zip_ref.extractall() ... >>>
- References
Set random wallpaper with #Feh
crontab -e
* * * * * DISPLAY=":0.0" feh --randomize --bg-fill ~/app/wallpaper/*
- Notes
* * * * *
# Every minute
- References
Use "feh"
- Fill window
feh --keep-zoom-vp {1..9}.jpg
feh --zoom 80 {1..9}.jpg
feh --scale-down {1..9}.jpg
# View them with automatically zoon
feh --bg-fill $HOME/note/assets/dark.jpg
# Set wallpapern / space
# Next image!
# Zoom the image to fill the size of window (like--bg-fill
)Alt-upArrow
# Scroll up one pagefeh /mnt/grow/220824wallpaper/
# Enable slideshow modeCtrl-upArrow
# Move upleftArrow
# Previous imageupArrow
# Zoom inCtrl-Delete
# Delete the current image
- Fill window
- Notes
vim ~/.config/feh/themes
# Set the background to blackfeh --image-bg black
mkdir ~/.config/feh/
# Make the directory If you don't have it
d
# Draw filename/mnt/grow/220824wallpaper/
# Replace it with your directory including wallpaperhttp://192.168.10.100:5244/d/grow/2023-06-06/230605takeTheAdmissionTicketAboutExamination.jpg
# Use URL of image (Another way)
feh -i /mnt/grow/220824wallpaper/
# Indexfeh -m /mnt/grow/220824wallpaper/
# Montagefeh -t /mnt/grow/220824wallpaper/
# Thumbnailsfeh -w /mnt/grow/220824wallpaper/
# Multiwindowfeh -l /mnt/grow/220824wallpaper/
# List
- References
[[Zoom in]] is enlarge #Idea
in
# Near big
Use "dotfiles"
- First use
git init --bare $HOME/.dotfiles echo "alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME/'" >> $HOME/.bashrc source ~/.bashrc dotfiles config --local status.showUntrackedFiles no dotfiles status dotfiles add .bashrc dotfiles commit -m "Add .bashrc" dotfiles remote add origin git@github.com:yaoniplan/dotfiles.git dotfiles push -u origin master
- Second machine
git clone --bare https://github.com/yaoniplan/dotfiles.git $HOME/.dotfiles echo "alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME/'" >> $HOME/.bashrc source ~/.bashrc dotfiles checkout dotfiles config --local status.showUntrackedFiles no
- First use
- Notes
git clone --branch development git@100.65.173.16:/var/git/diary.git/ ~/.config/diary/
# Clone development branch to ~/.config/diary/ directorydotfiles config --local status.showUntrackedFiles no
# Hide untracked files- Replace ".bashrc" with your file name (e.g. .zshrc)
- Replace "yaoniplan" with your user name
- References
Replace /etc/environment with ~/.bash_profile in #Linux
vim ~/.bash_profile
# Set proxy export http_proxy="127.0.0.1:7890" export https_proxy="127.0.0.1:7890" export no_proxy="localhost, 127.0.0.1"
- Put them at the top of the file
- Notes
- Advantages
- Set environment permanently
- Prevent /etc/environment file from being initialized
- Advantages
1 inch = 2.54 centimeters #Idea
- Notes
- 0.5 inch = 1.27 centimeters
- References
Use #todotxt in #Linux
todocli add "Buy soap"
# Add it to todo.txt filetodocli list
# List todotodocli done 1
# Mark 1 donetodocli replace 1 "Buy some soap"
# Replace a tasktodocli pri 4 A
# Prioritize task (4) to the highest level (A)todocli append 10 "https://wiki.gentoo.org/wiki/Neofetch"
# Append task (10) text to the end of the linetodocli depri 7
# Deprioritize (remove the priority) task (7)todocli help
# Display help
- Notes
todocli
# An aliasvim ~/.bashrc
alias todocli=todo.sh complete -F _todo todocli
source ~/.bashrc
# Make changes effective
- References
Install #todotxt in [[Gentoo Linux]]
doas emerge -aq app-misc/todo
bzcat /usr/share/doc/todo-2.12.0-r2/todo.cfg.bz2 > ~/.todo/config
- Notes
- Clik this link If you have a question about "have been masked"
bzcat /usr/share/doc/todo-2.12.0.r2/todo.cfg.bz2 > ~/.todo/config
mkdir ~/.todo/
# Make the directory if you don't have it
- References
Choose a toothbrush
bristles
head
handle
no reason to return
- Notes
- soft bristles
- Protect teeth and gums
- small head
- Reach hard-to-reach places (e.g. back teeth)
- non-slip handle
- optional: powered toothbrush
- Make brushing easier
- Using
- Replace the brush head every 3 months (or when the bristles begin to show wear)
Replace
# Bristles may trap bacteria leading to reinfection
- Don't brush teeth sideways, brush up and down
- Replace the brush head every 3 months (or when the bristles begin to show wear)
- soft bristles
- References
The abbreviation of "potential of hydrogen" is "pH".
- References
Choose a soap
pH
fatty acids
glycerin
- Notes
- Sensitive skin
- No artificial fragrances
- No alcohol
- No sulfates
- Sensitive skin
- References
Downgrade for software in [[Gentoo Linux]]
doas emerge =media-gfx/flameshot-11.0.0
- Notes
=media-gfx/flameshot-11.0.0
equery list -po flameshot
# Check what package versions are available-p
# Portage-tree-o
# Overlay-tree
- References
Set a proxy for the phone when the phone does not have proxy software
- HTTP (e.g. web browser)
- Proxy settings: Manual
- Proxy hostname: 192.168.10.107
- Proxy port: 7890
- Socks5 (e.g. Telegram)
- Server: 192.168.10.107
- Port: 7891
- HTTP (e.g. web browser)
- Notes
192.168.10.107
ip address
# Get computer IP addressinet 192.168.10.107/24 brd 192.168.10.255 scope global dynamic noprefixroute eno1
- Advantages
- Faster than using mobile proxy software
- Disadvantages
- Keep computer on
- References
The abbreviation of "Portable Network Graphics" is "PNG".
- A format
- Lossless
- References
Print system information in Shell
uname
- Notes
uname -a
-a
# All
- References
man uname
Reasons for the air switch to trip: overload protection, circuit short circuit and leakage. #idea
- References
Eating fried food can seriously damage body organs (e.g. mouth, throat, etc.). #idea
Check dependencies of a package in Gentoo Linux
equery g x11-misc/cdm
- Notes
equery g x11-misc/cdm
g
# graphemerge --search CDM
# Search in ebuild repository if you don't know its full name
- References
equery --help
man emerge
- https://wiki.gentoo.org/wiki/Equery
Write a conditional judgment in Linux Bash
if [[ "$numberOfFiles" -gt 30 ]]; then
- Notes
-gt
# Greater than
- References
- ChatGPT
Dust damages the lungs. #Idea
Execute a script at boot time in [[Gentoo Linux]] with #OpenRC
doas vim /etc/local.d/script.start
doas chmod a+x /etc/local.d/script.start
- Notes
doas vim /etc/local.d/script.start
#!/usr/bin/env bash # Set the brightness to 20% (976/4882) echo 976 > /sys/class/backlight/intel_backlight/brightness
- A script about brightness
- References
The #abbreviation of [[Et Cetera]] is #etc in #Linux.
- References
Write a #Shell script in #Linux
vim dotfiles.sh
#!/usr/bin/env sh
- Notes
./dotfiles.sh
# Execute the scriptchmod u+x dotfiles.sh
# Solve a problem about permission denied
- References
Check when a #GitHub account was created
https://api.github.com/users/yaoniplan
- Notes
api.
# Add it beforegithub.com/
users/
# Add it aftergithub.com/
yaoniplan
# Replace it with a name of user
- References
- Where can we check how old is a github account ? : github- #### The punctuation of "tilde" is "~".
- References
Use "ln"
ln --symbolic ~/.config/i3/config ./i3/config
ln
# Link
- Notes
unlink ./i3/config
# Remove a symbolic link~/.config/i3/config
# A hard link./i3/config
# A symbolic linkmkdir ./i3/
# Make a directory before using the ln command
- Optional: Check the symbolic link and the hard link
ls -l ./i3/config
- Because to make a symbolic link on Linux.
- References
Use "tmux"
C-b [
# Enter copy modeC-b ,
# Rename the current windowC-b C-o
# Move lower pane up (Make sure the cursor is in the up pane)C-b {
# Move the current pane upC-b !
# Break pane to a windowC-b z
# Zoom (Make a pane larger or smaller)C-b ?
# HelpC-b w
# Windows of tree modeC-b c
# Create a windowC-b l
# Last window (previously used)
C-b "
# Split down (Split right:C-b %
)C-b ;
# Last pane (previously used)
C-b space
# switch to the next layoutC-b :
# Prompt for a command (Vim-like)bind-key f display-popup -w 50 -h 30 -E "tmux new -s popup"
# Bind a keyC-b f
temporarilynew-window
# New a windowkill-pane
# The same asC-b x
join-pane -t 1
# Join panebreak-pane
# Break pane to a windowmove-window -t 2:2
# Move window to another sessionkill-session -t 15
# Kill session target 15kill-window -t 1
# Kill window 1kill-pane -t 1
# Kill pane 1C-b arrowKey
# Change the active panesplit-window -h
# Horizontalsplit-window -v
# Verticalattach -t 1
# attach session 1rename-session 0
# Rename session (active) to 0rename-window 1
# Rename window (active) to 1source-file ~/.tmux.conf
# Reload the Tmux configuration file
- Notes
vim ~/.tmux.conf
# Toggle floating scratchpad # Bind a key bind-key -n M-Space if-shell -F '#{==:#{session_name},scratch}' { detach-client } { display-popup -E -w 100% -h 50% "tmux new-session -A -s scratch" }
M-Space
# Replace it with your desired key (e.g.M-f
)scratch
# Replace it with your desired name (e.g.fzf
)display-popup -E "tmux new-session -A -s fzf 'ls ~/.local/bin/ | fzf | sh'"
# Interact with fzf-w 100% -h 50%
# Customize the width and height (Optional)
vim ~/.tmux.conf
# Hide status bar to show more space set -g status off
-g
# Global
vim ~/.tmux.conf
# Retain more history when scrolling up set -g history-limit 50000
vim ~/.tmux.conf
# Copy text from tmux to clipboard in Linux# Enable Vi mode set -g mode-keys vi bind -T copy-mode-vi 'v' send -X begin-selection bind -T copy-mode-vi 'C-v' { send -X begin-selection ; send -X rectangle-toggle } bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -selection clipboard"
Ctrl-v
# Visual block mode (Default:Ctrl-b [ v Ctrl-v
)doas emerge -aq x11-misc/xclip
# Install in Gentoo Linuxxclip -selection clipboard
# Replace it withwl-copy
on Wayland
vim ~/.tmux.conf
# Avoid triggering bound keys accidentally# Set the escape time to 0 set -sg escape-time 0
-s
# Sessions
vim ~/.tmux.conf
# Solve a problem aboutjoin-pane -t 0
# Set the base index to one set -g base-index 1
tmux ls
# List all sessionsls
# list-sessions
tmux attach-session -t 1
# Attach session 1tmux kill-server
# kill all server (e.g. sessions, windows, and panes)
- References
- https://github.com/tmux/tmux/blob/c07e856d244d07ab2b65e72328fb9fe20747794b/regress/conf/01840240e807e837dbf76d85b4b938de.conf#L805
- https://github.com/tmux/tmux/issues/992
- https://libreddit.nohost.network/r/tmux/comments/129ct3a/is_there_a_way_to_pin_a_slipt_pane/
man tmux
#/mode-keys
- https://wiki.gentoo.org/wiki/Tmux
- https://github.com/jbranchaud/til/blob/master/tmux/break-current-pane-out-to-separate-window.md
- https://leimao.github.io/blog/Tmux-Tutorial/
- https://gist.github.com/russelldb/06873e0ad4f5ba1c4eec1b673ff4d4cd
- https://github.com/tmux/tmux/wiki/Getting-Started
- https://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting-ubuntu/
- ChatGPT
Replace sudo with doas in Gentoo Linux
sudo emerge -aq app-admin/doas
sudo vim /etc/doas.conf
sudo vim ~/.bashrc
- Notes
sudo vim /etc/doas.conf
# Allow all users in the wheel group to execute any command as root permit :wheel # Allow a user to use a command (e.g. reboot, poweroff, etc.) without a password permit nopass yaoniplan cmd reboot permit nopass yaoniplan cmd poweroff
sudo vim ~/.bashrc
# Configure completion for doascomplete -cf doas
su root
# Substitute root if your doas doesn't work
- References
The abbreviation of "application programming interface" is "API".
- A way
- To communicate
- References
The abbreviation of "Advanced Linux Sound Architecture" is "ALSA".
- A software framework
- References
Set USE flag temporarily in [[Gentoo Linux]]
sudo USE="minimal" emerge -aq media-libs/libsndfile
sudo USE="-pulseaudio" emerge -aq media-sound/mpg123
sudo emerge -aq pulseaudio
- Notes
- If you have the problem
It might be possible to break this cycle by applying any of the following changes: - media-libs/libsndfile-1.1.0-r1 (Change USE: +minimal) - media-sound/mpg123-1.31.1 (Change USE: -pulseaudio) Note that this change can be reverted, once the package has been installed. Note that the dependency graph contains a lot of cycles. Several changes might be required to resolve all cycles. Temporarily changing some use flag for all packages might be the better option.
sudo USE="minimal" emerge -aq media-libs/libsndfile
USE="minimal"
# Add it between sudo and emerge
sudo USE="-pulseaudio" emerge -aq media-sound/mpg123
-
# Cancel
- If you have the problem
- References
The #abbreviation of
/var
is #variable in #Linux. #Idea- References
Use ebuild repository in Gentoo Linux
doas eselect repository create test
doas mkdir -p /var/db/repos/test/app-misc/logseq/
doas vim /var/db/repos/test/app-misc/logseq/logseq-0.8.8.ebuild
doas chown -R portage:portage /var/db/repos/test/
cd /var/db/repos/test/app-misc/logseq/
doas ebuild ./logseq-0.8.8.ebuild manifest
sudo emerge -aq app-misc/logseq
- Notes
doas eselect repository create test
# Create an empty ebuild repository named testdoas emerge -aq app-eselect/eselect-repository
# Install it if you don't have it
doas vim /var/db/repos/test/app-misc/logseq/logseq-0.8.8.ebuild
# Create the ebuild file named logseq-0.8.8logseq-0.8.8.ebuild
# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit unpacker
DESCRIPTION="A privacy-first, open-source platform for knowledge management and collaboration" HOMEPAGE="https://logseq.com/" SRC_URI="https://github.com/logseq/logseq/releases/download/${PV}/Logseq-linux-x64-${PV}.zip" S="${WORKDIR}"
LICENSE="GNU Affero General Public License v3.0"
SLOT="0" KEYWORDS="~amd64"
IUSE=""
#RESTRICT="strip"
RDEPEND=""
DEPEND="${RDEPEND}"
BDEPEND=""
src_unpack() { unpack_zip ${A} }
src_install() {
dodir "/opt/logseq" insinto "/opt/logseq" cd "${WORKDIR}/Logseq-linux-x64/" doins -r "." fperms +x "/opt/logseq/Logseq" cd "/opt/logseq" dosym "/opt/logseq/Logseq" "/usr/bin/Logseq"
}
app-misc/
# A category (e.g. app-misc, app-editors, etc.) directorylogseq/
# A package (e.g. logseq, vim, etc.) directory0.8.8
# A package version (e.g. 0.8.8, 9.0.0099, etc.)
doas chown -R portage:portage /var/db/repos/test/
portage:portage
# root:root
doas ebuild ./logseq-0.8.8.ebuild manifest
# Create the package's manifest file- Faster than
doas pkgdev manifest
- Faster than
- References
Understand an #idiom about #惨不忍睹. #idea
- Notes
睹
# Look with eyes
- References
Check the file size of a directory in #Linux
du -sh note/
- Notes
du
# Device usage-s
# --summarize-h
# --human-readablenote/
# a directory
- References
man du
Create a .desktop file for application in Linux
sudo vim /usr/share/applications/logseq.desktop
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Terminal=false Exec=/usr/bin/Logseq Name=Logseq Icon=logseq
- Notes
Exec=/usr/bin/Logseq
# Replace /usr/bin/Logseq with a executable path of applicationName=Logseq
# Replace logseq with a name of application
- References
- The #abbreviation of #initialization is #init. #Idea
- Notes
- A daemon process
- Refernces
- Understand the #OpenRC #Idea
- Notes
- A #init system
- References
Use "OpenRC"
doas rc-service display-manager status
doas rc-service display-manager start
doas rc-update del display-manager default
doas rc-update add display-manager default
- Notes
dispaly-manager
# Replace it with your servicedel
# Delete/etc/init.d/display-manager
# The same as rc-service display-manager
- References
Modify brightness in Gentoo Linux
sudo emerge -aq sys-power/acpilight
sudo usermod -a -G video yaoniplan
sudo vim /etc/udev/rules.d/90-backlight.rules
# Allow video group to control backlight and leds SUBSYSTEM=="backlight", ACTION=="add", \ RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness", \ RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness" SUBSYSTEM=="leds", ACTION=="add", KERNEL=="*::kbd_backlight", \ RUN+="/bin/chgrp video /sys/class/leds/%k/brightness", \ RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"
- Notes
sudo usermod -a -G video yaoniplan
mod
# Modify-a
# --append-G
# --groupsvideo
# a name of groupyaoniplan
# Replace it with your name of user
- References
Remove packages form the operating system in Gentoo Linux
sudo emerge -c x11-apps/xbacklight
- Notes
-c
# Depclean
- References
Update the whole system in Gentoo Linux
doas emerge --sync
# Update the package listdoas emerge -avuDN @world
- Notes
-a
# --ask-v
# --verbose-u
# --update-D
# --deep-N
# --newuse- If you have the problem
!!! existing preserved libs: >>> package: x11-libs/libdrm-2.4.114 * - /usr/lib64/libdrm_amdgpu.so.1 * - /usr/lib64/libdrm_amdgpu.so.1.0.0 * used by /usr/lib64/xorg/modules/drivers/amdgpu_drv.so (x11-drivers/xf86-video-amdgpu-22.0.0) Use emerge @preserved-rebuild to rebuild packages using these libraries * After world updates, it is important to remove obsolete packages with * emerge --depclean. Refer to `man emerge` for more information.
sudo emerge --depclean
# Remove obsolete packagessudo emerge @preserved-rebuild
# Clean up the old library version
- Solve the problem
* IMPORTANT: 5 config files in '/etc' need updating. * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS * sections of the emerge man page to learn how to update config files. * After world updates, it is important to remove obsolete packages with * emerge --depclean. Refer to `man emerge` for more information.
doas etc-update
# Update all config files in '/ect'doas emerge --depclean
# Remove obsolete packagesdoas reboot
- References
The abbreviation of the "Unicode Transformation Format - 8-bit" is the "UTF-8". #Idea
- Notes
- An encoding
- References
Understand the #LLVM. #Idea
- Notes
- A #compiler
- It took about four hours to compile the sys-devel/llvm in [[Gentoo Linux]]. (e.g. 15:50-20:07)
- References
The #abbreviation of the [[Good Game]] is #GG. #Idea
- Notes
- A #slang
- Used at the end of a gaming match commonly
- References
The #abbreviation of the [[computed tomography scan]] is [[CT scan]] . #Idea
- References
The abbreviation of the "identity document" is "ID". #Idea
- References
Check screen resolution in Linux
cat /sys/class/graphics/fb0/modes
- References
Display backticks in the code block of #Markdown
import -window root `date +%F_%T`.png
- Notes
import -window root `date +%F_%T`.png
# Output- Add two backticks to the left of the content; add two backticks to the right of the content.
- Sometimes: Replace two backticks with two backticks and a space; Replace two backticks with a space and two backticks
- References
- I am trying to use #GIF in #Markdown files. #Idea
Take a screenshot with the #import command from #ImageMagick #application
import -window root screenshot.png
# Take a picture of the whole screenimport screenshot.png
# Take a picture of the selected part
- Notes
sleep 5; import -window root screenshot.png
# Delay five seconds before taking a pictureimport -window root `date +%F_%T`.png
# Image file named by time%F
# Full date (e.g. 2022-12-13)%T
# Time (e.g. 15:15:03)
import -window 0x1a00002 `date +%F_%T`.png
# Take a picture of a single window you want0x1a00002
# A window IDxwininfo
# Get the window IDsudo emerge -aq x11-apps/xwininfo
# Install it if you don't have it
- References
- https://www.oreilly.com/library/view/linux-multimedia-hacks/0596100760/ch01s02.html
- https://dev.to/fmtweisszwerg/how-to-capture-a-screenshot-of-the-single-window-you-want-using-command-line-59hc#:~:text=To%20capture%20a%20screenshot%20of%20the%20selected%20window%20using%20import,ID%22%20with%20%2Dwindow%20option.&text=Finally%2C%20the%20screenshot%20is%20saved%20in%20the%20current%20directory!
The #abbreviation for #kilo is #k. #idea
- Notes
- #Kilo is one thousand
- References
Use "clash"
chmod u+x clash-linux-amd64-v1.12.0
# Add user executable permissionsudo mv clash-linux-amd64-v1.12.0 /usr/local/bin/clash
# Execute anywheremv yourClashConfig.yaml ~/.config/clash/config.yaml
# Use your own configuration fileclash
# Initialize and enable clash
- Notes
vim ~/.config/clash/config.yaml
# Select server automatically- name: "auto" type: url-test proxies: - ss1 url: 'http://www.gstatic.com/generate_204' interval: 300
ss1
# Replace it with other proxy
vim ~/.bashrc
# Edit it on other machinessetProxy() { export http_proxy="192.168.10.105:7890" export https_proxy="192.168.10.105:7890" export no_proxy="localhost, 127.0.0.1" } unsetProxy() { unset http_proxy https_proxy no_proxy }
source ~/.bashrc
# Remember to make it effectivesetProxy
# Enable proxy temporarilyunsetProxy
# Disable proxy temporarily
- Set environment globally
sudo vim /etc/environment
# Proxy export http_proxy="127.0.0.1:7890" export https_proxy="127.0.0.1:7890" export no_proxy="localhost, 127.0.0.1"
- Solve the problem about address already in use
ERRO[0438] Start Mixed(http+socks) server error: listen tcp 127.0.0.1:7890: bind: address already in use
- Use "lsof"
nix profile install nixpkgs#lsof
# Install dependencieslsof -i :7890
# Get the PID (ps aux | grep clash
)kill yourPID
# Replace yourPID with PID you got
- References
The #abbreviation for the "solid-state drive" is "SSD". #idea
- A storage device
- References
Set CSS for Vimium UI permanently
vim vimium-1.67.4/content_scripts/vimium.css
# Edit the file after downloading form source codediv.internalVimiumHintMarker { position: absolute; display: block; top: -1px; left: -1px; white-space: nowrap; overflow: hidden; font-size: 11px; padding: 1px 3px 0px 3px; background: linear-gradient(to bottom, #000000 100%,#FFC542 100%); border: solid 0px #C38A22; border-radius: 3px; box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.3); }
- Edit
CSS for Vimium UI
options of #extensiondiv > .vimiumHintMarker { /* linkhint boxes */ background: -webkit-gradient(linear, left top, left bottom, color-stop(100%,#000000), color-stop(100%,#FFC542)); border: 0px solid #E3BE23; } div > .vimiumHintMarker span { /* linkhint text */ color: black; font-weight: bold; font-size: 12px; } div > .vimiumHintMarker > .matchingCharacter { }
- Notes
- Theses two places (
vimium.css
andCSS for Vimium UI
) must be changed, otherwise it will not work sometimes.
- Theses two places (
- References
Remember What G does in #Vim #Idea
- G is bigger than g
- So it's heavy and sinks to the bottom
- References
- Why aren't gg and G switched? : vim- Set some aliases for pages in #Logseq
- Type this code (
alias:: extensions
) on the first block of the page and replace extensions with your alias
- Notes
- What is alias?
- This means merging pages with the same meaning.
- References
Disable all hotkeys except itself for the Global Speed extension
Shift q
# Press the Shift key and q key together
- Notes
- Create a "state" in "Shortcut Editor" # Another way
- Click on "NoKey" and press your desired shortcut key (e.g. Alt-s)
except itself
# This means enabling the hotkey (Shift q) onlyGlobal Speed
# A Google Chrome extension to set the speed of web pagesCtrl-m
# Mute
Shift q
# To avoid hotkeys conflicts with other extension (e.g. Vimium )
- Create a "state" in "Shortcut Editor" # Another way
- References
Stop forgetting to breathe #Idea
- Exhale on the effort
- References
Enable spell checker in the #Logseq #application
- A red underline will be displayed when the spelling is wrong.
- References
I am trying to use Grammarly to revise a wordy sentence. #Idea
- I am trying to test it, but it does not work in Logseq.
- Test again.
- Don't support the #Logseq website.
- Support the [[Google Translate]] website.
- Membership is required sometimes.
- References
I am trying to use Wordeep to revise a wordy sentence. #Idea
- Do not support #Markdown sometimes.
- Support the #Logseq website.
- References
I am trying to use Quillbot to revise a wordy sentence. #Idea
- Do not support #Markdown.
- Support the #Logseq website.
- References
I am trying to use ProWritingAid to revise a wordy sentence. #Idea
- Support the #Logseq website.
- Do not support #Markdown sometimes.
- References
I am trying to use LanguageTool to revise a wordy sentence. #Idea
- Support the #Logseq website.
- Support #Markdown.
- Need to manually add some proper nouns sometimes.
- Membership is required sometimes.
- References
I am trying to use Ginger to revise a wordy sentence. #Idea
- Support the #Logseq website.
- Support #Markdown sometimes.
- Don't support [[Google Translate]].
- References
Set a keyboard shortcut for extensions in Chromium
about:extensions/shortcuts
- Notes
- The "Google Translate" extension
Alt-t
# Open or closeenergized
# Replace it with what you want and type in the extension barTab
# Press the Tab key to select the section you want to selectShift-Tab
# Select previous section
- The "Google Translate" extension
- References
The abbreviation of the "European Union" is "EU".
- In Europe
- A union
- 27 member states
- References
Copy text from Vim to external application without using mouse
Shift-v
# Visual line mode"+y
# Copy text from VimCtrl-v
# Paste text to external application (e.g. web browser, instant messaging, etc.)
- Notes
"+y
# Means pressing ", + and y one by oney
# Yank
- If your clipboard is not working
:version
# Check the clipboard feature in Vimdoas apt install vim-gtk3
# In Debian-based distributiondoas pacman -S gvim
# In Arch Linuxsudo vim /etc/portage/package.use/zz-autounmask
# Add the USE flag to enable the clipboard feature# required by app-editors/vim app-editors/vim X
sudo emerge -q app-editors/vim
# Recompile it to enable the USE flag
- References
I am trying to mix and not just handedness. #Idea
- References
Chew food properly #Idea
- Don't overload your spoon or fork
- Chew with your mouth closed, with your tongue moving food form side to side and your jaw rotating slightly
- Chew slow and steadily, counting to 32 with each bite
- Wait until you have finished food in your mouth before drinking fluids
- Notes
overload your spoon
# It will fall off the sides32
# Just ensure the food in your mouth loses all of its texture before swallowingdrinking fluids
# It will slow the digestive process by diluting enzymes in the body which break down food
- References
"Biography" (Bio) #abbreviation #GitHub
- References
- - ---
- References
Set USE flags for each package in Gentoo Linux
sudo vim /etc/portage/package.use
x11-terms/rxvt-unicode-9.30 perl xft
- References
Search in current line #Vim
Shift+v
# Select current line/24
# Just like a normal search and pressEsc
key after the step
- Notes
Shift+v
# PressShift
follow byv
in normal mode/24
# Replace24
with what you want to search for
- References
Use "st"
doas vim /etc/portage/savedconfig/x11-terms/st-0.9
# Set fonts static char *font = "Liberation Mono:pixelsize=14:antialias=true:autohint=true";
sudo emerge st
# Recompile to make changes effective
- Notes
doas vim /etc/portage/package.use/zz-autounmask
# required by /etc/portage/savedconfig/x11-terms/st # Set the USE flage (`savedconfig`) fo the package (`x11-terms/st`) x11-terms/st savedconfig
- To save custom configuration files
- To avoid the file being lost
- Because to install ST (simple terminal) in Gentoo Linux.
- References
Solve error about module repository Gentoo Linux
sudo emerge eselect-repository
- Notes
- Error
yaoniplan@yaoniplan ~ $ eselect repository enable torbrowser !!! Error: Can't load module repository exiting yaoniplan@yaoniplan ~ $
- Error
- References
Choose a keyboard for a computer
Mechanical
fast response
PBT
- Notes
- Form factor
- 100% (full-size) # Large and inefficient
- Ergonomic
- Align the "H" key with the center of the body
- Flat and follow the angle of the thighs
- Wired and wireless
- Arrow and function key
- Switches
Name Type Force Noise Brown Tactile 45 g Average Clear Tactile 65 g Average Red Linear 45 g Low Black Linear 60 g Low Blue Clicky 50 g High - Typing and programming
- Build quality
- Plastic # Cheap, but will flex when you press too hard
- Metal or higher-quality
- Keycaps
- ABS # Prone to wear and become smooth with heavy use
- PBT # More durable
- Programmability
- Onboard # Customize certain keys
- Removable cable
- Removeable USB cable # Replace just the cable rather than the whole keyboard
- Build quality
- Form factor
- References
CopyQ installation #application
sudo emerge -aq --autounmask=y --autounmask-write x11-misc/copyq
sudo etc-update
-3
# Merge all files automatically
sudo emerge -aq x11-misc/copyq
I am trying to replace "unorder list" syntax with "heading" syntax. #Idea
- because it has a link to share anyone.
- Nordic-darker theme installation
sudo cp -r Nordic-darker/ /usr/share/themes/
- Notes
Nordic-darker/
# The theme foldertar -xf Nordic-darker.tar.xz
# Extract the file if you download it
/usr/share/themes/
# Add your theme folder to this derectory
- References
Extract a ".tar.xz" file
tar -xf Nordic-darker-v40.tar.xz
- Notes
-x
# Extract-f
# File
- References
man tar
#/-x
/-f
- https://linuxhint.com/uncompress-tar-xz-files/
- Solve problem about "echo", ">>" and permission #Linux #Command
echo "=x11-base/xorg-server-1.11.99.2" | sudo tee -a /etc/portage/package.unmask
- Notes
tee
# Replace output redirection (e.g. > and >>)-a
# Append
- References
yaoniplan@yaoniplan ~/note $ sudo echo "=x11-base/xorg-server-1.11.99.2" sudo >> /etc/portage/package.unmask bash: /etc/portage/package.unmask: Permission denied
man tee
- https://askubuntu.com/questions/103643/cannot-echo-hello-x-txt-even-with-sudo
Kvantum installation #Qt #Theme #application
sudo emerge -aq --autounmask=y --autounmask-write x11-themes/kvantum
sudo etc-update
-3
# Type it, then press "enter" keyY
# Type it, the press "enter" key
sudo emerge -aq x11-themes/kvantum
# Install it now
- Notes
--autounmask=y
--autounmask-write
# Solve the following error!!! All ebuilds that could satisfy "x11-themes/kvantum" have been masked. !!! One of the following masked packages is required to complete your request: - x11-themes/kvantum-1.0.1::gentoo (masked by: ~amd64 keyword)
- References
- Lxappearance installation #GTK #Theme #application
sudo emerge -aq lxde-base/lxappearance
- Rofi installation #i3 #Gentoo #Linuxn
sudo emerge -aq x11-misc/rofi
sudo vim ~/.config/i3/config
# start dmenu (a program launcher) #bindsym $mod+d exec --no-startup-id dmenu_run # A more modern dmenu replacement is rofi: bindsym $mod+d exec "rofi -modi drun,run -show drun"
- Notes
-a
# Ask-q
# Quiet
- References
man emerge
# Type (by pressing "/") "--ask" or "--quiet" in manual page about emerge
Set brightness on i3 and Gentoo Linux
sudo emerge --ask x11-apps/xbacklight
sudo vim ~/.config/i3/config
bindsym XF86MonBrightnessUp exec xbacklight -inc 10 bindsym XF86MonBrightnessDown exec xbacklight -dec 10
- Notes
sudo reboot
# Reboot the operating system finally
- References
Enable audio or sound in Gentoo Linux
cd /usr/src/linux
doas make menuconfig
doas make -j6
doas make modules_install
doas make install
doas euse -E alsa
doas emerge -avuDN @world
doas emerge -aq media-sound/alsa-utils
doas gpasswd -a yaoniplan audio
doas rc-update add alsasound boot
alsamixer
- Notes
doas make menuconfig
# Refer this link to activate kernel optionslspci | grep -i audio
# List all PCI devices and print lines containing audio ignoring caselspci
# List all PCI devices-i
# --ignore-case
doas euse -E alsa
# Enable the USE flag (alsa) in /etc/portage/make.conf-E
# --enabledoas emerge -aq app-portage/gentoolkit
# Install it to use the euse command
doas gpasswd -a yaoniplan audio
# Add the user to the group-a
# --addyaoniplan
# Replace it with a name of your useraudio
# A groupgrep audio /etc/group
# Print lines containing audio in /etc/group file
doas rc-update add alsasound boot
# Add the service to the runlevel by using OpenRCalsasound
# A serviceboot
# A runlevel
alsamixer
- Press the
M
key to unmute if displayMM
- Press the
Escape
key to exit the interface
- Press the
- Use "pactl"
pactl list sinks
# Display the current volume levelpactl set-sink-volume @DEFAULT_SINK@ +10%
# Increase the volume by ten percentpactl set-sink-volume @DEFAULT_SINK@ -10%
# Decrease the volume by ten percentpactl set-sink-mute @DEFAULT_SINK@ toggle
# Toggle mutepactl
# Pulse audio control- Because enable audio or volume in Linux with pipeware.
- References
man pactl
man rc-update
man gpasswd
man euse
man grep
man lspci
- https://wiki.archlinux.org/title/Dwm#Adjusting_volume
- https://wiki.gentoo.org/wiki/ALSA
Install google-chrome in Gentoo Linux
sudo vim /etc/portage/package.license
www-client/google-chrome google-chrome
sudo emerge --ask www-client/google-chrome
- Notes
www-client/google-chrome google-chrome
# Accept license if you want to install and use this software
- References
Use "sddm" theme in Gentoo Linux
git clone https://github.com/MarianArlt/sddm-chili
sudo mv ~/sddm-chili /usr/share/sddm/themes/
sudo vim /usr/share/sddm/sddm.conf.d/00default.conf
[Theme] # Current theme name Current=sddm-chili
- Notes
/usr/share/sddm/sddm.conf.d/00default.conf
# SDDM's config filesudo updatedb
# Update a database for mlocatelocate sddm.conf
# Locate file including "sddm.conf" text
sudo emerge --ask dev-qt/qtquickcontrols
# Solve an errorfile:///usr/share/sddm/themes/sddm-chili//Main.qml:22:1: module "QtQuick.Controls" is not installed
sudo emerge --ask dev-qt/qtgraphicaleffects
# Solve an errorfile:///usr/share/sddm/themes/sddm-chili//components/Wallpaper.qml:21:1: module "QtGraphicalEffects" is not installed
sudo vim /usr/share/sddm/themes/sddm-chili/theme.conf
# Customize the theme# Screen resolution (Use command: screenfetch or neofetch) ScreenWidth=1366 ScreenHeight=768 # Size (between 10 and 16) of font FontPointSize=15 # Pixel size of avatar AvatarPixelSize=150
/usr/share/sddm/faces/yaoniplan.face.icon
# Avatar file/usr/share/sddm/faces/
# Add your coustomized picture to the avatar folderyaoniplan
# change it into yours user name.face.icon
# Keep it defaulttext = new Date().toLocaleString(Qt.locale("en_US"), "ddd dd MMMM yyyy, hh:mm")
- Optional: Take a screenshot of the login screen
sddm-greeter --test-mode --theme /usr/share/sddm/themes/sddm-chili/
- Press the print screen key to take a screenshot
- Solve the problem about white background
- Convert background.jpg file to background.png file (Make sure the image file extension is png)
- Make sure there is a background.png file in the
/usr/share/sddm/themes/sddm-chili/assets/
directory sudo vim /usr/share/sddm/themes/sddm-chili/theme.conf
[General] background=assets/background.png
- References
- SDDM Usage Gentoo Linux DM
sudo emerge --ask x11-misc/sddm
# Install x11-misc/sddmsudo usermod -a -G video sddm
# Add the sddm to the video group
- Notes
- OpenRC
doas emerge --ask gui-libs/display-manager-init
doas vim /etc/conf.d/display-manager
CHECKVT=7 DISPLAYMANAGER="sddm"
rc-update add display-manager default
# Add the display-manager to the system's default runlevelrc-service display-manager start
# Start the display-manager
- Another way
echo "exec dwm" >> ~/.xinitrc
# Repalcedwm
with your WMecho "startx" >> ~/.bash_profile
- OpenRC
- References
- The abbreviation of the "Miscellaneous" is "misc".
- References
Switch to another branch of Git
git switch gh-pages
# Switch to "gh-pages" branch
- References
- Remove package from @world set #Gentoo #Linux
sudo emerge --deselect sys-kernel/gentoo-kernel-bin
- Notes
cat /var/lib/portage/world | less
# View packages in the @world set
- References
Compress as a ".zip" file
zip archive.zip *.mp3
# Zip a filezip -r wallpaper.zip wallpaper/
# Zip a directory
- Notes
-r
# Recursive-e
# Encryptwallpaper/
# A folder you want to compressnix profile install nixpkgs#zip
# Install dependencies
- References
man zip
#/-r
/--encrypt
- Do not use "sudo rm -rf test/" unless you used "sudo cp -r test/ /tmp/" before. #Idea #Linux
Set dark mode in Ventoy
doas ./VentoyPlugson.sh /dev/sdc
http://127.0.0.1:24681
- Change the "display_mode" in "Theme Plugin" from "GUI" to "CLI"
- Notes
doas mount /dev/sdc1 /mnt/SanDisk
# Mount it before using the command/dev/sdc
# Replace it with your block devicelsblk
# Get it (e.g. /dev/sda, /dev/sdb, etc.)
- Warning: It has some bugs about displaying.
- References
Use "chmod"
sudo chmod -R 777 ~/note/grow/029_googleTranslateExtension2.0.12_0/
- Notes
-R
# recursive777
# the first "7" are permissions of user; the second "7" are permissions of user's group; the third "7" are permissions of otherspermissions
# read, write and execute7
# $2^2 + 2^1 + 2^0$
- References
man chmod
Use "qemu"
- Create a disk image
qemu-img create -f qcow2 ~/testQemu.cow 100G
- Install the OS
qemu-system-x86_64 -m 8G -enable-kvm \ -bios /usr/share/ovmf/x64/OVMF.fd \ -nic user,hostfwd=tcp::60022-:22 \ -cdrom /mnt/grow/230504archlinux-2023.05.03-x86_64.iso \ -drive file=~/testQemu.cow,format=qcow2 \ -boot order=d
- Run the machine
qemu-system-x86_64 -m 8G -smp 4 -enable-kvm \ -bios /usr/share/ovmf/x64/OVMF.fd \ -nic user,hostfwd=tcp::60022-:22 \ ~/testQemu.cow -audiodev pa,id=sound0 \ -device ich9-intel-hda \ -device hda-output,audiodev=sound0
- Create a disk image
- Notes
-display sdl,gl=on -vga virtio
# Enable 3D acceleration if you cannot enter the desktop after entering the password in the window manager-bios /usr/share/ovmf/x64/OVMF.fd
# 64bit UEFIssh yaoniplan@192.168.10.105 -p 60022
# Connect itdoas pacman -S qemu-full
# Install dependenciesdoas pacman -S remmina
# Install the VNC client (Another way)# Click the "New connection profile" icon Remmina VNC plugin for GNOME and KVM # Protocol localhost:5900 # Server # Click the "Save" button # Double-click to connect the VNC server
- References
Understand "Wayland"
- A display server protocol
- Replace X11
- References
Decompress a ".xz" file in Unix-like
xz -d ./FreeBSD-13.1-RELEASE-amd64-bootonly.iso.xz
- Notes
-d
# Decompress
- References
- The punctuation of "Underscore" is "_".
- References
- how to chewing and swallowing (or eating) properly #Idea
- References
- View all commits of a user #GitHub
https://github.com/search?q=author:yaoniplan
# Change user "yaoniplan" to yours
- Notes
- recently committed:
- References
- I am trying to replace pages (e.g. abbreviation, punctuation, etc.) with tags. #Idea- ---
Add a [[abbreviation]]
Yet Another Multicolumn Layout (YAML
)- References
Shortcuts developer tools on Chromium
CTRL + Shift + c
# Open developer tools- Notes
CTRL + Shift + i
# Close developer tools
- References
Add a [[punctuation]]
Question mark (?
)- References
The punctuation of "backtick" is
"`"
.- Another name
- "grave"
- Another name
- References
The abbreviation of "Incorporation" is "Inc".
- References
Add a [[abbreviation]]
Main Character (MC
) in anime- References
The punctuation of "exclamation mark" is "!"
- References
Add a [[punctuation]]
Space (- References
- I'm trying to refactor Markdown.md in English. #Idea
test typesetting
Useheadings
unordered lists
images
links
code
- Notes
- test # test
- test # test
- References
- test_image
- test_image
- test_link
- I'm trying to complete my GitHub. #Idea
- References
- Push using [[Git]] automatically
- "~/.config/shell/autoGit.sh"
#!/bin/sh while true; do cd ~/note sleep 20 git add * sleep 20 git commit -m "Update at `date +%F-%T`" sleep 20 git push done
- "~/.config/i3/config"
# Git automatically exec ~/.config/shell/autoGit.sh
- "~/.config/shell/autoGit.sh"
- Notes
chmod u+x ~/.config/shell/autoGit.sh
# Add executable permission
- References
- I'm trying to automate commit and push using [[Git]]. #Idea
- test it using Git hooks
- write a sh file
- test sh file about "sleep"
- test sh file about "sleep" again
- change sleep 540 to 20
- It doesn't work about commit message again
- Change ";" to ":"
- I am trying to publish my [[Logseq]]. #Idea
- test the publish function
- Succeeded
- https://yaoniplan.github.io/note/
- Publish [[Logseq]]
- Notes
git pull -f
# After completing the steps in GitHub
- References
- [[Logseq]]plugin "logseq-focus-mode"
Toggle Line Highlight
Toggle Top Bar
- Notes
.references.mt-6.flex-1.flex-row
# Hide "Unlinked References"/* content: "🗓 "; */
# Hide the emoji of calendar about journals (Edit it in your custom.css file)
- References
- I am trying out plugins and themes for Logseq. #Idea
[[Logseq]]plugin "logseq-plugin-vim-shortcuts"
j
# move downk
# move upi
# insert cursor at the beginnig of the linea
# insert cursor at the end of the lineo
# insert cursor to the next lineG
# scroll to bottom
- Notes
111j
# scroll to bottom (means move down 111 lines)- Optional: Change default [[shortcut keys]] (e.g. gg) for the plugin (#Logseq-vim-shortcuts ) and the #application (#Logseq )
sudo vim ~/.logseq/settings/logseq-vim-shortcuts.json
"top": "g g",
- Change it after pressing the g key and the s key to display this page
- References
- [[Logseq]]plugin "logseq-plugin-bullet-threading"
- References
- [[Logseq]]theme "logseq-cusgit-theme"
vim ~/note/logseq/custom.css
# Copy the whole content of custom.css to yours
- References
The punctuation of "hyphen" is "-".
- References
- [[GitHub]]repository created time (date)
https://api.github.com/repos/yaoniplan/note
- Notes
api.
# Add it before the "github.com/"repos/
# Add it after the "github.com/"note
# Remove the slash (/) after the repository name (note)
- References
The abbreviation of "Graphics interchange format" is "GIF"
- References
- [[Vim]]highlight disable temporarily
:noh
- References
Add string to the end of specified lines in Vim
:'<,'>s/$/<\/li>/
- Notes
:'<,'>
V
# Select lines in visual line mode:
# See the format
s
# Substitute$
# The end of line<\/li>
# Replace it with your desired stringbackslash
# Escape character
- References
- [[abbreviation]]"Massive open online course" (
MOOC
) - References
The brain grows most by getting questions wrong, not right. #quote
As long as we embrace struggle and mistakes, we can learn anything. #quote #Idea
- References
- [[Flameshot]]screenshot (capture) full screen
Ctrl + c
# Copy to clipboard- Notes
Print screen
# Capture screen beforeCtrl + c
- References
- [[Chrome]]move tab's position
- [[Markdown]]Comment
- between
<!--
and-->
- References
- https://github.com/yaoniplan/note/blob/5cf3fb4fb65540ac253d217e396f107fa131d7df/README.md
- https://gist.github.com/jonikarppinen/47dc8c1d7ab7e911f4c9
- between
Commit message rules in Git
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
- Notes
git commit -m 'foo'
# Write the subject linegit commit --amend
# Write the body- If applied, this commit will
- Complete the subject line above
- References
- [[Symbol]]Period
.
- Notes
.
# In computing, it is called a dot- References
- Full stop - Wikipedia
The abbreviation of "Cascading Style Sheets" is "CSS".
- References
I will write an extension (e.g. Linux commands) of google chrome. #Idea
- Notes
- Two methods in English
man date
date --help
- Replace the "date" command with your desired program.
- Two methods in English
- [[Git]]edit comments
git commit --amend
- Notes
git config --global core.editor /usr/bin/vim
# When you have an error about editor (e.g. /bin/nano)- References
- https://stackoverflow.com/questions/52195877/how-can-i-fix-git-commit-error-waiting-for-your-editor-to-close-the-file-wi
The abbreviation of "HyperText Markup Language" is "HTML".
- Notes
- A markup language
- A file format
- References
Search syntax in Google
define:test
# Use online dictionaryartificial intelligence after:2023/03/27
- Notes
after:2023/03/20
# Time
- References
The abbreviation of "Command Line Interface" is "CLI"
- Because to use it can achieve semi-automation by combining it with other tools.
- References
- [[github]]star view
https://github.com/yaoniplan/note/stargazers
# add/stargazers
to the end of the URL of a repository- References
- https://docs.github.com/en/get-started/exploring-projects-on-github/saving-repositories-with-stars#viewing-who-has-starred-a-repository
- [[symbol]]number sign
#
- References
- Number sign - Wikipedia
Decompress a ".bz2" file
bzcat /usr/share/doc/picom-9.1/picom.sample.conf.bz2 > ~/.config/picom.conf
- Notes
bunzip2 --keep dict-en-en.df.bz2
# Decompress (Keep original file)
- References
man bunzip2
#/keep
- https://wiki.gentoo.org/wiki/Alacritty
- [[symbol]]backslash ""
- References
- Backslash - Wikipedia
- [[symbol]]colon
:
- References
- Colon (punctuation) - Wikipedia -- #### The punctuation of "semicolon" is ";".
- References
- [[symbol]]comma
,
- References
- Comma - Wikipedia
- [[symbol]]asterisk
*
- References
- Asterisk - Wikipedia
- [[symbol]]minus
-
- References
- Plus and minus signs - Wikipedia
- [[symbol]]greater-than sign
>
- References
- Greater-than sign - Wikipedia
- [[symbol]]less-than sign
<
- References
- Less-than sign - Wikipedia
- [[symbol]]less than or equal to
<=
- References
- 关于“小于/等于/大于”的英文缩写
Sort by file size in Linux
ls -lS ~/note/pages/
- Notes
-S
# Size
- References
man ls
- [[symbol]]percent sign
%
- References
- Percent sign - Wikipedia
- [[symbol]]quotation marks
'
"
- References
- Quotation mark - Wikipedia
- I have a dream to build Iron Man. #Idea
I participated in a game about "shiyanlou_100th_floor_2022-09-15_2022-10-14". #Idea
Symbol wiki
The punctuation of "round brackets" are "()".
- Notes
- "{}" # Curly brackets
- References
The punctuation of "dot" is ".".
- yaoniplan.eu.org
- Notes
- Decimal point
4.8
# Four point eight
- Decimal point
- References
- lenovo_gentoo-i3_daily_use_2022-10-05_github_push_test
- [[github]]pull from github
git pull
# If you use "git push" on another computer you must use "git pull" on one computer.- References
- browser_vimium_CSS_for_Vimium_UI_default
div > .vimiumHintMarker { /* linkhint boxes */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFF785), color-stop(100%,#FFC542)); border: 1px solid #E3BE23; } div > .vimiumHintMarker span { /* linkhint text */ color: black; font-weight: bold; font-size: 12px; } div > .vimiumHintMarker > .matchingCharacter { }
- [[Vimium]]theme
- Dracula_Dark https://github.com/dracula/vimium/tree/54a6d0cf56248611755527bf58cc5cf238b68ace
- Arc_Dark https://github.com/philc/vimium/issues/3157#issuecomment-476652867
- https://qiita.com/nisshy0516/items/0eec4d49c68b39f15716
- simply-dark https://github.com/ysjn/vimium-simply-dark
- rainbow https://github.com/zozonteq/vimium-rgb-theme?ref=codetea.com
- I am a Chinese who is learning English. #Idea
- And I think English is just a tool for me. #Idea
The punctuation of "slash" is "/".
- References
- [[usb]]dd iso to usb
sudo dd if=/home/gentoo/Downloads/ubuntu-22.04.1-live-server-amd64.iso of=/dev/sdc bs=4M && sync
- Notes
/dev/sdc
# your usb device (lsblk
can view it)sync
# If you don't do this, you will get an "Operating System not Found"error.- References
- https://askubuntu.com/questions/372607/how-to-create-a-bootable-ubuntu-usb-flash-drive-from-terminal
I need to spend a lot of time cleaning the HP laptop (e.g. electric fan, GPU, etc.) because it has a lot of screws. #Idea
- References
- [[Vimium]]temporarily disable vimium
i
# ignore all commands of vimium by hitting this key (i
isinsert
)- Notes
esc
# exit and enable vimium by hitting this key- References
- https://github.com/philc/vimium
Disable smooth scrolling in Chromium
about:flags
- Type "Smooth Scrolling"
- Notes
- Another way in Gentoo Linux
doas vim /etc/chromium/default
CHROMIUM_FLAGS="--disable-smooth-scrolling"
- Another way in Gentoo Linux
- References
View the current filename (or full path) in #Vim
- Press
1
followed byCtrl-g
# Method one :set laststatus=2
# Method two:f
# Method three
- Press
- References
- [[Vim]]paste text
"*p
# enter them in vim normal mode after you copied (e.g.ctrl + c
) text- Notes
p
# please don't enter it in vim normal mode after you copied (e.g.ctrl + c
) textctrl + v
# please don't enter it after you copied (e.g.ctrl + c
) text- References
- [[linux]]copy files excluding existing ones
sudo cp -rn ~/kaigua/* ~/test
#-n
is--no-clobber
(not overwrite)man cp
# have a problem finding a man
- v5.0.0 EFI, linux swap 24GiB, no encryption, /dev/sda, desktop-systemd, gentoo cn mirror, no ~amd64, run mirrorselect, screenfetch, vim, i3-gaps, sddm # install compelete.
- v4.0.0 EFI, linux swap, no encryption, /dev/sda, systemd, gentoo cn mirror, no ~amd64, run mirrorselect, screenfetch # install compelete.
- v3.1.0 the first lower link: git clone --depth 1 https://anongit.gentoo.org/git/repo/sync/gentoo.git 100KiB/s
- v3.0.0 bios, linux swap, no encryption, /dev/sda, openrc, gentoo cn mirror, no ~amd64, run mirrorselect, screenfetch # install compelete.
- v2.2.0 stage3 # don't need desktop (i3) (It will need a lot of time to compiling rust. So i3 need desktop.)
- v2.1.0 emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin app-arch/zstd # Command Failed
- v2.0.0 git mirrors: https://mirrors.ustc.edu.cn/gentoo.git; gentoo mirrors: https://mirrors.ustc.edu.cn/gentoo/; not run select gentoo mirrors # speed is faster than 1.
- v1.0.0 git mirrors: default; gentoo mirrors: https://mirrors.ustc.edu.cn/gentoo/ run select gentoo mirrors # speed is lower, 100KiB/s (lower first link: git clone --depth1 https://anongit.gentoo.org/git/repo/sync/gentoo.git)
- References
- https://www.youtube.com/watch?v=I-vu9IHHYLg # install gentoo finish
- https://github.com/oddlama/gentoo-install
- v0.0.0 gentooinstall test
Find and replace strings in Vim
:%s/#//g
# Find "#", and replace it with ""
- Notes
:
# Command-line mode%
# The entire files
# Substitute:%s/\[\[//g
# Find "[[" and replace it with ""- "" # Add the escape character to solve the problem about pattern not found
- References
:help :range
:help :substitute
:help :
- https://vim.fandom.com/wiki/Search_and_replace
- https://stackoverflow.com/questions/19994922/find-and-replace-strings-in-vim-on-multiple-lines
Use "e.g. " in English
(e.g. marzipan)
# for example marzipan
- References
- gentoo install v1.3.0 github
- [[computer]] [[linux]] [[gentoo]] I need a computer that can replace the CPU when the computer compiling or building on gentoo. #Idea
- [[i3]] If you don't input any keys with keyboard in terminal.
ctrl + z
# usectrl
andz
hotkey, then you your terminal will fine.
Partition fdisk in Linux
fdisk /dev/sda
- Notes
/dev/sda
# A devicefdisk -l
# List
- fdisk common command
m # help p # print the partition g # create a GPT partition and remove all partitons n # new a partition (Partition number: default) (First sector: default; Last sector: +512M (+size{K,M,G,T,P})) t # change a partition type l # list partitions type (Then enter a number of partition) w # write partitions to disk and exit
- References
- Example
Mount point Partition Type Size /mnt/boot /dev/ESP EFI 300 MiB [SWAP] /dev/swap Linux swap 512 MiB /mnt /dev/root Linux x86-64 root The rest - https://wiki.archlinux.org/title/Installation_guide#Example_layouts
- https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks#Partitioning_the_disk_with_GPT_for_UEFI
- Example
- [[Git]] ignore files
.gitignore
# You can add what you want to ignore in the file..git/info/exclude
# You can add what (e.g.logseq/bak
) you want to ignore in the file. (after you changed directory (e.g.cd ~/note
) of your repository)- References
- Git - gitignore Documentation
- [[ssh]] WARNING solve
~/.ssh/known_hosts
# rename it. (for example:mv ~/.ssh/known_hosts ~/.ssh/known_hosts_old.old
)ssh user@ipaddress
# enter it. (for example:ssh root@192.168.10.110
)- References
- https://www.cnblogs.com/johnchain/archive/2013/04/08/3006631.html
- I'll try gentoo linux. # learn snapshot, backup, restore, software, etc. #Idea
-- #### Cut hair process
hairpin
# pin or hold hairspray bottle
# make hair wethair comb
# straighten hairhair clipper
# cut length of hairhair dryer
# dry hairhair wax
# change hairstylehair spray
# fixed hairstyletarget
# not long
- References
- [[linux]] backup and restore os with clonezilla
- [[Markdown]] hide section or a collapsed section
<details><summary>CLICK ME</summary> <p> You can edit this. </p> </details>
Solve the problem about hunchback
- Reduce usage of eyes
- Focus on abdomen and chest
- Notes
abdomen
# Contractchest
# Up
- test_merge_and_rename_tables_of_markdown_v1.0.0
- test_merge_tables_of_markdown_v1.0.1
hair_cut_buy_something_2022-09-22
- hairpin
- spray bottle
- References
There is no tiger in the mountain, the monkey is the king. #quote -- #### python name good habits
in English
# You can fluently read english tutorial after a while.camelCase
# lower camel caseCamelCase
# upper camel case
- Notes
Server-Side Query
# serverSideQuery- Begin with a lowercase letter
- Use only letters and numbers; avoid special characters
- For each subsequent words, start with an uppercase letter
- Eliminate all spaces between words
- Merge all words into a single continuous string
- References
- [[python]]check class
type()
# This is a function that check class.- References
- I think the KanBan function is suitable for recoding a long-term plan. #Idea
- [[Vim]]copy and paste content from one file to another file
vim to_copy_file to_paste_file
#to_copy_file
: you want to copyto_paste_file
: you want to paste:n
# You will edit the next file after you copy. (You can select where you want to copy via enter "v
", then you can copy via enter "y
".)p
# You can paste it via enter "p
"- References
- https://www.youtube.com/watch?v=YS9PZJ-c7ps
Check memory in Linux
cat /proc/meminfo | less
- Notes
proc
# Processmeminfo
# Memory informationfree -h
# Another way-h
# Human
- [[linux]] [[gentoo]] livegui password
sudo passwd
# You can set a root password yourself if you don't know it.
Set mirror in Gentoo Linux
doas vim /etc/portage/make.conf
GENTOO_MIRRORS="https://mirrors.ustc.edu.cn/gentoo/"
- Notes
- Because to improve the speed of installing packages.
- References
Hair preparation
- Hair clip
- Hair scissors
- Spray bottle # Make hair wet
- References
- [[Python]] yunsuanfuzuoyou doufangyigekongge zaishuxiebiaodashishi
- [[i3]] mod1
xmodmap
# see mod1, mod2, mod3, mod4, mod5.- Reference
- What are Mods2 and 3?
- [[linux]]
mkfs
#make file system
- Reference
- snapshot
- tool: timeshift(GUI), snapper(CLI)
List GitHub syntax
- Search for content in a repository
repo:YanG-1989/m3u 七龙珠
# (repo:aUser/aRepo theContent)
- Search for file name in a repository
yourFileName in:path
path:**/yourFileName
- Search for content in a repository
- Reference
- [[i3]] i3bar hide
bar { mode hide hidden_state hide modifier Mod4 }
- Reference
- i3: i3 User's Guide
- [[Git]] status
git status
# see status (Untracked files (track: zhuizong))
- [[GitHub]] should allow you to register the same SSH public key for more than one repo. # I test it on September 14, 2022.
- [[Python]]
1 > 2 and not 1 > 3 or 2 > 3
priority (优先)- 等价于
((1 > 2) and (not (1 > 3))) or (2 > 3)
(False and (not False)) or False
# 算术运算符 > 逻辑运算符(False and True) or False
# 逻辑运算符not
False or False
# 逻辑运算符and
False
# 逻辑运算符or
- 总结: 算术运算符 > 逻辑运算符(not > and > or)
- 等价于
Use Vimium
d
# DownSpace
# In Chromium
yy
# Copy the current URL to the clipboardC-l C-c
# In Chromium
f
# Feature- And then press capital leters
- Will open a link in a new tab
- Notes
?
# Help- Needs
- hover
- References
print("{:5} {:7.2f}".format(fahrenheit, celsius))
含义:5
# 5 个字符宽度.2f
# 四舍五入到小数点后两位:7.2f
# 7 个字符宽度,四舍五入到小数点后两位
- [[python]] tuple (元组) # 在一行内定义多个变量
a, b = 45, 54
# 将值 45 分配给变量 a; 将值 54 分配给变量 b- 注意事项
- 用
,
(逗号) 来创建 tuple (元组) - 也可用于交换值(如下图所示)
- [[linux]]
cp 文件 目录
# 注意事项:若目录存在此同名文件,将会覆盖此同名文件 Hair style
- 有光泽
- 定型
- 发泥 # 一指节长度(短发)、 增加摩擦感
- 发蜡 # 抓线条、旁分、中分、头发的束感、一点点光泽
- 发胶 # 适合刘海容易掉下来的、有定型效果
- 通用使用方法
- 指背扣(用量:指甲片) 2. 涂匀手指头(发泥)或手掌(发蜡、发胶) 3. 搓发从发根处中间往上(发泥)或左右搓揉在分线的地方拨开去抓(发蜡)或从侧面梳进去服帖的压下来用手指头把发胶带进去(发胶)
- 吹头发(八成干) 2. 抓头发(手指伸进去、手指合起来、往上拉、送风2-3次、往前挪) 3. 抓型状(涂抹后,用手捏一捏,捏出纹理来)
- 蘑菇头(剪成平平的)2. 吹头发(37分,发根位置矫正,加热发根) 3. 发蜡(抹均匀、发根不用刻意去抹带光泽抹太多会塌掉) 4. 塑形(吹风机)和定型喷雾(支撑发根)
- 分区(顶部(太阳穴到后脑勺)、耳朵侧边、后脑勺) 2. 手推剪 # 韩系短发
- Pull up on the nose and eyeballs 2. With curling comb and hair clip 3. With hair wax 4. With hair spray
- References
- Git 和 GitHub
Git
# 版本 (更方便地管理版本)GitHub
# 代码 (更方便地管理代码)- Git 的安装
git
# 查看常用命令(顺便检测是否安装) (在终端输入)
- 在 GitHub 上创建仓库
- 注册 GitHub 账号
github.com
# 输入 GitHub 官方网址 (在搜索引擎中)Sign up
#Sign up
(注册)- 使用邮箱注册,验证通过即可 (在填写完相关信息之后)
- 新建代码仓库
- 添加 SSH 关联授权
ssh-keygen
# 生成公钥私钥 (在终端输入,并按几次回车)cat ~/.ssh/id_rsa.pub
# 连接公钥文件并打印输出 (选中后,ctrl + shift + c
(复制))- 在 GitHub 上添加公钥 (Title (标题) (你可自定义), Key (钥匙) (粘贴刚才复制的公钥))
git clone git@github.com:yaoniplan/Demo.git
# 将远程仓库克隆到本地ls -al
# 以列表的形式列出所有文件 (在切换到 Demo 目录后) (出现 .git 目录即表示处于 Git 版本管理下)git config --global user.email "yaoniplan@gmail.com"
# commit 时的 Author 信息 (yaoniplan@gmail.com
(请填写你注册 GitHub 时的邮箱))git config --global user.email "yaoniplan"
# commit 时的 Author 信息 (yaoniplan
(请填写你注册 GitHub 时的账户名))
- 提交代码
git add .
#add
(添加).
(当前目录) (你可以单独添加某个文件或多个文件) 文件到 index (索引)git commit -m 'test'
#commit
(record changes to the repository) 记录变化到仓库-m
(message) 信息test
(对变化的描述,你可以自定义)git push
#push
(推送) 到远程仓库
- Python_的流程控制
- Python_文件的创建和执行
vim test.py
# 用 vim 打开 test.py 文件 (若没有 test.py 文件,则创建并打开 test.py 文件)python3 test.py
# 用 python3 interpreter (解析器) 执行 test.py 文件
- 流程控制 # 告诉计算机什么时候该干什么事
- 条件判断
- 注意第一行的
:
(冒号);第二行的space
(空格) (4个空格作为一个缩进) else
elif
#elif: else if
(用来执行更复杂的)
- 注意第一行的
- 比较大小游戏
- 更多判断
- 嵌套
- 结合 and 和 or
- 循环控制 # 实现功能:重复和自动
- for 循环
for
#for
(对于)in
#in
(在……之中)item
#item
(每个元素) (你可以自定义,如果你喜欢的话)for i in namelist
# 对于在 namelist 中的每个元素 (i) 执行从属代码- range() 函数
- range(x)
range(10)
# 生成 10 (x
) 个整数 (从 0 开始)
- range(a, b)
range(1, 11)
# 生成 11 - 1 (b - a
) 个数 (从 1 (a
) 开始)
- while 循环
while
#while
(当……时)while a <= 10:
while
(当……时) (当 a <= 10 时,执行从属代码,否则循环停止)
- 区别 (for 循环与 while 循环)
- break 和 continue
- break
break
#break
(打破) (打破当前循环) (不会打破所有循环)
- continue
continue
continue
(继续) (继续循环的下一次迭代)
- Python_文件的创建和执行
Undo
git add
git reset
# Allgit reset ~/.config/i3/config
# A file
- Notes
- Because to remove a file from the index without changing anything else.
- References
- [[python]] 认识 Python
- 进入 Python 开发环境
python3
# 调用 interpreter (口译员;解释器)>>>
#primary prompt
(主要的提示符),处于 interactive mode (交互模式)...
#secondary prompt
(辅助的提示符),因为需要 continuation lines (续行)Control-D
quit()
exit()
#exit the interpreter
(退出解释器)
- 第一行代码
print("Hello World!")
#print()
(打印函数)Hello World
(字符串) (用引号括起来) (无论是一对单引号、还是一对双引号,灵活使用)
- 数据类型
int
#integer
(整数)float
# 浮点数 (小数)3.14 = 0.314 * 10
(小数点可以改变位置,故称浮点数)Ture
False
#bool type
(布尔类型)None
#NoneType
(无类型)
- 变量
name = "yaoniplan"
=
#equal sign
(等号)assign a value to variable
(分配一个值给变量)name
#variable
(多变的,变量)"yaoniplan"
#value
(值)
- Input() 函数
ID = input("请输入你的ID:")
#input()
(输入函数)
- 字符串
print('"isn\'t it," they said.')
'...'
"..."
#Strings
(字符串) (用引号括起来的就是字符串)backslashes
(反斜杠) #escape quotes
((逃脱,转义)引号)- 索引
strings = "yaoniplan"
strings[0]
# 第一个字符的索引为 0strings[-1]
# 最后一个 (倒数第一个) 字符的索引为 -1
- format()
format()
# 专门用来格式化字符串的函数- 插入数据
print("你叫{},今年{}岁了".format(name, age))
"{} {}".format(a, b)
# 等价于"{0} {1}".format(a, b)
- 数字格式化
print("{:.2f}".format(3.1415926))
# 保留两位小数
- 注释
#
##
(井号) 后面的内容 (包括代码) 会被忽略 (适用于单行注释;暂时不需要执行的代码)
- 运算符
- 算术运算符 # 常用的有
+ - * / %
(加减乘除余)a + b
#+
(加) (a 加上 b)a - b
#-
(减) (a 减去 b)a * c
#*
(乘) (a 乘以 c)a / c
#/
(除) (a 除以 c)b % a
#%
(余) (b 除以 a 的余)a ** b
#**
(幂) (a 的 b 次幂)c // b
#//
(整) (c 除以 b 的整)
- 比较运算符 # 常用于 判断和循环 中
a == b
#==
(等于) (a 等于 b)a != b
#!=
(不等于) (a 不等于 b)a > c
#>
(大于) (a 大于 c)a < c
#<
(小于) (a 小于 c)b >= c
#>=
(大于等于) (b 大于等于 c)b <= c
#<=
(小于等于) (b 小于等于 c)
- 赋值运算符 # 主要是为了简写
c = a + b
#=
(赋值符,等号) (分配一个值给变量) (分配a + b
的值给c
这个变量)c += a
#+=
(加法赋值符) (等价于c = c + a
)c -= a
#-=
(减法赋值符) (等价于c = c - a
)c *= a
#*=
(乘法赋值符) (等价于c = c * a
)c /= a
#/=
(除法赋值符) (等价于c = c / a
)c %= a
#%=
(余赋值符) (等价于c = c % a
)c **= a
#**=
(幂赋值符) (等价于c = c ** a
)c //= a
#//=
(整赋值符) (等价于c = c // a
)
- 逻辑运算符
0
1
#0
代表 False;1
代表 True (在逻辑运算中)a and b
#and
(与) (a 与 b 都为 Ture,则返回 True,否则返回 False)a or b
#or
(或) (a 或 b 为 Ture,则返回 Ture)not a
#not
(非) (a 为 True,则返回 False;否则返回 True)
- 算术运算符 # 常用的有
- 进入 Python 开发环境
- [[linux]] mv directory1 directory2 (solve: Direcroty not empty)
cp -r directory1 directory2
# 递归地复制目录1到目录2rm -r directory1
# 递归地消除1目录- 注意事项
- 产生问题的原因是目录2已经有目录1的同名目录,而
mv
命令不能够灵活的变通一下,所以采用cp
和rm
命令来实现功能 - 参考资料
- mv: Directory not empty
Display user name
whoami
- Notes
- Other methods
echo $USER
echo $LOGNAME
id --user --name
who
logname
- Because to share reuse scripts with everyone.
- Other methods
- References
man id
- ChatGPT
- [[linux]]
chown -R owner:group file
chown
# change owner (改变拥有者)-R
# R:recursive (递归的) (应用场景:连同目录及其下的所有文件及目录)owner
# 用户名 (可使用whoami
在终端中查看)group
# 组 (一般情况下,与 owner (用户名)一致)file
# 文件 (linux 一切皆文件 (包括目录,可配合上面的-R
一起使用))- 参考资料
man chown
# manual (手册) (在终端中查看)- 如何更改 linux 文件的拥有者和用户组 (chown 和 chgrp)
- wallpaper (2022-09-07)
- my chinese font (2022-09-07)
wqy-microhei
# 安装中文字体wqy-microhei
(有效解决中文乱码问题)- 参考资料
实践是检验真理的唯一标准 #quote
- 实践就像是编程里的 coding (写代码)
- Python 新手入门课,二刷中……
- Linux 目录操作
ls
#list
(列出) (列出当前目录下的文件及目录)cd
#change directory
(切换目录) (切换到其他目录下)- 快捷操作
cd ..
#..
(上一级) (切换到上一级目录)cd -
#-
(上一次) (切换到上一次所在目录) (效果:在最近的两次目录中无限循环)cd ~
#~
(/home/your_owner_name) (切换到 /home 目录下的当前用户名的目录下)cd /
#/
(根目录) (切换到根目录下)
- 绝对路径
pwd
#print working directory
(打印工作中的路径)cd /home/f/kaigua/Python_新手入门课
# 切换到该目录下 (无论你在哪个目录) (记补全或降低输入错误可以使用 Tab 键补全)
- 新建目录
mkdir linshi
#make directory
(制作目录) (制作一个名叫 linshi 的目录)mkdir -p linshi/linshione
#parents
(父母) (制作有父母关系的目录) (即使不存在)
- 快捷操作
- Linux_文件操作
touch linshi.md
#touch
(触碰) (触碰 linshi.md) (生成 linshi.md 文件)cp linshi.md linshione/linshitwo
#copy
(复制) (复制 linshi.md 文件到 linshione/linshitwo 目录下)cp -r linshi linshione/linshitwo
#recursive
(递归的) (递归地复制 linshi 目录到 linshione/linshitwo 目录下)rm linshi.md
#remove
(消除) (消除 linshi.md 文件)rm -r linshione
#recursive
(递归的) (递归地消除 linshione 目录及其下所有文件、目录)mv linshi.md linshi
#move
(移动) (移动 linshi.md 文件到 linshi 目录下)mv linshi linshione
#rename
(改名) (改名 linshi 目录为 linshione 目录)- 查看文件内容
cat linshi.md
#concatenate
(连接) (连接 linshi.md 文件并打印到标准输出上)cat -n linshi.md
#number
(编号) (给连接 linshi.md 文件所有输出行编号并打印到标准输出上)
- 编辑文件
- 帮助命令
man cat
#manual pages
(手册页) (查看 cat 命令的手册页)cat --help
#help
(帮助) (显示 cat 命令的帮助)
- 查看文件内容
- [[linux]]
ls -lh
命令ls
# list (动词:列出)-lh
# 参数l
# list (名词:列表)h
# human readable (人类可读)- 参考资料
- [[linux]]
chmod u+x sleep.py
命令chmod
# change mode (切换模式)u
# user (当前用户)+x
# 增加 execute (执行) 权限sleep.py
# 文件名- 参考资料
- [[linux]]
/usr/bin
含义usr
# unix software resources (unix 软件资源)bin
# binary (二进制)- 参考资料
- [[linux]]
chmod a+x /usr/bin/sleep.py
命令a+x
# all (全部) (所有用户和组)- 参考资料
- [[Vim]]
o
o
# 在当前行下方,插入一个新行,并进入编辑模式 (在普通模式下,按o
(小写字母))- 参考资料
- [[linux]]
~/.zshrc
含义~
# 等价于/home/你的用户名
(当前用户的用户文件夹)/
#/home/你的用户名/
(在这里,指当前目录下).
# 隐藏文件 (可以使用ls -a
查看包括隐藏文件的所有文件)zsh
# shell 是 zshrc
#run commands
- 参考资料
- [[linux]]
source ~/.zshrc
source ~/.zshrc
# 手动运行~/.zshrc
- 参考资料
- [[linux]]
pid
ppid
含义pid
# p:process (进程)ppid
# p:parent (父母) p:process (进程)- 参考资料
- 测试 csv 转 markdown v1.0.0
关于耀拟计划 & 免责声明 - 时间就是金钱,效率就是生命 - 000 - 自我提升 400 - 生活 行动管理 阿里云盘链接 生活管理 阿里云盘链接 时间管理 阿里云盘链接 形象提升 阿里云盘链接 学习效率 阿里云盘链接 健康养生 阿里云盘链接 文笔口才 阿里云盘链接 餐饮美食 阿里云盘链接 思维认知 阿里云盘链接 商业知识 阿里云盘链接 为人处事 阿里云盘链接 情感两性 阿里云盘链接 100 - 幼儿到高中学习资料 兴趣爱好 阿里云盘链接 幼儿教育 阿里云盘链接 500 - 文学修养 小学初中教育 阿里云盘链接 人物传记 阿里云盘链接 高中教育 阿里云盘链接 演讲演说 阿里云盘链接 200 - 计算机编程教程 传统国学 阿里云盘链接 计算机基础 阿里云盘链接 600 - 职场相关 Python 阿里云盘链接 职场竞争力 阿里云盘链接 Web前端 阿里云盘链接 领导能力 阿里云盘链接 Android 阿里云盘链接 项目管理 阿里云盘链接 300 - 软件教程 平面设计 阿里云盘链接 PPT教程 阿里云盘链接 人力资源 阿里云盘链接 Word教程 阿里云盘链接 自媒体营销 阿里云盘链接 Excel教程 阿里云盘链接 文案写作 阿里云盘链接 PS教程 阿里云盘链接 各种模板 阿里云盘链接 PR教程 阿里云盘链接 700 - 各类考证资料 摄影教程 阿里云盘链接 公务员考试 阿里云盘链接 思维导图教程 阿里云盘链接 驾考资料 阿里云盘链接 Anki教程 阿里云盘链接 阿里云盘链接 Powered by 凉风习~又一秋! v2021.12.12 - 测试 vsc 转 markdown v1.0.1
关于耀拟计划 & 免责声明 - 时间就是金钱,效率就是生命 - 000 - 自我提升 400 - 生活 行动管理 阿里云盘链接 生活管理 阿里云盘链接 时间管理 阿里云盘链接 形象提升 阿里云盘链接 学习效率 阿里云盘链接 健康养生 阿里云盘链接 文笔口才 阿里云盘链接 餐饮美食 阿里云盘链接 思维认知 阿里云盘链接 商业知识 阿里云盘链接 为人处事 阿里云盘链接 情感两性 阿里云盘链接 100 - 幼儿到高中学习资料 兴趣爱好 阿里云盘链接 幼儿教育 阿里云盘链接 500 - 文学修养 小学初中教育 阿里云盘链接 人物传记 阿里云盘链接 高中教育 阿里云盘链接 演讲演说 阿里云盘链接 200 - 计算机编程教程 传统国学 阿里云盘链接 计算机基础 阿里云盘链接 600 - 职场相关 Python 阿里云盘链接 职场竞争力 阿里云盘链接 Web前端 阿里云盘链接 领导能力 阿里云盘链接 Android 阿里云盘链接 项目管理 阿里云盘链接 300 - 软件教程 平面设计 阿里云盘链接 PPT教程 阿里云盘链接 人力资源 阿里云盘链接 Word教程 阿里云盘链接 自媒体营销 阿里云盘链接 Excel教程 阿里云盘链接 文案写作 阿里云盘链接 PS教程 阿里云盘链接 各种模板 阿里云盘链接 PR教程 阿里云盘链接 700 - 各类考证资料 摄影教程 阿里云盘链接 公务员考试 阿里云盘链接 思维导图教程 阿里云盘链接 驾考资料 阿里云盘链接 Anki教程 阿里云盘链接 阿里云盘链接 - 测试 csv 转 markdown v1.0.2
000 - 自我提升 400 - 生活 行动管理 生活管理 时间管理 形象提升 学习效率 健康养生 文笔口才 餐饮美食 思维认知 商业知识 为人处事 情感两性 100 - 幼儿到高中学习资料 兴趣爱好 幼儿教育 500 - 文学修养 小学初中教育 人物传记 高中教育 演讲演说 200 - 计算机编程教程 传统国学 计算机基础 600 - 职场相关 Python 职场竞争力 Web前端 领导能力 Android 项目管理 300 - 软件教程 平面设计 PPT教程 人力资源 Word教程 自媒体营销 Excel教程 文案写作 PS教程 各种模板 PR教程 700 - 各类考证资料 摄影教程 公务员考试 思维导图教程 驾考资料 Anki教程 - 测试 csv 转 markdown v1.0.3
000 - 自我提升 400 - 生活 行动管理 生活管理 时间管理 形象提升 学习效率 健康养生 文笔口才 餐饮美食 思维认知 商业知识 为人处事 情感两性 100 - 幼儿到高中学习资料 兴趣爱好 幼儿教育 500 - 文学修养 小学初中教育 人物传记 高中教育 演讲演说 200 - 计算机编程教程 传统国学 计算机基础 600 - 职场相关 Python 职场竞争力 Web前端 领导能力 Android 项目管理 300 - 软件教程 平面设计 PPT教程 人力资源 Word教程 自媒体营销 Excel教程 文案写作 PS教程 各种模板 PR教程 700 - 各类考证资料 摄影教程 公务员考试 思维导图教程 驾考资料 Anki教程 - 测试 csv 转 markdown v1.0.4
------ 自我提升 ------ ------ 软件教程 ------ ------ 文学修养 ------ 行动管理 PPT 人物传记 时间管理 World 演讲演说 学习效率 Excel 传统国学 文笔口才 PS ------ 职场相关 ------ 思维认知 PR 职场竞争力 为人处事 摄影 领导能力 - 幼儿到高中学习资料 - 思维导图 项目管理 幼儿教育 Anki 平面设计 小学初中教育 -------- 生活 -------- 人力资源 高中教育 生活管理 自媒体营销 --- 计算机编程教程 --- 形象提升 文案写作 计算机基础 健康养生 各种模板 Python 餐饮美食 ---- 各类考证资料 ---- Web前端 商业知识 公务员考试 Android 情感两性 驾考资料 兴趣爱好 -- [[python]]文件名、文件夹名命名约定 hello_world.py
# 文件名命名约定- 注意事项
hello
world
# 小写字母_
# 下划线代替空格- 参考资料
- Python编程:从入门到实践 (第2版) .pdf
从他人对大学生活的吐槽中,了解了 #Idea
- 破一本,强制的活动、班会、会议 # 没有任何意义,除了浪费精力
- References
Reset to a previous version
git log
git reset --hard 8172b02
git push -f
- Notes
git log
# Show commit logs (e.g. 8172b02..., e3bd5dd..., etc)git reset --hard 8172b02
# Revert to the 8172b02... version-f
# Forcegit reflog
# Show all commit logs (including discarded version)- Warning: The method is not recommended. (Make sure what you discarded is less important)
git status
# Make sure all changes are pushed to the remote before using the command
- References
- 英语
, etc.
(等等) 使用comic1, comic2, etc.
# 漫画1, 漫画2, 等等。- 注意事项
comic1, comic2
# 两个同类事物 (你可以自定义两个及以上), etc.
# 等等,tec
前要有,
(逗号空格), 其后要有.
(英文句点)- 参考资料
- 学术英语:关于such as, for example, etc., and so on, i.e., 和e.g.的使用
- 断电半小时(今年断电次数有点多),考虑备用能源(发电机……) in the future #Idea
-- [[linux]]
command [-options] [parameter]
command [-options] [parameter]
# 终端命令格式- 注意事项
command
# 命令名[]
# 可选 (大白话: 可有可无)options
# 选项parameter
# 参数- 参考资料
- [[linux]]
ip address | grep inet
ip address | grep inet
# 查看网卡 ip 地址- 注意事项
ip address
# 网卡配置信息|
# pipe (管道) (一个命令的输出,作为另一个命令的输入。大白话:将左边命令显示出来的结果,用右边命令来显示)grep
# 文本搜索 (相当于网页浏览器的ctrl + f
)inet
# grep 搜索的文本- 参考资料
- 2022-09-01,yaoniplan 完全转移更新平台(从腾讯文档转移至GitHub)
- [[python]]
x op= expression
x op= expression
# 简写运算的语法- 注意事项
x
# 变量名op
# 运算符 (op: operator)=
# 赋值expression
# 表达式x op= expression
# 等价于x = x op expression
- 参考资料
- Python3 简明教程 - 运算符和表达式
- [[i3]]默认配置文件目录 (2022-08-31)
.config/i3/config
//位于/home/你的用户名/
下面
a = f(1, 2) + g(3, 4)
//参数列表中,在,
后面添加一个空格;在运算符周围各添加一个空格- 参考资料
# 这是一个注释
//井号 (#
) 后面跟一个空格,再写注释- 注意事项
开发人员和维护代码库人员
# 面向人群- 参考资料
- 修改已经
git push
的git commit -m 'beizhu'
中的beizhu
git commit --amend
# 修改 beizhu (进入到类似 vim 的编辑器操作界面)git push -f
# 强制 push (在修改了 beizhu 之后) (f: forcce) -- [[shell]] [[zsh]]快捷键(补充)ctrl + b
//向左边移动一个字节 (b: back)ctrl + f
//向右边移动一个字节 (f: forward)
- [[regex]]学习路线 (regex: regular expression) (正则表达式)
- 行:是横着的;列:是竖着的
- 参考资料
付出不一定有收获,但是不付出一定没有收获 #quote
- [[linux]]代理配置先用着 clash-for-windows (闭源+广告) ,毕竟代理需求已经实现,先把计算机科学与技术的基础能力提升上去,再去考虑这些问题,计划下一步:使用 v2ray-core (否则只能是被卖了,还在帮他人数钱,并洋洋自得毫不自知) #Idea
xx只有高低之分,没有贵贱之别 #quote
展露出强大的实力才能震慑住宵小之辈,但也只能是宵小之辈 #quote
Decompress a ".tar" file
tar -xf testData5.tar
- Notes
-x
# Extract-f
# File
- References
- [[Vim]]
:!
命令:!python oeasy.py
//执行外部命令python oeasy.py
- 参考资料
- -- [[i3]]锁屏
i3lock
//锁定屏幕 (在终端输入)- 注意事项
bindsym $mod+x exec i3lock
//绑定快捷键$mod+x
终端执行i3lock
(当然,你可以绑定快捷键并自定义,如果你喜欢的话)
- 安卓模拟器 (future,有需求再尝试) #Idea
- anbox
- waydroid
- [[Logseq]]
crtl + k
检索ctrl + k
//检索- 注意事项
Re-index
//Rebuild the graph (目前(2022-08-27)检索前,需要手动重建图,否则最近的更新,检索不出来)- 参考资料
光年:光在宇宙真空中沿直线传播了一年时间所经过的距离
- 注意事项
- 地球上用到的距离单位(毫米、厘米、分米、米、千米、天文单位)用来衡量宇宙空间太小,所以有了光年这个距离单位
- 参考资料
- 什么是光年?-科普100问-湖北科普网 #quote
- [[linux]]mkdir命令
mkdir '目录名'
//创建目录- 注意事项
'目录名'
//用'
(单引号) 括起来 (目录名中有空格)(否则,将会生成多个目录)- 参考资料
- [[linux]]cd
..
cd ..
//上一级目录- 注意事项
cd ../note
//进入上一级目录下的 note 目录 (应用场景:在同一个目录下,拥有多个仓库,需要分别进行 git 相关操作)- 参考资料
- -- [[i3]]开机自启动clash-for-windows软件
exec --no-startup-id cfw
//enable proxy "cfw" (在后台启动 cfw)- 注意事项
--no-startup-id
//禁用启动通知 (即开机的时候,启动但不在工作区显示窗口)Silent Start
//开启后台启动 (在 cfw 的 Settings-General 下面,把Silent Start
按钮打开,否则开机可能会显示 cfw 的窗口)- 参考资料
- https://i3wm.org/docs/userguide.html#exec
Set scrachpad in i3
vim ~/.config/i3/config
bindsym Mod1+Shift+space move scratchpad bindsym Mod1+space scratchpad show for_window [class="^st-256color$"] move scratchpad
- Notes
move scratchpad
# Move a window to the scratchpad workspacescratchpad show
# The window will be shown or hidden
- References
- #Shell shortcut keys
ctrl + u
//剪切 (当前行)ctrl + y
//粘贴 (被命令删除的文字)ctrl + w
//删除光标左边一个单词 (w: word)ctrl + e
//移动到行尾 (e: end)ctrl + a
//移动到行首ctrl + k
//删除从光标到行尾的内容ctrl + l
//清屏 (相当于clear
)alt + .
# Parameters of the previous command
- References
- [[i3]]Automatically starting applications on i3 startup (开机自动打开应用)
exec command
//自动在终端执行命令- 注意事项
command
//这个是能在终端执行的命令 (举例:在终端输入alacritty
能够打开终端模拟器,则command
为alacritty
;在终端输入chromium
能够打开网页浏览器,则command
为chromium
;……)- 参考资料
- https://i3wm.org/docs/userguide.html#_automatically_starting_applications_on_i3_startup
Assign applications to workspace in #i3
assign [class="st-256color"] number 1
- Notes
st-256colors
# A class namexprop
# Type it in terminal and then click an applications you want to get class name
1
# Replace the workspace name with other number (e.g. 2, 3, etc.)
- References
- 今天(2022-08-26),查看 archiso 的 shell,它的默认 shell 为 zsh
- 总结:可以使用 zsh 的快捷键,进行操作 archiso
- 参考资料
- [[i3]] and [[Vim]] move hotkey
jkl;
//i3 默认移动键hjkl
//vim 默认移动键- Notice
$mod+d
//与 horizontal 热键冲突 (请修改 horizontal 的热键,比如:$mod+semicolon
)hjkl
//统一 i3 与 vim 移动键
- [[i3]] [[sound]]
- 修改前
- 修改后
- Notice
$mod+F10
+10%
$mod+F9
-10%
//音量增加/减少 (请根据你自己电脑的音量键,设置相应的键,你也可以自定义)mute
$mod+F11
//静音键 (同上,mute: 沉默的)$mod+Shift+r
//重启 i3 (然后按下静音键) (如果没有声音的话)
- [[Logseq]]上传文件
/Upload an asset
//上传文件 (在 logseq 中输入此命令)
- [[i3]] [[screenshot]]
bindsym Print exec flameshot gui
//开启截图 (如果没有 flameshot 的话,请安装 flameshot)
Set gaps in i3
for_window [class="^.*"] border pixel 6 //隐藏窗口标题栏,并设置窗口边框像素(可以自定义数字) gaps inner 5 //相邻 window(窗口)之间的距离 gaps outer 0 //window(窗口)与屏幕边缘之间的距离 smart_gaps on //如果 workspace(工作空间)只有一个 window(窗口),将禁用 gaps(间隙)
- Notes
- Draw only if more than one container is in the workspace
smart_gaps on smart_boards on
- Draw only if more than one container is in the workspace
- References
- [[i3]] [[exit]]
bindsym $mod+Shift+e exit
//退出 i3,不用鼠标 (移除 "exec ……" 这个警告,并添加 "exit")
- [[i3]]改变聚焦 (避免与浏览器快捷键冲突,如果你的 $mod 键是alt的话)
#bindsym $mod+Left focus left //注释这行 #bindsym $mod+Down focus down //注释这行 #bindsym $mod+Up focus up //注释这行 #bindsym $mod+Right focus right //注释这行
- [[Vim]]行间移动
10j
//向下10行 (number (数字) + h/j/k/l,你可以自定义)
- [[i3]] [[i3status]] 取消状态栏图标
- 在行首,添加注释 (i3status 的配置文件)
- Notice
locate i3status
//查找 i3status 的配置文件 (使用 locate 命令)
Use "locate"
locate awesome
- Notes
awesome
# Replace it with your desired file namedoas emerge -aq sys-apps/mlocate
# Install it in Gentoo Linuxdoas updatedb
# Update the database before locatingdoas groupadd mlocate
# Add a group to solve the problem[yaoniplan@tux:~]$ sudo updatedb updatedb: can not find group `mlocate' [yaoniplan@tux:~]$
- References
- [[i3]]workspace(工作区)图标
- 将复制的图标粘贴到如图所示的位置
- Notice
- https://fontawesome.com/cheatsheet //
ctrl + c
即可复制 (如果找不到可以复制的图标的话) - 如果没有awesome字体,请安装 ttf-font-awesome
- References
- https://www.youtube.com/watch?v=Bw5sDLOvN20&ab_channel=GerryStudios
- 主机快照timeshift(快照可存其他盘,非系统盘) future #Idea
- [[linux]] [shell]zsh
chsh -s /bin/zsh
//改变 shell (如果没有 zsh,请安装 zsh)- 安装 Powerlevel10k (请在国内源/国外源,选择其中一个)
- 国内源
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
- 国外源
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
exec zsh
//尝试 zshp10k configure
//重新自定义配置 (如果你对刚才配置的不满意的话)- 注意事项
- 如果出现 zsh 没有生效的情况,请注销并重新登陆
ctrl + shift + e
# If your zsh is't work, then please use hotkeyctrl + shift + e
to exit i3 in your i3wm.(After exiting i3, you need input your password to start i3.)- 参考资料
- https://github.com/romkatv/powerlevel10k#installation
Mount a hard drive temporarily in Unix-like
doas mkdir /mnt/isoFile/
doas mount /dev/sdc1 /mnt/isoFile/
- Notes
doas umount /mnt/isoFile/
# Unmount/dev/sdc1
# Replace it with block device (e.g. /dev/sdb)lsblk
# Get it
- Mount in an empty directory under the /mnt/ directory
- References
- [[git]] 修改 commit 的注释
git commit --amend
//此时会进入文本编辑器,修改注释后保存退出即可- 参考资料
- git 使用场景2:commit 之后,想撤销 commit
- [[i3]] [[fullscreen]] [[hotkey]]
mod + f
//全屏打开被聚焦的窗口 (f: fullscreen)- 参考资料
- i3 - Gentoo Wiki
- [[i3]] 界面功能需求(2022-08-24)
- 窗口背景模糊
- 聚焦边框颜色 (方便知道聚焦的窗口是哪个)
- 顶部状态栏自定义
- 参考
- [dwm] guess which OS i use : unixporn
- [[i3]] autostart [[redshift]]
exec --no-startup-id redshift -O 1800
//开启 redshift- Notice
redshift
//如果没有 redshift 的话,请安装 redshift1800
//色温 (你可以自定义)
- picom is so slow in i3 (linux) #Idea
- [[i3]] [[wallpaper]]
exec --no-startup-id feh --bg-fill /home/uesrname/wallpaper/Syu.png
//开启壁纸- Notice
feh
//如果没有 feh 的话,请安装 feh/home/username/wallpaper/Syu.png
//壁纸目录 (你可以自定义)
- [[i3]] [[input method]] autostart
exec --no-startup-id fcitx5
//开启 fcitx5 (请添加在 i3 的配置文件中)- Notice
fcitx5-im
fcitx5-chinese-addons
fcitx5-pinyin-zhwiki
//如果没有 fcitx5 的话,请安装 fcitx5/etc/environment
//编辑这个文件
GTK_IM_MODULE=fcitx //添加这一行 QT_IM_MODULE=fcitx //添加这一行 XMODIFIERS=@im=fcitx //添加这一行
Use "arch-chroot" in Arch Linux on btrfs
mount /dev/sda2 /mnt -o subvol=/@
arch-chroot /mnt
- References
- [[arch]] [[linux]] [[i3]] [[bar]] [[position]] 状态栏位置(底部或顶部)
- 语法
position top|bottom
- 例子
bar { position top }
- [[i3]] [[hotkey]]layout toggle split
- mod + shift + up/down/left/right //切换分裂布局
- 虚拟机 vmware-workstation 在 archlinux 中,与 qemu 一样折腾 #Idea
Decompress a ".gz" file
gzip -d testData.gz
- Notes
-d
# Decompress
- References
- [[linux]] [[i3]]网络代理([[proxy]])
- sudo vim /etc/environment //添加以下三行:
export http_proxy="127.0.0.1:7890"
export https_proxy="127.0.0.1:7890"
export no_proxy="localhost,127.0.0.1"
- 下载 clash-for-windows //2022-08-22 在用 aur 中的 clash-for-windows-bin
- source /etc/environment //重载
/etc/environment
配置 - 注意事项
- i3 搜索
cfw
才能在 dmenu 中找到并打开软件 - 参考资料
- https://www.ahdark.com/som/1643.shtml
- sudo vim /etc/environment //添加以下三行:
- 我的 i3 网络代理之路
- [[arch]] [[linux]] [[i3]]文件管理器
sudo pacman -S thunar
//安装文件管理器(轻量)
Download a file using a magnet link
transmission-qt
deluge
qbittorrent
- References
nix-shell --packages deluge
- [[linux]] [[i3]] [[配置]]问题 (please search something in English)
- youtube //质量高(google: 时效性(保质期)问题; archwiki: 新手不友好问题)
- 虚拟机需求
- 自动调整窗口大小
- 剪贴板共享
- 文件共享(例如:拖拽)
- 总结:qemu 暂时放弃 //上面三点,在 archlinux 中,非常折腾 #Idea
- [[virtualbox]]解决自动调节窗口大小问题
- virtualbox-ext-oracle //从aur中,安装这个包
- host + c //自动调节窗口大小 (使用快捷键 right + ctrl + c)
Extract a ".tar.gz" file in Linux
tar -xf chezmoi_2.28.0_linux_amd64.tar.gz -C ~/chezmoi/
- Notes
mkdir ~/chezmoi/
# Make a directory before using the tar command-x
# Extract-f
# File-C
# Change
- References
- [[linux]] [[arch]] [[更新]]命令
- sudo pacman -Sy //同步(更新)库(也可以测试源速度)
- sudo pacman -Syu //同步(更新)库并更新包
Use "grep"
grep --line-number fgpt ~/.bashrc
# Get the line number (Usesed
command to delete the line)grep -x "$current_wallpaper" -A 1 "$wallpaper_list" | tail -1
# Get next wallpapergrep -A 10 "Artificial" note/pages/Future.md
# Show the next 10 lines after the line
- Notes
-x
# Exactly match-A
# After
- References
man grep
#/-x
/-A
/-B
- ChatGPT
Install "virtualbox" in Arch Linux
doas pacman -S virtualbox virtualbox-host-modules-arch
# Install packagesdoas modprobe vboxdrv vboxnetadp vboxnetflt
# Load modulesdoas gpasswd --add yaoniplan vboxusers
# Use USB
- Notes
doas reboot
# Make all changes effective- New install
# Preferences of File ## General /home/yaoniplan/.config/virtualbox/ # Default Machine Folder ## Input Auto Capture Keyboard # Extended Features (Turn it off)
- References
- [[linux]] [[arch]] [[i3]] [[wm]] [[hotkey]](alt: mod1; super: mod4)
- mod + enter //终端
- mod + d //搜索
- mod + number //工作区
- mod + shift + q //关闭窗口 (q: quit)
- mod + shift + number //移动窗口到工作区(在 manjaro-i3 中,这里的 shift 是 ctrl)
- mod + j/k/l/; //移动焦点
- mod + shift + e //退出 i3 (e: exit)
- mod + h/v //水平化/垂直化窗口(在新建一个窗口之前,h: horizontal; v: vertical)
- mod + shift + r //重启 i3 (r: reboot)(mod + shift + c //重载 i3 配置在 archlinux-i3 中没有什么用)
- sudo vim ~/.config/i3/config //设置 i3 配置文件 (在 manjaro-i3 中,配置文件在 ~/.i3/config)
- 参考资料
- i3wm 的使用说明
- manjaro i3 安装配置全记录
- [[Git]] [[manual]]一般做好准备步骤后,手动常用命令
- git add . //添加到缓存区(在同步的目录下)
- git commit -m 'remark' //提交到版本区(remark 可以换成其他备注信息)
- git push //推送到远程仓库
Use "redshift"
redshift -O 1500
# One-shot
- Notes
redshift -x
# Resetnix shell nixpkgs#redshift
# Install dependencies temporarily
- References
man redshift
- [[Vim]] 快速跳转到某 [[行]] (这里的 n 为数字)
- ngg(nG)
- :n
- [[linux]]
df
(disk free)显示[[磁盘]] 使用情况命令
参考资料
df命令-显示磁盘空间使用情况 灭六国者六国也,非秦也。族秦者秦也,非天下也。(应用场景:某垄断被成功反垄断之时) #quote
- [[鼠标]] 中键(三击)
- 复制粘贴 //选择后,中键(三击)
- 关闭浏览器标签
- [[linux]] 一切皆文件
- [[math]] 科学记数法
一个数被写成一个实数a
与一个10的n次幂
的积
在计算机中用e
来表示10的幂
Q: 怎么用?
A: 3e5
(3e5=3*$10^5$)
参考资料
科学记数法 - [[Markdown]] 次方(上标)
写法
预览
参考资料
Markdown数学公式语法
The punctuation of "dollar sign" is "$".
- Notes
- Because the Shell language needs to use dollar sign to reuse variables.
- References
- [[linux]] 折腾 [[dwm]] 好累啊(主要是资源质量太低、时效性短,虽然 [[dwm]] 简洁高效,但是要配置的东西太多了,比如:显示亮度、没声音、网络代理、截图(据说 grim 可用)、笔记本触摸板……)
Modify brightness or backlight in Linux
doas vim /sys/class/backlight/intel_backlight/brightness
- Notes
- View maximum brightness
cat /sys/class/backlight/intel_backlight/max_brightnes
intel_backlight
# Replace it your graphics card model
- View maximum brightness
- References
- ChatGPT
Use "mv"
for f in *; do mv "$f" "230317$f"; done
# Add string "230317" to the beginning of each file namemv ~/Download/Trash/ ~/.trash
# Rename to hidden directory
- Notes
f
# A variablefor f in *; do mv "$f" "${f:6}"; done
# Remove the first 6 lettersfor f in *; do mv "$f" "${f:0:-6}"; done
# Remove the last 6 letters
- References
- ChatGPT
- [[linux]] 安装全套教程
- [[python]] 四则运算(简便 [[计算器]] )
*
(乘号,举例:1386*768
,回车即可得到运算结果)
- [[linux]] [[触摸板]] 手势与鼠标的关系
- 单击(左键)
- 双击(右键)tip: 双指移动(滚轮)
- 三击(中键)
Use "readlink"
readlink $(which tree)
# Read the hard link
- Notes
- Because to replace
ls -l $(which tree)
.
- Because to replace
- References
- https://nixos.asia/en/nix-first #
/readlink
- https://nixos.asia/en/nix-first #
- [[linux]]基础命令
passwd 用户名
//为用户设置密码(password 的简称)useradd 用户名
//添加用户命令 -h
或man 命令
//查看命令帮助(-h 参数的意思是 help,更加详细请使用man 命令
)cd 目录
//切换目录(cd 是 change directory,tips: 目录也叫路径)ls 目录
//列出目录下的文件(ls 是 list)ls -l 目录
//用列表的方式列出目录下的文件(l 是 listing)
- 第一个字段的第一个字符是文件类型 //
-
表示文件;d
表示目录 - 第一个字段剩下的9个字符是模式(权限位) //3个一组,每组 rwx 表示 “read(读)” “write(写)” “execute(执行)”。(字母表示有这个权限;横线表示没有这个权限)
- 第一个字段的三组分别:所属的用户权限、所属的组权限、其他用户的权限 //比如:-rw-r--r-- 是一个文件,对于所属用户,可读可写不可执行;对于所属组,仅仅可读;对于其他用户,仅仅可读
- 第二个字段是硬链接数目
- 第三个字段是所属用户,第四个字段是所属组,第五个字段是文件大小,第六个字段是文件被修改的日期,最后是文件名
ls -la
//以列表的形式显示全部文件(a 是 all)vim hello
//文本编辑器 vim 打开(若没有,则创建)一个名叫 hello 的文件
(移动光标:上下左右键;
- 编辑:将光标移动到相应位置,输入
i
(insert); - 退出编辑模式:按
esc
键; - 写入:输入
:
,在:
后面输入w
(write),写入(保存); - 退出:在
:
后面输入q
(quit),退出文件; 强制退出:在:
后面输入q!
)
Use "shutdown" in Linux
shutdown -h 23:00
# Shut down at 23:00 todayshutdown -h +30
# Shut down after thirty minutes
- Notes
-h
# Haltshutdown -h now
# The same aspoweroff
shtdown -r now
# The same asreboot
-r
# Reboot
- References
man shutdown
- ChatGPT
- #linux Shell
su 新用户名 #切换成新用户 sudo pacman -S zsh #安装 zsh chsh -s /bin/zsh #修改默认的 Shell(chsh -l 可以查看已有 shell) git clone https://github.com/romkatv/powerlevel10k.git //下载 powerlevel10k sudo vim /home/用户名/.zshrc //编辑 .zshrc 并添加 source ~/powerlevel10k/powerlevel10k.zsh-theme
Use "pacman"
doas pacman --sync mplayer
# Install a package
- Notes
doas pacman --remove --recursive mplayer
# Remove a package with dependenciesdoas pacman --sync --refresh --sysupgrade
# Upgrade the system- Solve a problem that command not found
doas pacman --sync archlinux-keyring
- Solve a problem that package is marginal trust
doas pacman --sync --refresh
# Sync package databases- Solve a problem that the package cannot be installed
- Use "archlinuxcn"
doas vim /etc/pacman.conf
[archlinuxcn] Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
doas pacman --sync --refresh archlinuxcn-keyring
doas pacman-key --lsign-key "farseerfc@archlinux.org"
# Locally sign trusted key to solve the problemerror: archlinuxcn-keyring: signature from "Jiachen YANG (Arch Linux Packager Signing Key) <farseerfc@archlinux.org>" is marginal trust
doas pacman --sync --refresh archlinuxcn-keyring
# Reinstall- Because to use additional packaged executable software.
- References
- [[notion]] 工具太杂,不像是使用工具,反而是被工具使用 #Idea
- [[vscode]] 打开 [[终端]]
- 查看(
View
)-终端(Terminal
) ctrl + 单引号
(快捷键)
- 查看(
造谣成本太低(一句话的事) #quote -- in the [[future]] ,开发临时发送接受 [[邮箱]] (需求:国内网络能发送)#idea
这种“只许州官放火,不许百姓点灯”的双重标准,实在是……
- [[vscode]] 实时预览 [[Markdown]] :
Ctrl + Shift + P
(输入Markdown,选择Markdown:Open Preview to the Side
)Ctrl + K
再按v
(快捷键) -- >人为刀俎我为鱼肉,这便是寻常百姓家 #quote
你所谓的消息,只是传言,而非情报,要想打听到关于xxx的准确情报,必须依靠专业的情报机构,这样我们才能更快的发展自己,集中优势资源,早日将目的达成 #quote
- Syncthing [[sync]] 文件
- 安装syncthing(手机、电脑端都要)
- 文件夹路径:/home/ss/Sync(/storage/emulated/0/Sync);文件夹标签:Sync(尽量统一)
- 添加设备(手机扫电脑端二维码)
- 版本控制-设置为保留5个版本数量(手机、电脑端都要)
|
竖线 [[symbol]]- 今天,刚入门 [[Git]],为了同步笔记 #Idea- 经测试, [[Logseq]] 本地仓库能自动commit,但是需要手动push(如果能自动push的话,那就更好了)
- 今天,清理了浏览器书签(将不常用的网站放入了 [[future]] )
- 对我而言,米斯特软的教授了我如何更好地使用[[Logseq]]来管理生活和笔记
在[[v2ex]]上,据说- ta退过学,退学前,就已经写了7年代码
- 退学原因:没有办法同时兼顾ta喜欢的和ta不喜欢的课程,疲于应付功课
- 总结:学历很重要,且不建议退学,除非已经铺好后路、拥有解决问题的能力- #### The punctuation of "caret" is "^".
- Use in programming (e.g. Python) and mathematics
- References
- 我认为,手机端开源输入法并不怎么方便(大概是我不会配置的原因,然后Gboard-Google键盘凑合用了) #Idea
- 我认为,初步 [[study]] 管理系统由以下部分组成:
- 笔记([[Logseq]])
- 代办事项([[teambition]])
- 中转站([[flomo]])(可以是临时笔记、代办事项、时间日志) -- #### Add an alias email for Outlook
- Click the icon in the upper right corner - My profile
- Click the 'Sign-in preferences' in 'Account info'
- Click 'Add email'
- Notes
- Can only add two aliases per week
淡定淡定,我只是做了我该做的事 #quote
动宾+有什么好处吗?
例:参加篮球队有什么好处吗? #quote都是同行衬托的好 #quote
- Git
- 分布式
- 日常使用
- 系统管理
Move spam to inbox automatically in Gmail
- Click "Create a new filter" in "Settings"
- Type "is:spam" in the "Has the words"
- Click "Create filter" and "OK"
- Click "Never send it to Spam" checkbox
- Click "Create filter"
- Notes
- Because to unify all mail.
- 我认为, [[Logseq]] 只适合用来做笔记,不适合用来 [[时间管理]]#idea
提问之前 在你准备要通过电子邮件、新闻群组或者聊天室提出技术问题前,请先做到以下事情:
- 尝试在你准备提问的论坛的旧文章中搜索答案。
- 尝试上网搜索以找到答案。
- 尝试阅读手册以找到答案。
- 尝试阅读常见问题文件(FAQ)以找到答案。
- 尝试自己检查或试验以找到答案。
- 向你身边的强者朋友打听以找到答案。
- 如果你是程序开发者,请尝试阅读源代码以找到答案。 当你提出问题的时候,请先表明你已经做了上述的努力;这将有助于树立你并不是一个不劳而获且浪费别人的时间的提问者。如果你能一并表达在做了上述努力的过程中所学到的东西会更好,因为我们更乐于回答那些表现出能从答案中学习的人的问题。 #quote
- [[ventoy]]测试(环境:usb2.0电脑 和 usb3.0u盘)
速度(gpt):$\overline{33}$MB/s
速度(dos):$\overline{100}$MB/s
结论:在这种情况下,以root权限处理文件,u盘格式dos的速度更快 #Idea - [有效学习:处理知识的20条规则([[anki]])](https://www.yuque.com/supermemo/wiki/20rules)
- 我陷入了沉思:(关于壁纸)
- 理论上,找壁纸和欣赏壁纸都需要花费时间和精力成本(所以,我决定放弃跟壁纸有关的事情)
- 但是,我有时有一种壁纸能促进生产力的感觉(in the [[future]] ,调查研究实验壁纸)
- in the [[future]] ,专业大概率选择 [[计算机科学与技术]]
虽千万人吾往矣(即使面对千万人的阻止,我也要勇往直前) #quote
The abbreviation of "Objectives and key results" is "OKR"
- A framework
- Goal-setting
- A framework
- References
- in the [[future]] 自己制作适合自己的 winpe(别人的不放心)
- wepe
- edgeless
- firpe
- hotpe
- in the [[future]] 笔记本电脑电池,询问注意事项(充不了电,真的难受) #Idea
- notion的docx文件导入失败,网络不稳定,决定放弃使用,而且同步的文件没有保障[[notion]] #Idea
- 添加 [[Google]] 账户
- 手机打开
Google设置
- 点击
xxx@gmail.com
- 点击
再添加一个账号
(等待核对信息) - 点击
创建账号
-为我自己创建
- 输入
名字
- 完善
基本信息
-下一步
- 点击
创建您自己的 Gmail 地址
-输入名字-下一步
- 输入密码-
下一步
- 大致就ok了
- 手机打开
- mp4转mp3
- 下载 [[vlc]]
- 找到转换
- 添加 mp4 文件
- 选择转换类型 Audio-MP3
- 接着选择目标地址
- 点击
start
- 现在先优化 [[Logseq]]到这种程度,在未来的使用中,再继续优化调整 #Idea
- in the [[future]] 自建网盘。原因:可以实现webdav服务 #Idea
时间如逆旅,我亦是行人 #quote
average of five(五人平均值) #quote
- 我认为,关于 [[study]] 的工具,[[Logseq]]和[[flomo]]笔记软件同时使用效果会更好 #Idea
- 我今天听到[[Logseq]]的一个节目,他里面提到如何更好的使用 [[Logseq]] 来管理他的生活和笔记 #Idea
贫穷与自由罢了 #quote
把它扁平化的记下来(而不是有刻意组织地把它记下来),然后通过backthink(回想),通过tag,让它们在将来的某一天,被你查询,被你发现,那么你的这条笔记就是有意义的 #quote
- To do
- Important and urgent
- Important not urgent
- Urgent not important
- Not urgent not important
- Important and urgent