Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

JIANG Di dd1994

I may be slow to respond.
View GitHub Profile
wangkuiyi / pre-commit-clang-format
Last active Aug 19, 2021
Git pre-commit hook that invokes clang-format to reformat C/C++/Objective-C source code.
View pre-commit-clang-format
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by
# This file is part of a set of unofficial pre-commit hooks available
# at github.
bryanhunter /
Last active May 22, 2022
Build Erlang 17.0 on a fresh Ubuntu box (tested on 12.04 and 14.04)
# Pull this file down, make it executable and run it with sudo
# wget
# chmod u+x
# sudo ./
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
pyk /
Last active Aug 2, 2021
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)


create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
anhulife / WeixinDetection.js
Created Jan 17, 2014
View WeixinDetection.js
document.addEventListener('WeixinJSBridgeReady', function(){
dreadatour / gist:7475747
Created Nov 14, 2013
Remove default Sublime Text 3 snippets
View gist:7475747
# Sublime Text 3 languages list:
ls -1 /Applications/Sublime\
# Remove all default Sublime Text 3 snippets for Python language
export ST3_LANG="Python"
mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/
unzip -l /Applications/Sublime\$ST3_LANG.sublime-package | grep '.sublime-snippet' | awk '{print $4}' | while read f; do touch ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/$f; done
unset ST3_LANG
aras-p / preprocessor_fun.h
Last active Sep 29, 2022
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
willurd /
Last active Sep 30, 2022
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
matthewlehner / autopgsqlbackup
Created Jul 11, 2012
Auto PostgreSQL backup script.
View autopgsqlbackup
# PostgreSQL Backup Script Ver 1.0
# Copyright (c) 2005 Aaron Axelsen <>
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
paulmillr /
Last active Sep 27, 2022
Most active GitHub users (by contributions).

Most active GitHub users (

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

 .filter(user =&gt; user.followers &gt; 1000)
galulex /
Last active Feb 28, 2021
Ruby On Rails Ubuntu 18.04 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev build-essential patch libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs rar


sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update