Skip to content

Instantly share code, notes, and snippets.

View zhiyue's full-sized avatar
🌻
just do it.

zhiyue zhiyue

🌻
just do it.
View GitHub Profile
@zhiyue
zhiyue / README.md
Created September 4, 2023 04:36 — forked from atenni/README.md
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

{
echo "Loaded kernel extensions:";
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}';
echo $'\n'"Loaded user agents:";
launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)|\.[0-9]+$/{print $3}';
echo $'\n'"Inserted libraries:";
launchctl getenv DYLD_INSERT_LIBRARIES;
echo $'\n'"User cron tasks:";
crontab -l;
echo $'\n'"System launchd configuration:";
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@zhiyue
zhiyue / zhHans.conf.ini
Created August 29, 2023 16:30 — forked from kang000feng/zhHans.conf.ini
surge conf 配置详细说明
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@zhiyue
zhiyue / cloudflare-worker-proxy.js
Created June 20, 2023 02:08 — forked from noobnooc/cloudflare-worker-proxy.js
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@zhiyue
zhiyue / build.bat
Created May 11, 2023 10:08
bash to bat
@echo off
setlocal EnableDelayedExpansion
set process_name=%1
cd %process_name%
call :compile
call :make_output
@zhiyue
zhiyue / Enable UDP RDP Windows
Created February 2, 2023 13:32 — forked from version-control/Enable UDP RDP Windows
Enable UDP RDP Windows
Admin Priv
VM / Remote Machine
Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"
Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (UDP-In)"
Laptop - Local Remote User
Set-ItemProperty 'HKLM:/Software/Policies/Microsoft/Windows NT/Terminal Services/Client' 'fClientDisableUDP' 0
@zhiyue
zhiyue / nvidia-docker-2.yml
Created January 19, 2023 09:50 — forked from dholt/nvidia-docker-2.yml
Simple Ansible playbook for installing nvidia-docker-2 and setting it as the default runtime for Docker
- hosts: all
become: true
become_method: sudo
vars:
daemon_json:
bip: 192.168.99.1/24
default-runtime: nvidia
runtimes:
nvidia:
path: /usr/bin/nvidia-container-runtime
@zhiyue
zhiyue / resize-sdcard-partitions.md
Created December 5, 2022 10:48 — forked from sxiii/resize-sdcard-partitions.md
Resize linux partition that was written by DD or similar instrument to use all available space

Please run the following commands to resize a partition.
IMPORTANT NOTE: Don't forget to change partition address from /dev/sdb2 to your actual partition!
CHANGES ARE DONE IN TWO OR THREE PLACES.
Example below are for /dev/sdb2 partition which is called like "/dev/sdb 2" for growpart
and like "/dev/sdb2" for resize2fs & e2fsck.
Requirements: * growpart; * resize2fs; * e2fsck if disk requires checking.
Install growpart in arch/manjaro: pikaur -S growpart (resize2fs and e2fsck are usually bundled with OS)

sudo growpart /dev/sdb 2
@zhiyue
zhiyue / proxy.worker.js
Created June 13, 2022 08:00 — forked from abersheeran/proxy.worker.js
A proxy download cloudflare worker
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
async function handleRequest(request) {
console.log(`${request.method} ${request.url}`)