Skip to content

Instantly share code, notes, and snippets.

View tkalfigo's full-sized avatar

Thalis K. tkalfigo

  • Berlin, Germany
View GitHub Profile
@tkalfigo
tkalfigo / gist:f94b4ceae6a038edff64
Created June 19, 2014 13:04
md5 checksum on a directory
find somedir -type f -exec md5sum {} \; | sort -k 34 | md5sum
@tkalfigo
tkalfigo / gist:ee44dbeb2b37b2802da9
Created March 4, 2015 20:01
wget wildcard file download
wget -r --no-parent -A '*.tar.gz' http://www.example.com
/******************************************************************************
How to load Javascript modules into postgres
******************************************************************************/
CREATE EXTENSION IF NOT EXISTS plv8
/******************************************************************************
First step is download the Javascript module file
Example with undescore-min and node-jpath
******************************************************************************/
@tkalfigo
tkalfigo / gist:5695645
Last active December 18, 2015 00:18
How to resume an interrupted scp
$ rsync --partial --progress -av --rsh=ssh local_file username@example.com:~/
$ rsync --partial --progress -av --rsh=ssh username@example.com:~/remoteFolder/ ./localFolder/
Or shorter version
$ rsync -av -P -e ssh SRC DEST
If ssh is on a non default port:
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
tkalfigo / crosstab.sql
Created March 23, 2016 10:20 — forked from romansklenar/crosstab.sql
PostgreSQL "pivot table" example using tablefunc extension
CREATE EXTENSION tablefunc;
CREATE TABLE sales(year int, month int, qty int);
INSERT INTO sales VALUES(2007, 1, 1000);
INSERT INTO sales VALUES(2007, 2, 1500);
INSERT INTO sales VALUES(2007, 7, 500);
INSERT INTO sales VALUES(2007, 11, 1500);
INSERT INTO sales VALUES(2007, 12, 2000);
INSERT INTO sales VALUES(2008, 1, 1000);
INSERT INTO sales VALUES(2009, 5, 2500);
#! /bin/sh
# chkconfig: 2345 98 02
# description: PostgreSQL RDBMS
# File adjusted based on PGSRC/contrib/start-scripts/linux
# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems. You should edit some of the variables
# and maybe the 'echo' commands.
#
@tkalfigo
tkalfigo / gist:9134406
Last active February 1, 2017 14:25
~/.gitconfig
[user]
name = Thalis Kalfigkopoulos
email = foo@bar.com
[push]
default = simple
[diff]
external = /home/tkalfigo/.git_meld_diff.js
[color]
branch = auto
diff = auto
@tkalfigo
tkalfigo / gist:8850946
Last active February 1, 2017 14:26
Script to run meld by default on git diff's (~/.git_meld_diff.js)
#!/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
tkalfigo / gist:8830556
Last active February 1, 2017 14:26
Set bash shell prompt to display git branch when in versioned folder
export PS1="\[\e]0;\u@\h:\w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$(__git_ps1)\$ "