Skip to content

Instantly share code, notes, and snippets.

[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
@patricksuo
patricksuo / print.go
Last active August 29, 2015 14:06
utils
package utils
import (
"fmt"
"reflect"
)
func SmartPrint(data interface{}) {
indent := "\t"
var printer func(reflect.Value, int)
@patricksuo
patricksuo / poorman_tag.c
Created December 15, 2015 13:54
poorman_tag
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <dirent.h>
#include <clang-c/Index.h>
#define ERR(msg) fprintf(stderr, "[%s] [%s] at %s line %d\n", msg, strerror(errno), __FILE__, __LINE__)
//#define DEBUG(msg) fprintf(stderr, "[DEBUG] file %s line %d : %s", __FILE__, __LINE__, msg)
@patricksuo
patricksuo / gist:f9e11d4b1e0d5c7db1cf
Last active December 21, 2015 12:34
set and get a thread's CPU affinity mask lab
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h> /* abort() */
#include <stdarg.h>
#include <string.h>
#include <errno.h>
@patricksuo
patricksuo / vim config
Last active October 3, 2017 16:45
vim config
# 1. install plugin manager vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# 2. save vimrc
curl https://gist.github.com/sillyousu/c0fada443c00869f436e5daf7a0f4765/raw/8c5ed19be89a786873759ac1c78d56d0ebd99489/vimrc > $HOME/.vimrc
# 3. install other plugin
vim +PluginInstall +qall
# 4. install vim-go dependency
@patricksuo
patricksuo / goscope
Created April 8, 2016 06:24
cscope helper script for golang
#!/bin/sh
find $PWD -name '*.go' -exec echo \"{}\" \; | sort -u > cscope.files
#cscope -bvq
cscope -b
@patricksuo
patricksuo / .tmux.conf
Created April 19, 2016 03:03
tmux conf
#此类配置可以在命令行模式中输入show-options -g查询
set-option -g base-index 1 #窗口的初始序号;默认为0,这里设置为1
set-option -g display-time 5000 #提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g repeat-time 1000 #控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
set-option -g status-keys vi #操作状态栏时的默认键盘布局;可以设置为vi或emacs
set-option -g status-right "#(date +%H:%M' ')" #状态栏右方的内容;这里的设置将得到类似23:59的显示
set-option -g status-right-length 10 #状态栏右方的内容长度;建议把更多的空间留给状态栏左方(用于列出当前窗口)
set-option -g status-utf8 on #开启状态栏的UTF-8支持
set -g default-terminal "xterm-256color" # VIM 配色
@patricksuo
patricksuo / part of .zshrc
Last active October 3, 2017 16:46
part of .zshrc
alias tlist="tmux list-session"
alias tnew="tmux new -s"
alias tattach="tmux attach -t"
alias siftx="sift -n -A3 -B3 --binary-skip --exclude-ext out"
alias siftn="sift -n --binary-skip --exclude-ext out, --exclude-dirs .svn"
alias svnst="svn st|grep -v \"?\""
export TERM="xterm-256color"
# https://github.com/zeit/hyper/issues/1613#issuecomment-311172029
#!/usr/bin/env bash
# via http://osxdaily.com/2014/10/25/fix-wi-fi-problems-os-x-yosemite/
launchctl unload -w /System/Library/LaunchDaemons/com.apple.wifid.plist
launchctl load -w /System/Library/LaunchDaemons/com.apple.wifid.plist