Skip to content

Instantly share code, notes, and snippets.

View lgh06's full-sized avatar

Daniel Liu lgh06

View GitHub Profile
@lgh06
lgh06 / macos-route.md
Created September 26, 2024 00:16 — forked from ssrlive/macos-route.md
macOS 路由表 tips
# 为虚拟网络接口 utun0 配置 IP 地址 10.0.0.33 和子网掩码 255.255.255.0 网关地址 10.0.0.1
sudo ifconfig utun0 10.0.0.33 10.0.0.1 netmask 255.255.255.0

# 配置目标地址是网段 192.168.1.0/24 的流量走 10.0.0.1 网关
sudo route add 192.168.1.0/24 10.0.0.1

# 将 6.11.20.10 这个单一地址(因为掩码是 32)路由到 192.168.4.1 这个网关
sudo route add 6.11.20.10/32 192.168.4.1
@lgh06
lgh06 / __main__.py
Last active September 18, 2023 08:17
地址中省市县获取.py
## pip install flask cpca
## http://172.24.1.55:8000/?keyword=福建省漳州市龙海市角美镇菜鸟电商园一期二号库夏奶录
import cpca
from flask import Flask,request
app = Flask(__name__)
@app.route('/',methods=["GET"])
def hello_world():
@lgh06
lgh06 / quark-drive-download.js
Created January 18, 2023 06:23
quark-drive-download.js
// ==UserScript==
// @name Quark Download
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 点击鼠标中键直接下载夸克网盘内容,无需下载客户端
// @author Xav1erW
// @match http*://pan.quark.cn/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
@lgh06
lgh06 / wikijs-docker-compose.yaml
Created May 13, 2022 06:52
wiki.js docker-compose.yaml
version: "3"
services:
db:
image: postgres:11-alpine
environment:
POSTGRES_DB: wiki
POSTGRES_PASSWORD: wikijsrocks
POSTGRES_USER: wikijs
logging:
#!/usr/bin/env pwsh
# https://stackoverflow.com/questions/8761888/capturing-standard-out-and-error-with-start-process
function Start-Command ([String]$Path, [String]$Arguments) {
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $Path
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = $Arguments
@lgh06
lgh06 / README.md
Created March 31, 2022 01:39 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@lgh06
lgh06 / jose.mjs
Last active February 18, 2022 10:10
jose jwt in node.js demo
import { SignJWT,
generateKeyPair, exportJWK,importJWK,exportPKCS8,
decodeProtectedHeader,decodeJwt,
jwtVerify,
} from "jose";
// use jsrsasign only in web browser
// import { KEYUTIL, jws } from "jsrsasign";
// https://nodejs.org/docs/latest-v16.x/api/crypto.html#static-method-keyobjectfromkey
// https://github.com/panva/jose/blob/c185e24def279e921258ccbafaf65d4bb571d60d/docs/README.md
@lgh06
lgh06 / amqplib-delayed-message.js
Created January 23, 2022 08:53 — forked from materkel/amqplib-delayed-message.js
Scheduling messages with RabbitMQ, using the rabbitmq_delayed_message_exchange plugin and amqplib in NodeJS
/**
* Install and enable the rabbitmq_delayed_message_exchange plugin as described by Alvaro Videla in this blogpost:
* https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/
*/
const amqp = require('amqplib');
const exchange = 'yourExchangeName';
const queue = 'yourQueueName';
const queueBinding = 'yourQueueBindingName';
// Message consumer
@lgh06
lgh06 / libsodium xchacha20poly1305_ietf.js
Created January 10, 2022 04:13 — forked from 842Mono/libsodium xchacha20poly1305_ietf.js
Encrypting and decrypting a message using secret key aead xchacha20poly1305_ietf (libsodium js)
'use strict'
const sodium = require('libsodium-wrappers');
sodium.ready.then(function()
{
console.log('sodium ready');
//xchacha20ploy1305 ietf
//A key and a nonce are generated by the encrypting party. The decrypting
//party should use them for decryption
const useFetch = (service) => {
const [loading, setLoading] = useState(true);
const [error, setError] = useState();
const [data, setData] = useState();
const fetchAPI = useCallback(async () => {
try {
const res = await fetch(service);
const json = await res.json();
setData(json);