Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/bin/sh | |
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch. | |
# There are four variants that I have built: | |
# - pre-commit: stops commits to "master" and "develop" branches. | |
# - pre-commit-2: also includes a core.whitespace check. | |
# - pre-commit-3: the core.whitespace check and an EOF-newline-check. | |
# - pre-commit-4: only the core.whitespace check. | |
# Set desired version like this before installing: | |
# FILE=pre-commit |
/** | |
* Objects diff util | |
* @param object a object to compare | |
* @param object b object to compare | |
* @return the difference between the two objects | |
*/ | |
(function() { | |
odiff = function(a, b) { | |
var $this = this; | |
var result = {}; |
############################ | |
# Npm proxy settings | |
############################ | |
alias init-npm-proxy='echo "" > ~/.npmrc' | |
alias rm-npm-proxy='sed -i '/proxy/d' ~/.npmrc' | |
set-npm-proxy() { | |
echo "proxy=$1" >> ~/.npmrc | |
echo "https-proxy=$1" >> ~/.npmrc |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
mkdir my-meta-package
et cd my-meta-package
equivs-control ns-control
equivs-build --full ns-control
dpkg-source -x my-meta-package_<version>.dsc
cd my-meta-package-
et debuild -S
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/