Skip to content

Instantly share code, notes, and snippets.

View clarkwang's full-sized avatar
🙂

Clark Wang clarkwang

🙂
View GitHub Profile
@clarkwang
clarkwang / ANSI.md
Created June 4, 2024 01:51 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@clarkwang
clarkwang / TrueColour.md
Created January 5, 2023 16:44 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

#!/usr/bin/env bash
#
# Setup automatic sync from a Github upstream repository to a fork
# - a branch "actions" will be created (or re-used) to hold the Github action to run
# - sync is done each hour
# - branch 'actions' needs to be the default branch of your fork (=> settings)
# - the script is able to both create and update and rewrite the sync script if you modify this script file
#
# Author: Mathiue Carbou
@clarkwang
clarkwang / JSON and YAML to Python NameSpaces.md
Created September 9, 2021 15:37 — forked from jdthorpe/JSON and YAML to Python NameSpaces.md
JSON and YAML Encoders / Decoders for use with SimpleNamespaces

Load and Dump JSON and YAML to / From NamesSpaces

Why

Typed Namespaces ensure object typing is correct in the IDE!

Usage

import yaml
@clarkwang
clarkwang / global-protect.sh
Created May 30, 2019 16:08 — forked from kaleksandrov/global-protect.sh
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@clarkwang
clarkwang / jinja2_file_less.py
Created January 8, 2019 03:41 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@clarkwang
clarkwang / daemon.py
Created December 2, 2017 16:11 — forked from josephernest/daemon.py
Daemon for Python
# From "A simple unix/linux daemon in Python" by Sander Marechal
# See http://stackoverflow.com/a/473702/1422096
#
# Modified to add quit() that allows to run some code before closing the daemon
# See http://stackoverflow.com/a/40423758/1422096
#
# Joseph Ernest, 2016/11/12
import sys, os, time, atexit
from signal import signal, SIGTERM
@clarkwang
clarkwang / build_openssl_dylib.sh
Created November 10, 2016 15:19 — forked from tmiz/build_openssl_dylib.sh
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
@clarkwang
clarkwang / shadowsocks-on-openwrt.md
Created December 31, 2015 02:06 — forked from messense/shadowsocks-on-openwrt.md
shadowsocks on openwrt

配置 shadowsocks

架设好 shadowsocks 服务端,在路由器上安装 shadowsocks 客户端,并配置 /etc/config/shadowsocks.json ,假设本地监听端口为 1080 。启动 shadowsocks

/etc/init.d/shadowsocks start

配置 privoxy

安装 privoxy openwrt 版。