Skip to content

Instantly share code, notes, and snippets.

@lzjluzijie
lzjluzijie / warp.js
Created February 25, 2024 07:55
Cloudflare Warp 24PB key generator
# See https://halu.lu/%E6%9D%82%E8%B0%88/cloudflare-warp/
# Depolyed at https://warp.halu.lu/
// Change keys if needed
const keys = [
"9WO41D5p-6OP8xj27-36gQG75D",
"R65K12Up-aU907O2e-4nuvD581",
"06LM94EJ-1nl0V2d7-V847va5y",
]
@lzjluzijie
lzjluzijie / tc.sh
Last active October 12, 2023 15:39
在WSL里编译kernel以通过tc实现限流
# 有时间再写blog
# https://github.com/microsoft/WSL/issues/6065
# https://gist.github.com/charlie-x/96a92aaaa04346bdf1fb4c3621f3e392
sudo apt install -y autoconf bison build-essential flex libelf-dev libncurses-dev libssl-dev libtool libudev-dev bc dwarves
mkdir kernel && cd kernel
wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-5.15.90.4.tar.gz
tar -xf linux-msft-wsl-5.15.90.4.tar.gz
make prepare modules_prepare -j $(expr $(nproc) - 1)
@lzjluzijie
lzjluzijie / cot.cpp
Last active September 8, 2023 02:56
libOTe
#include "coproto/Socket/AsioSocket.h"
#include "cryptoTools/Common/CLP.h"
#include "libOTe/Base/BaseOT.h"
#include "libOTe/TwoChooseOne/Iknp/IknpOtExtReceiver.h"
#include "libOTe/TwoChooseOne/Iknp/IknpOtExtSender.h"
#include "libOTe/TwoChooseOne/Kos/KosOtExtReceiver.h"
#include "libOTe/TwoChooseOne/Kos/KosOtExtSender.h"
using namespace osuCrypto;
using namespace std;
@lzjluzijie
lzjluzijie / how-to.md
Last active July 28, 2023 04:36
Access Private BackBlaze B2 Bucket from Cloudflare Transform Rules

Access Private BackBlaze B2 Bucket from Cloudflare Transform Rules

Original post from my Blog.

Cloudflare now offers free Transform Rules, so BackBlaze B2 users can use URL Rewrite rules to hide bucket name and provide access to private bucket.

TLDR: Create a URL Rewrite Rule and hide your bucket name. If your bucket is private, you also need to create a Cloudflare Worker, copy the code and fill in the config.

Hide Bucket Name

@lzjluzijie
lzjluzijie / centos8.sh
Last active November 6, 2022 06:11
Fedora&Centos8 常用命令
## Firewall
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --reload
## Caddy (https://caddyserver.com/docs/download)
sudo dnf install 'dnf-command(copr)'
sudo dnf copr enable @caddy/caddy
sudo dnf install caddy
@lzjluzijie
lzjluzijie / main.go
Created March 16, 2019 14:18
GB18030 zip
package main
import (
"archive/zip"
"github.com/saintfish/chardet"
"golang.org/x/text/encoding/simplifiedchinese"
"log"
"os"
)
@lzjluzijie
lzjluzijie / save.go
Created February 13, 2019 05:38
save
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"time"
)
@lzjluzijie
lzjluzijie / psd2png.sh
Last active December 31, 2018 06:34
psd2png.sh
cd psd
for psd in `ls`
do
magick $psd -resize 1280x720 -flatten $psd.png
done
@lzjluzijie
lzjluzijie / rename.sh
Created December 20, 2018 06:37
youku-rename
cd files
for file in `ls`
do
if [ ${#file} == "73" ]; then
new=${file:0:71}00.ts
fi
if [ ${#file} == "75" ]; then
new=${file:0:71}0${file:71:4}
fi
@lzjluzijie
lzjluzijie / Caddyfile
Created December 10, 2018 06:36
caddy redirect
r.halu.lu, :80 {
redir 307 {
https://halu.lu/
}
}