Skip to content

Instantly share code, notes, and snippets.

View foreseaz's full-sized avatar
☁️

Chenxi Zh foreseaz

☁️
View GitHub Profile
@foreseaz
foreseaz / r2.js
Last active March 20, 2023 07:12
Cloudflare R2 request with signature
var crypto = require("crypto-js");
var https = require("https");
var xml = require("xml2js");
main();
// split the code into a main function
function main() {
// this serviceList is unused right now, but may be used in future
const serviceList = ["dynamodb", "ec2", "sqs", "sns", "s3"];
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
@foreseaz
foreseaz / main.go
Created November 7, 2020 16:06
Golang Subscriber Pattern
package main
import (
"time"
)
type Event struct {
data int
}
@foreseaz
foreseaz / generator.go
Last active November 6, 2020 09:18
Go Patterns
package main
import "fmt"
func fib(n int) chan int {
out := make(chan int)
go func () {
defer close(out)
for i, j := 0, 1; i < n; i, j = i + j, i {
@foreseaz
foreseaz / gist:3c5a33a54f965a1a35124990eda6c0e9
Created June 10, 2019 09:59
rename extension in folders
ren '*.com' '#1.jpg'
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && ren '*.com' '#1.jpg'" \;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://forum_backend/;
proxy_set_header Accept-Encoding "";
sub_filter '</html>' '<script async defer src="/hack.js"></script></html>';
}
@foreseaz
foreseaz / js.md
Last active March 13, 2019 11:17 — forked from shuding/js.md
must watch javascript

TV icon

Must-Watch JavaScript

This is a collection of well-received talks about JavaScript, covering topics such as ES6, JavaScript frameworks, client-side apps, mobile integration, JavaScript performance, tooling, leveling up, and more.

Like CSS? Check out Must-Watch CSS! For other great lists check out @sindresorhus's curated list of awesome lists.

@foreseaz
foreseaz / docker-compose.yml
Created January 4, 2019 07:04 — forked from ziozzang/docker-compose.yml
Source Graph with Docker-compose
version: '2'
services:
sourcegraph:
image: sourcegraph/server:2.13.5
restart: always
volumes:
- ./config:/etc/sourcegraph
- ./data:/var/opt/sourcegraph
ports:
- 7080:7080
@foreseaz
foreseaz / auto_ssl.sh
Last active November 19, 2018 12:28
install_docker.sh
# email=hi@foreseaz.com
# domain=www.foreseaz.com
usage() {
echo "$0 <email> <domain>"
exit 1
}
main() {
if [[ $# -ne 2 ]]; then
@foreseaz
foreseaz / Makefile
Created April 30, 2018 02:28 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.