Skip to content

Instantly share code, notes, and snippets.

@edn-g
edn-g / install-pre-commit.sh
Created November 21, 2017 16:12 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/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
@edn-g
edn-g / odiff.js
Created September 5, 2017 12:51
Objects diff util
/**
* 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 = {};
@edn-g
edn-g / bashrc_init_proxies_utils
Last active August 31, 2017 15:58 — forked from jBouyoud/bashrc_init_proxies_utils
Utilities functions to setup proxies able to switch easily
############################
# 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
@edn-g
edn-g / tree.md
Created October 3, 2013 00:01 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

Source: http://askubuntu.com/questions/33413/how-to-create-a-meta-package-that-automatically-installs-other-packages?rq=1

  1. Installer equivs
  2. Créer un sous-répertoire : mkdir my-meta-package et cd my-meta-package
  3. Créer un template : equivs-control ns-control
  4. Modifier le fichier ns-control selon les besoins
  5. Construire un .deb et .dsc : equivs-build --full ns-control
  6. Construire un paquet source : dpkg-source -x my-meta-package_<version>.dsc
  7. Créer le fichier source.changes : 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.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...