Skip to content

Instantly share code, notes, and snippets.

View zthxxx's full-sized avatar
🐾
Nyaa~

zthxxx zthxxx

🐾
Nyaa~
View GitHub Profile
POSTGRES_USER='xxxxx'
POSTGRES_PASSWORD='xxxxx'
docker volume create pgdata
docker run -d --rm \
-v pgdata:/var/lib/postgresql/data \
-p 127.0.0.1:5432:5432 \
-e "POSTGRES_USER=$POSTGRES_USER" \
-e "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" \
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name <xxxx.xxx>;
# acem: https://gist.github.com/zthxxx/b37cddcb17395e395ad6b430a81edd61
# cloudflare: https://dash.cloudflare.com/<account_id>/<domain_name>/ssl-tls/origin
ssl_certificate /etc/nginx/ssl/<xxxx.xxx>/fullchain.cer;
ssl_certificate_key /etc/nginx/ssl/<xxxx.xxx>/privkey.key;
# curl https://get.acme.sh | sh
# https://dash.cloudflare.com/profile/api-tokens
export CF_Token="xxxxxx"
# https://dash.cloudflare.com/<account_id>
export CF_Account_ID="xxxxxx"
acme.sh --issue --dns dns_cf -d zthxxx.me -d '*.zthxxx.me'
mkdir -p /etc/nginx/ssl/zthxxx.me
@zthxxx
zthxxx / .gitattributes
Last active November 8, 2020 07:50
auto ignore console.log at git diff or stage
# .gitattributes or .git/info/attributes
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreattributesFile
*.[jt]s filter=ignoreLogStage
*.[jt]sx filter=ignoreLogStage
@zthxxx
zthxxx / force-directed-gpu.js
Created September 17, 2019 09:18
simulate import GPU from gpu.js and export forceLayout function
/**
* simulate import GPU from gpu.js and export forceLayout function
*/
import { GPU } from 'gpu.js'
// vector2 functions
function add(v1, v2) {
return [
v1[0] + v2[0],
@zthxxx
zthxxx / gulpfile.js
Last active December 9, 2019 10:56
compile react component to both es and commonjs modules, with typescript and less in css modules
/**
* compile react component to both es and commonjs modules,
* with typescript and less in css modules
*
* @type {Gulp}
*/
const gulp = require('gulp')
const babel = require('gulp-babel')
const ts = require('gulp-typescript')
@zthxxx
zthxxx / nbconvert-render.sh
Created August 28, 2019 02:54
nbconvert code snippet
# https://nbconvert.readthedocs.io/en/latest/usage.html
# notebook: notebook 文件绝对地址,结尾扩展名 .ipynb
# target_name: 输出目标文件名,无后缀名,根据 type 自动对应生成
# format: 渲染格式 - asciidoc, custom, html, latex, markdown, notebook, pdf, python, rst, script, slides
# render_dir: 输出目录绝对路径
python -m nbconvert -y \
--ExecutePreprocessor.kernel_name="${jupyter_kernel}" \
--ExecutePreprocessor.timeout=-1 \
--execute "${notebook}" \
--output-dir "${render_dir}" \
@zthxxx
zthxxx / alfred-active-iTerm2-global-README.md
Last active April 7, 2020 04:16
Alfred iTerm2 global active

What's this

active iTerm2 if not focus on iTerm2 else open a new tab

Preview

iTerm2 preview

Install

# delect all brew (and cask) cache
rm -rf "$(brew --cache)"
# update all brew (and cask) formulae from repo
# /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
# /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks
brew update -v
# brew upgrade single terminal command
brew upgrade proxychains-ng