Script to 'touch' media (photo / video) files to the time that they have been taken (according available information: exif headers, filename patterns..).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node Ensaimeitor Draft. | |
// Thanks to http://ensaimeitor.apsl.net/ | |
"use strict"; | |
const srvHost = "ensaimeitor.apsl.net"; | |
const srvPort = 80; | |
const index = {//{{{ | |
fiscal: "NIF's", | |
cif: "CIF's", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Performs sequential waterfall over array of promisorys. | |
// Following two sentences: | |
// var P = Promise.all(inArr.map(cbk)) | |
// var P = arrayfall(inArr, cbk) | |
// ...are pretty much the same. | |
// Both runs all promises sequentially and returns new promise resolving with | |
// an array with resolved data (if none rejected). | |
// But in the former all promises are run as fast as input array is scanned. | |
// Whereas with arrayfall() promises are executed in sequence: each after | |
// previous one is resolved (or rejected) even being completely asyncronous. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- CPD.sql - Crappy Processes Disconnection | |
-- ---------------------------------------- | |
-- | |
-- Close PostgresSQL connections left IDLE forever by crappy processes. | |
-- | |
-- | |
-- Credits: https://stackoverflow.com/questions/12391174/how-to-close-idle-connections-in-postgresql-automatically?answertab=active#tab-top | |
-- | |
-- Minimum inactivity interval to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dateParse(d){// Parse date in "dd/mm/yyyy" format. {{{ | |
d = d.split("/"); | |
return new Date( | |
parseInt(d[2]) | |
, parseInt(d[1]) - 1 | |
, parseInt(d[0]) | |
); | |
};//}}} | |
function dateCmp (d1, d2){// Compare dates (returning -1, 0, 1). {{{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# SETUP EXAMPLE: | |
# -------------- | |
# | |
# # Install btrfs-tools: | |
# sudo apt-get install btrfs-tools | |
# | |
# # Create btrfs filesystem across one or more divices: | |
# # -> Check device names!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// checkEquals (fn, tests) - Helper function to build equality tests with Jasmine. | |
function checkEquals(fn, tests){ | |
if (fn instanceof Array) { // Allow to specify as ["this", fn] if required. | |
var target = fn[0]; // this | |
fn = fn[1]; | |
} else { // fn expected to be a single functin by default. | |
var target = this; // Or any other arbitrary value. | |
}; | |
return function(){ | |
tests.map(function(t){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// util.inspect() alternative returning always valid JSON even having circular refernces. | |
// Only for debugging and inspection purposes. | |
// Intended to be used in conjunction with underscore. Ex: "underscore print --color" | |
// Also useful with my lovely javascript inspection vim mappings: | |
// https://github.com/bitifet/dotfiles/blob/master/.vim/after/syntax/javascript/SyntaxInclude.vim | |
var inspect = (function(){ | |
var utilInspect = require("util").inspect; | |
return function inspect (obj) { | |
var result; | |
var str = "var Circular = \"(->CIRCULAR<-)\";\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var stack = (function(){ | |
function _stack(){ | |
this.stack = []; | |
this.queue = []; | |
}; | |
_stack.prototype.push = function stack_push(data){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* public.plv8_startup() | |
* | |
* Allow to have multiple per-schema plv8_init functions. | |
* | |
* USAGE: | |
* | |
* 1. Add the following line to the end of your postgresql.conf file: | |
* | |
* plv8.start_proc = 'public.plv8_startup' | |
* |