Skip to content

Instantly share code, notes, and snippets.

View dereknex's full-sized avatar

Derek Chen dereknex

View GitHub Profile
#!/bin/bash
set -euo pipefail
case $(uname -m) in
aarch64) ARCH=arm64;;
armv7l) ARCH=arm;;
*) ARCH=$(uname -m);;
esac
echo 'Please input golang version:'
read VER
echo 'Remove old go files.'
version: "3.9"
services:
postgres:
image: postgres:13
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgres
ports:
@dereknex
dereknex / tun2socks_proxy_foo.bash
Created August 5, 2019 12:51 — forked from rsanden/tun2socks_proxy_foo.bash
tun2socks TCP+UDP user-wide proxy through shadowsocks and udpgw
#--- Build tun2socks and udpgw (as the user who will use the proxy) ---
mkdir -p $HOME/src
cd $HOME/src
git clone "https://github.com/ambrop72/badvpn"
cd badvpn
mkdir -p build
cd build
export OUTDIR=$PWD
export SRCDIR=$(dirname $PWD)
@dereknex
dereknex / .vimrc
Last active January 29, 2021 06:30
Vim configuration
set nocompatible hidden showcmd showmode number nowrap ruler
set lazyredraw ttyfast wildmenu
set showmatch hlsearch incsearch ignorecase smartcase
" set spell spelllang=en_us
syntax on
colo pablo
" Flash screen instead of beep sound
set visualbell
@dereknex
dereknex / init-dev.sh
Last active February 22, 2022 01:39
initial linux system
#! /usr/bin/env bash
set -euo pipefail
case $(uname -m) in
aarch64) ARCH=arm64;;
armv7l) ARCH=arm;;
*) ARCH=$(uname -m);;
esac
sudo apt update && sudo apt upgrade -y
# MySQL Connector/Python - MySQL driver written in Python.
# New file added for Django 1.8
from __future__ import unicode_literals
import uuid
import django
from django.conf import settings
@dereknex
dereknex / .tmux.conf
Last active May 6, 2020 00:49
tmux configuation
set-option -g default-shell /usr/bin/zsh
set-option -g default-terminal "screen-256color"
setw -g mode-keys vi
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
run '~/.tmux/plugins/tpm/tpm'
@dereknex
dereknex / gist:40b0c7dfbd732d02862f3c9ab2a9e7fa
Created February 1, 2018 08:37 — forked from Iristyle/gist:5005653
Configure HAProxy for userlists

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0
@dereknex
dereknex / tmux-cheatsheet.markdown
Created January 31, 2018 07:00 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@dereknex
dereknex / Linux Static IP
Created November 15, 2017 08:05 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static