Skip to content

Instantly share code, notes, and snippets.

View xpzouying's full-sized avatar
🎻
Life is better when shared

zy xpzouying

🎻
Life is better when shared
View GitHub Profile
@xpzouying
xpzouying / chatglm-openai-api.ipynb
Created April 22, 2023 08:12 — forked from ninehills/chatglm-openai-api.ipynb
chatglm-openai-api.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xpzouying
xpzouying / chatpdf-zh.ipynb
Created April 3, 2023 09:21 — forked from ninehills/chatpdf-zh.ipynb
ChatPDF-zh.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xpzouying
xpzouying / http-server-shutdown.go
Created February 19, 2023 16:41 — forked from rgl/http-server-shutdown.go
go http server with graceful shutdown
package main
import (
"context"
"flag"
"log"
"net/http"
"os"
"os/signal"
"time"
@xpzouying
xpzouying / .vimrc
Created October 13, 2022 00:50 — forked from jdah/.vimrc
jdh's NeoVim .vimrc
call plug#begin()
Plug 'drewtempelmeyer/palenight.vim'
Plug 'vim-airline/vim-airline'
Plug 'wlangstroth/vim-racket'
Plug 'sheerun/vim-polyglot'
Plug 'rust-lang/rust.vim'
Plug 'preservim/tagbar'
Plug 'universal-ctags/ctags'
Plug 'luochen1990/rainbow'
Plug 'vim-syntastic/syntastic'
@xpzouying
xpzouying / decorator.go
Created July 29, 2022 02:14 — forked from saelo/decorator.go
Decorators in Go
package main
import (
"fmt"
"reflect"
)
func Decorate(impl interface{}) interface{} {
fn := reflect.ValueOf(impl)
@xpzouying
xpzouying / proxy.go
Created February 22, 2021 13:09 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@xpzouying
xpzouying / vm-setup.sh
Created December 13, 2020 16:53 — forked from nf/vm-setup.sh
Script for setting up Debian Jessie VM with my development environment
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update
@xpzouying
xpzouying / whitelist.md
Created July 13, 2020 10:21 — forked from kivikakk/whitelist.md
HTML sanitizer whitelist for user content on GitHub.com
  • Any allowed id and name attributes have "user-content-" prefixed to their value.
  • A maximum of 2 nested sub or sup tags are allowed.
  • A maximum of 10 nested ul or ol tags are allowed.
Allowed Element Allowed Attributes
All allowed elements abbr, accept, accept-charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, char, charoff, charset, checked, clear, color, cols, colspan, compact, coords, datetime, dir, disabled, enctype, for, frame, headers, height, hreflang, hspace, id, ismap, itemprop, label, lang, maxlength, media, method, multiple, name, nohref, noshade, nowrap, open, prompt, readonly, rev, rows, rowspan, rules, scope, selected, shape, size, span, start, summary, tabindex, title, type, usemap, valign, value, vspace, width
a As above plus href (must be github-mac, github-windows, http,
@xpzouying
xpzouying / example-go-unsafe-pointer.go
Created March 22, 2020 15:58
example-go-unsafe-pointer
package main
import (
"log"
"unsafe"
)
func main() {
x := make([]byte, 8)
x[0] = 3
@xpzouying
xpzouying / caddy.sh
Created February 6, 2020 07:45 — forked from Jamesits/caddy.sh
Install Caddy Server on Ubuntu with Systemd.
# Should work on all Debian based distros with systemd; tested on Ubuntu 16.04+.
# This will by default install all plugins; you can customize this behavior on line 6. Selecting too many plugins can cause issues when downloading.
# Run as root (or sudo before every line) please. Note this is not designed to be run automatically; I recommend executing this line by line.
apt install curl
curl https://getcaddy.com | bash -s personal dns,docker,dyndns,hook.service,http.authz,http.awses,http.awslambda,http.cache,http.cgi,http.cors,http.datadog,http.expires,http.filemanager,http.filter,http.forwardproxy,http.geoip,http.git,http.gopkg,http.grpc,http.hugo,http.ipfilter,http.jekyll,http.jwt,http.locale,http.login,http.mailout,http.minify,http.nobots,http.prometheus,http.proxyprotocol,http.ratelimit,http.realip,http.reauth,http.restic,http.upload,http.webdav,net,tls.dns.auroradns,tls.dns.azure,tls.dns.cloudflare,tls.dns.cloudxns,tls.dns.digitalocean,tls.dns.dnsimple,tls.dns.dnsmadeeasy,tls.dns.dnspod,tls.dns.dyn,tls.