Skip to content

Instantly share code, notes, and snippets.

@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active April 15, 2025 22:43
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.
@1hbb
1hbb / generate-solanacli-keypair-file-from-seed-phrase.md
Created December 13, 2021 20:04
If you want to generate solana cli keypair file from phantom seed phrase, run this
solana-keygen recover 'prompt:?key=0/0' --outfile ~/.config/solana/id.json

it will ask you for seed phrase like this: Enter your seed phrase here

[recover] seed phrase: 

@sansob
sansob / aes-256-cbc-test.js
Created February 18, 2021 02:30 — forked from brettscott/aes-256-cbc-test.js
AES 256 CBC encryption between Golang and Node JS
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');
@shalyf
shalyf / vpn_route.md
Last active July 1, 2024 01:43
利用路由表给VPN分流

2020年初因为新冠肺炎爆发,所以在家办公,公司给配置了L2TP的VPN,但是我不想所有流量都走VPN(VPN比较慢而且也节省流量),于是想到用路由表给VPN分流。
具体的方案就是公司内网的流量走VPN,外网流量走默认网关。

我是在macOS上操作的,其他平台应该也差不多。

假设:
公司内网 192.168.10.0/24
家里网络 192.168.1.0/24 你已经配置好VPN并且可以使用了。

@zoilomora
zoilomora / README.md
Last active April 15, 2025 01:56
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

@miguelmota
miguelmota / rsa_util.go
Last active April 11, 2025 12:33
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@Caldis
Caldis / 解决OSX外接显示器模糊的问题.md
Last active May 9, 2020 02:25
解决OSX外接显示器模糊的问题

##解决OSX外接显示器模糊的问题

由于OSX无法识别一部分外接显示器的EDID信息, 默认以TV模式进行输出, 因此会导致外接显示器时文字渲染模糊
可以在关于本机>系统报告>硬件>图形卡/显示器中查看, 如果外接显示器显示了[电视 - 是], 即符合症状

在 EL Capitan 版本, 增加了一个叫做 System Integrity Protection (簡稱 SIP ,或稱 rootless, 在 iOS 9 裡面也有) 的保護機制,SIP 最主要功能就是防止對系統程式的 code injection,還有使用未被 Apple 認可的 kext。 如果要获取读写权限, 需要开机的时候按住 CMD+R 然后在终端输入 csrutil disable, 在重启就可以关闭 SIP 了。

  1. 复制以下代码为 patch-edid.rb 文件 (来源: https://embdev.net/topic/284710) https://gist.github.com/Caldis/cacb62a1e0426049255acb9cea503153
@maliubiao
maliubiao / tcpinfo.py
Last active August 29, 2015 14:05
功能: 1, 获取系统当前所有的tcp链接信息, 2: 找到绑定某个端口的进程tcpinfo.port_to_pid(port)
import os
import struct
import socket
state_table = (
"EMPTY SLOT",
"ESTABLISHED",
"SENT",
"RECV",
"WAIT1",