Skip to content

Instantly share code, notes, and snippets.

View daniel-fanjul-alcuten's full-sized avatar

Daniel Fanjul Alcutén daniel-fanjul-alcuten

View GitHub Profile
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / update-mirror.sh
Created September 17, 2014 14:20
update git mirror
#!/bin/bash
set -e
set -x
upstream_repo=${upstream_repo:-CENSORED}
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / gist:6172908
Last active December 20, 2015 17:59
to run automatically before I login
#!/bin/bash
cd ~
hostname=$(hostname -f)
if ! [ -d .git ]; then
git init
git remote add origin [email protected]:dfanjul/dotfiles.git
else
git remote set-url origin [email protected]:dfanjul/dotfiles.git
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / gist:6079562
Created July 25, 2013 13:24
create snapshot of HEAD
$ cp .git/index .git/index2
$ touch a
$ GIT_INDEX_FILE=.git/index2 git add a
$ GIT_INDEX_FILE=.git/index2 git write-tree
833db9db6007ba78fc3e5e10ccde7a1350bd6e1d
$ git commit-tree 833db9db6007ba78fc3e5e10ccde7a1350bd6e1d -p HEAD
foo
816a78f5fb38fddc4c05259e61c360f47425b1fb
$ d 816a78f5fb38fddc4c05259e61c360f47425b1fb
diff --git c/a w/a
function factorial() { { echo 0; seq $1 | sed s/$/*/; echo p; } | dc; }
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / gist:4692778
Last active December 12, 2015 01:39
building at Spotify
alias xdebug='XRELEASE=0 && xstatus'
alias xrelease='XRELEASE=1 && xstatus'
alias xquiet='XVERBOSE=0 && xstatus'
alias xverbose='XVERBOSE=1 && xstatus'
alias xnoapk='XAPK=0 && xstatus'
alias xapk='XAPK=1 && xstatus'
if [ "$(uname)" = Darwin ]; then
XPROCS=$(sysctl -n hw.ncpu)
else
XPROCS=$(grep ^processor /proc/cpuinfo | wc -l)
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / gist:4655614
Last active December 11, 2015 20:28
alias down, I don't like to open a new terminal in a a large screen and see the prompt in the top
alias down='yes "" | head -$(($LINES - 2))'
alias down='seq $(($LINES - 2))'
alias down='yes "|" | head -$(($LINES - 3)) && echo v'
alias down='echo -e "\033[6n"; read -s -d R foo; lines=$((LINES - $(echo $foo | cut -d \[ -f 2 | cut -d \; -f 1) - 2)); while [ $lines -gt 0 ]; do echo \|; lines=$((lines - 1)); done; echo v'
#!/bin/bash -x
alpha=$1 && shift || { echo "which alpha?"; exit 1; }
run() {
echo && echo "-> $*"
eval "$*"
}
hg-pull-and-deploy() {
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / tgotd.sh
Created October 9, 2012 17:22
the giri of the day
#!/bin/bash
# installation procedure:
#
#$ aptitude install qdbm-util
#$ {
# crontab -l
# echo '1 0 * * 1-5 [email protected] ~/bin/tgotd.sh'
#} | crontab
*.go filter=gofmt
*.cgo filter=gofmt
*.docx diff=textutil
@daniel-fanjul-alcuten
daniel-fanjul-alcuten / gist:3755985
Created September 20, 2012 13:37
git backup ice.bundle.git*
git config alias.backup \!$'rm -f ~/downloads/ice.bundle.git* && git bundle create ~/downloads/ice.bundle.git --all && par2create -n1 ~/downloads/ice.bundle.git && lftp downloads -e \'mput ~/downloads/ice.bundle.git* && exit\''