Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar

Thalis K. tkalfigo

  • Berlin, Germany
View GitHub Profile
tkalfigo / gist:5695629
Last active February 1, 2017 14:35
Place in .bashrc so that psql can navigate using cursor keys result sets that are wider than your terminal.
View gist:5695629
#Place this in ~/.bashrc or ~/.bash_profile so that psql can show rows that are wider than the terminal using cursor keys
export PAGER=less;
export LESS='-iMFXSx4R';
tkalfigo /
Last active June 21, 2019 11:48
Bash shell script for WAL archiving over ssh to remote host when doing replication with Postgresql
#!/bin/bash -x
# uses ssmtp to send email [for setup see:]
EMAIL_MSG="To:\nFrom:\nSubject: Replication error\n\n";
#in case of error, how long to sleep before retrying
tkalfigo / gist:5695645
Last active December 18, 2015 00:18
How to resume an interrupted scp
View gist:5695645
$ rsync --partial --progress -av --rsh=ssh local_file
$ rsync --partial --progress -av --rsh=ssh ./localFolder/
Or shorter version
$ rsync -av -P -e ssh SRC DEST
If ssh is on a non default port:
tkalfigo / .psqlrc
Last active September 11, 2017 22:00
My .psqlrc
View .psqlrc
\set QUIET 1
\pset null '(null)'
\pset linestyle unicode
\pset border 2
\set ON_ERROR_ROLLBACK interactive
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 2000
\set PROMPT1 '%n@%/[%M:%>] # '
\set PROMPT2 '> '
tkalfigo / gist:8093636
Last active July 4, 2017 19:03
Useful git aliases
View gist:8093636
# alias gitlo='git log --no-walk --tags --pretty="%h %d %s" --decorate=full --oneline'
alias gitlo='git log --pretty="%h %ad %d %s (%an)" --decorate=full --graph -n 30 | grep -E --color "^|tag: "'
alias gitloa='git log --no-walk --tags --pretty="%h %d %s" --decorate=full --oneline'
alias gitbra="git branch -vva"
alias gitsta="git status"
alias gitdif="git diff --color-words"
alias gitlosum="git log --stat --summary"
alias gitdifstat="git diff --stat --summary"
alias gitpull="git pull --rebase"
alias gitpru="git remote prune origin"
View gist:8203694
Date.prototype.prettyPrint = function () {
return ['Jan.', 'Feb.', 'Mar.',
'Apr.', 'May', 'Jun.',
'Jul.', 'Aug.', 'Sep.',
'Oct.', 'Nov.', 'Dec.'][this.getMonth()] + " " +
(function (d) {
var s = d.toString(), l = s[s.length-1];
return s+(['st','nd','rd'][l-1] || 'th');
})(this.getDate()) + ", " +
this.getFullYear() + " " +
tkalfigo / gist:8830556
Last active February 1, 2017 14:26
Set bash shell prompt to display git branch when in versioned folder
View gist:8830556
export PS1="\[\e]0;\u@\h:\w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$(__git_ps1)\$ "
tkalfigo / gist:8850946
Last active February 1, 2017 14:26
Script to run meld by default on git diff's (~/.git_meld_diff.js)
View gist:8850946
#!/usr/bin/env node
var exec = require('child_process').exec;
function cb(error, stdout, stderr) {
if (error !== null) {
console.log('exec error: ' + error);
exec('/usr/bin/meld ' + process.argv[3] + ' ' + process.argv[2] , cb);
tkalfigo / gist:9134406
Last active February 1, 2017 14:25
View gist:9134406
name = Thalis Kalfigkopoulos
email =
default = simple
external = /home/tkalfigo/.git_meld_diff.js
branch = auto
diff = auto
tkalfigo / gist:f94b4ceae6a038edff64
Created June 19, 2014 13:04
md5 checksum on a directory
View gist:f94b4ceae6a038edff64
find somedir -type f -exec md5sum {} \; | sort -k 34 | md5sum