Skip to content

Instantly share code, notes, and snippets.

View wangjiezhe's full-sized avatar
🏠
Working from home

Jiezhe Wang wangjiezhe

🏠
Working from home
View GitHub Profile
@craigloewen-msft
craigloewen-msft / autoMemoryReclaim.sh
Created September 18, 2023 20:01
Auto memory reclaim shell script
#!/bin/bash
# Put under /etc/autoMemoryReclaim.sh
# set variables at the top
low_cpu_usage=50 # Note: We work with integer percentages (e.g., 50%)
idle_time=2 # Minutes
cached_memory_limit=1000 # MB
percent_memory_to_reclaim=5 # Percentage as an integer
wait_period=3
@thesamesam
thesamesam / gentoo-crossdev.md
Last active April 13, 2025 19:46
Gentoo cross compilation instructions (crossdev -> stage3)

Cross instructions

These instructions cover:

  1. building a cross toolchain
  2. populating the new ROOT
  3. making it chrootable using qemu-user to easily run "native" builds or tests (this is like a stage3 at the end)

You do not need to follow through to the end if you don't need a stage3-like root.

Set up the toolchain

@ZipFile
ZipFile / README.md
Last active April 25, 2025 04:38
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@thegreatestminer
thegreatestminer / encoded-20201212150102.txt
Created December 12, 2020 15:01
MobaXTerm Professional x64 License Key [READ COMMENTS]
UEsDBBQAAAAIABNQjFGCf/GfLgAAACwAAAAHAAAAUHJvLmtleTMqdncpCXQOKDAp9woMzEo1MTVOrHAzTjTLME7VNs1LK8owTjQpcU8tcuLlAgBQSwECFAAUAAAACAATUIxRgn/xny4AAAAsAAAABwAAAAAAAAAAAAAAAAAAAAAAUHJvLmtleVBLBQYAAAAAAQABADUAAABTAAAAAAA=
@banyudu
banyudu / free-docker-space-in-wsl2.blog.md
Last active April 15, 2025 10:34
WSL2 Docker释放磁盘空间

WSL2 Docker释放磁盘空间

Docker使用久了,会残留很多中间生成的镜像,占用磁盘空间。

要清理Docker镜像,本来是挺简单的,一条命令就搞定了:

@wangjiezhe
wangjiezhe / To_25M.sh
Last active October 21, 2024 10:16
Convert video to 25M for wechat
#!/usr/bin/env bash
command -v mediainfo >/dev/null 2>&1 || { echo >&2 "mediainfo 命令不存在,请先安装 mediainfo。"; exit 1; }
command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg 命令不存在,请先安装 ffmpeg。"; exit 1; }
out_size=24
length=$(mediainfo --Inform="Video;%Duration%" "$1")
bitrate_all=$(echo "${out_size}*8192/(${length}/1000)" | bc)
bitrate_audio_orig=$(mediainfo --Inform="Audio;%BitRate%" "$1")
@lilydjwg
lilydjwg / gh-check
Last active March 20, 2025 01:02
gh-check: speed test to known GitHub IPs
#!/usr/bin/python3
import asyncio
import time
import socket
import argparse
import aiohttp
class MyConnector(aiohttp.TCPConnector):
@sdhzdmzzl
sdhzdmzzl / bj-unicom-iptv.m3u
Last active April 6, 2025 15:27
北京联通iptv列表
#EXTINF:-1,CCTV-1
rtp://239.3.1.1:8000
#EXTINF:-1,CCTV-2
rtp://239.3.1.2:8004
#EXTINF:-1,CCTV-4
rtp://239.3.1.4:8216
#EXTINF:-1,CCTV-7
@kpym
kpym / tkz-euclid-cheatsheet.en.md
Last active August 10, 2024 08:17
cheatsheet : tkz-euclid (latex library based on tikz)

Gist

Package

\usepackage{tkz-euclide} % checked for version 3.02c

Point definitions

@lepture
lepture / README.md
Last active April 13, 2024 11:11
Is in China

Detecting if current browser is in China

Use the script below:

isInChina(function(inChina) {
  console.log('In china: ' + inChina);
})