Skip to content

Instantly share code, notes, and snippets.

@lzjluzijie
lzjluzijie / how-to.md
Last active Jan 19, 2022
Access Private BackBlaze B2 Bucket from Cloudflare Transform Rules
View how-to.md

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 Jan 9, 2022
Fedora&Centos8 常用命令
View centos8.sh
## 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
View main.go
package main
import (
"archive/zip"
"github.com/saintfish/chardet"
"golang.org/x/text/encoding/simplifiedchinese"
"log"
"os"
)
View save.go
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"time"
)
View psd2png.sh
cd psd
for psd in `ls`
do
magick $psd -resize 1280x720 -flatten $psd.png
done
View rename.sh
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
View Caddyfile
r.halu.lu, :80 {
redir 307 {
https://halu.lu/
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am lzjluzijie on github.
  • I am halulu (https://keybase.io/halulu) on keybase.
  • I have a public key whose fingerprint is D6BB B216 0FC6 1FC5 C698 D2E4 84A6 DA88 7A07 E73D

To claim this, I am signing this object:

View go.sh
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz
tar -xzf go1.11.linux-amd64.tar.gz
rm -f go1.11.linux-amd64.tar.gz
mv go /usr/local
echo export GOROOT=/usr/local/go>/etc/profile.d/go.sh
echo export GOPATH=/root/go>>/etc/profile.d/go.sh
echo export PATH=$PATH:$GOROOT/bin>>/etc/profile.d/go.sh
@lzjluzijie
lzjluzijie / main.go
Last active Jun 15, 2018
tcp reverse proxy
View main.go
package main
import (
"net"
"fmt"
"io"
)
func main(){
listener, err := net.Listen("tcp", ":2333")