Skip to content

Instantly share code, notes, and snippets.

@siddharthg
siddharthg / gist:6923b2cbb402bd65255af7859a5d52a5
Created December 21, 2017 07:29 — forked from timvlaer/gist:721ba30f8fc6a7aac1b0190e132a4261
Install Thrift 0.10.0 with brew on macOS
brew unlink thrift
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/16ebe5f1843e6cb54856311ff0f676be53007329/Formula/thrift.rb
@toolness
toolness / adventures-in-python-core-dumping.md
Last active January 9, 2024 11:53
Adventures in Python Core Dumping

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

@renatolfc
renatolfc / ovpn-writer.sh
Created December 28, 2014 18:50
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
client_key=${4?"The path to the client private key file is required"}
@joshuamiller
joshuamiller / flavor.rb
Last active March 23, 2017 22:35 — forked from ttscoff/flavor.rb
#!/usr/bin/ruby
# encoding: US-ASCII
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
@Hexcles
Hexcles / vpn-dorm.sh
Created September 14, 2013 15:15
ZJU Zijingang Campus dormitory VPN dial up script (xl2tpd + systemd, for Archlinux)
#!/bin/bash
PPP_TIMEOUT=30
L2TPD_TIMEOUT=5
L2TPD_CONTROL_FILE=/var/run/xl2tpd/l2tp-control
VPN_ACCOUNT=zjuvpn
function start_xl2tpd
{
systemctl start xl2tpd
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function()%7Bif(!b&&(!(d=this.readyState)%7C%7Cd==%22loaded%22%7C%7Cd==%22complete%22))%7Bh((f=e.jQuery).noConflict(1),b=1);f(c).remove()%7D%7D;a.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,%221.3.2%22,function($,L)%7B$('%23header,%20.pagehead,%20.breadcrumb,%20.commit,%20.meta,%20%23footer,%20%23footer-push,%20.wiki-actions,%20%23last-edit,%20.actions,%20.header').remove();%20$('%23files,%20.file').css(%7B%22background%22:%22none%22,%20%22border%22:%22none%22%7D);%20$('link').removeAttr('media');%7D);
@ttscoff
ttscoff / flavor.rb
Created September 16, 2012 16:01
Quick wrapper to convert Markdown to HTML via Github API
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
@lotem
lotem / default.custom.yaml
Last active February 21, 2024 15:47
使用 Control 鍵切換中西文,上屏已輸入的編碼;令 Caps Lock 改變字母的大小寫
# 中西文切換鍵的默認設置寫在 default.yaml 裏面
# 以下的 default.custom.yaml 在全局範圍重定義該組快速鍵
#
# 可用的按鍵有 Caps_Lock, Shift_L, Shift_R, Control_L, control_R
# Mac 系統上的鼠鬚管不能區分左、右,因此只有對 Shift_L, Control_L 的設定起作用
#
# 已輸入編碼時按切換鍵,可以進一步設定輸入法中西文切換的形式。
# 可選的臨時切換策略有三:
# inline_ascii 在輸入法的臨時西文編輯區內輸入字母、數字、符號、空格等,回車上屏後自動復位到中文
# commit_text 已輸入的候選文字上屏並切換至西文輸入模式
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@lotem
lotem / alternative.yaml
Created April 8, 2012 03:44
Rime 別樣設定,使用西文標點、[ ] 鍵換頁
# Rime alternative settings
# encoding: utf-8
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
# (Linux) ~/.config/ibus/rime/alternative.yaml
# (Mac OS) ~/Library/Rime/alternative.yaml