Skip to content

Instantly share code, notes, and snippets.

View eduherraiz's full-sized avatar

Edu Herraiz eduherraiz

View GitHub Profile
#!/bin/sh
BKPDIR="/var/backups/pgsql/"
TODAY=$(date +%F)
DAY=$(date +%A |tr 'A-Z' 'a-z')
MONTH=$(date +%B |tr 'A-Z' 'a-z')
TMPDIR=$(mktemp -d -p $BKPDIR) || exit 1
export PGOPTIONS='-c statement_timeout=0'
pg_dumpall -U postgres --globals-only |bzip2 > $TMPDIR/ACCOUNT-OBJECTS.$TODAY.dump.bz
@eduherraiz
eduherraiz / pizza_calling
Created January 10, 2014 13:07
Script para sortear a quién le toca llamar para pedir las pizzas
#!/bin/python
from random import choice
players = ['Fran', 'Marc', 'Luis','Alvaro','Cristian', 'Edu']
p1 = choice(players)
print "Le toca llamar a : %s" % (p1)
@eduherraiz
eduherraiz / gist:7989573
Created December 16, 2013 16:10
Bash script to get web screenshots using phantomjs
#!/bin/bash
URLS_FILE="/var/www/eduherraiz.com/www/snapshots/urls.txt"
IMGS_DIR="/var/www/eduherraiz.com/www/snapshots/imgs"
for URL in `cat $URLS_FILE`
do
FILE=`echo ${URL//[\/]/}`
#echo $FILE
# Create de screenshot with phantomjs
@eduherraiz
eduherraiz / mongodb_seg
Created December 16, 2013 14:01
MongoDB segmentation fault
Mon Dec 16 03:16:48.782 [conn297772] command neventum.$cmd command: { count: "images", query: { status: { $gte: 0 }, references.brand: 32751 } } ntoreturn:1 keyUpdates:0 locks(micros) r:203
856 reslen:48 203ms
Mon Dec 16 03:16:48.920 [conn297769] end connection 88.198.63.92:57761 (34 connections now open)
Mon Dec 16 03:16:48.985 [conn297772] command neventum.$cmd command: { count: "images", query: { status: { $gte: 0 }, references.brand: 32751 } } ntoreturn:1 keyUpdates:0 locks(micros) r:176
061 reslen:48 176ms
Mon Dec 16 03:16:49.224 [conn297772] query neventum.images query: { $query: { status: { $gte: 0 }, references.brand: 32751 }, $orderby: { position: 1 } } ntoreturn:48 ntoskip:0 nscanned:122
982 scanAndOrder:1 keyUpdates:0 locks(micros) r:238867 nreturned:8 reslen:37686 238ms
Mon Dec 16 03:16:50.327 [initandlisten] connection accepted from 88.198.63.92:59764 #297791 (35 connections now open)
Mon Dec 16 03:16:52.818 Invalid access at address: 0 from thread: conn297791