Skip to content

Instantly share code, notes, and snippets.

View eduherraiz's full-sized avatar

Edu Herraiz eduherraiz

View GitHub Profile
@eduherraiz
eduherraiz / thumbor.conf
Created June 14, 2015 15:01
Nginx thumbor configuration
upstream thumbor {
server 127.0.0.1:8090;
server 127.0.0.1:8091;
server 127.0.0.1:8092;
server 127.0.0.1:8093;
}
server {
listen 80;
server_name thumbor.domain.com;
@eduherraiz
eduherraiz / gist:60483b139721ec2c7ca852e81344fed3
Created November 6, 2017 10:23
dependencias instaladas robotb2b
Automat==0.6.0
Django==1.7
EasyProcess==0.2.3
PyVirtualDisplay==0.1.5
PyYAML==3.11
Scrapy==0.24.4
Twisted==17.9.0
amqp==1.4.9
anyjson==0.3.3
apconf==0.0.26
@eduherraiz
eduherraiz / hookcow
Last active June 23, 2017 08:00
Git hook to show a random fortune message using random cowsay on fridays
#!/bin/bash
# System Dependencies
# sudo apt install fortune cowsay toilet
if [[ $(date +%u) -eq 5 ]] ; then
MESSAGE='FRIDAY AT APSL'
COW_STATUS=`shuf -n1 -e b d g p s t w y`
COWFILES=`cowsay -l | grep -v files`
COWFILE=`shuf -n1 -e $COWFILES`
echo "-- $MESSAGE --" | toilet --gay -f future
fortune -s -n 80 fortunes | cowsay -$COW_STATUS -f $COWFILE | toilet --gay -f term
map $http_user_agent $mobile_device {
default Desktop;
"~*iPad|iPad.*Mobile|^.*Android.*Nexus(((?:(?!Mobile))|(?:(\s(7|10).+))).)*$|SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1010|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P6810|GT-P7501|Kindle|Silk.*Accelerated|xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617|Android.*\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71)\b|Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|Sony\ Tablet|Sony\ Tablet\ S|SGPT12|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT211|SGPT213|EBRD1101|
image: hub.apsl.net/library/gitlab-builder:1033-975f2604
before_script:
- docker info
stages:
- test
test:
stage: test
script:
- flake8 .
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
La instalación del paquete de ubuntu dió problemas en la instalación.
Para solucionarlo, una vez que falla la ejecución del apt-get install hay que hacer:
1. Borrar el entorno virtual creado en /opt/vaultier/venv
2. Crearlo con: virtualenv venv
3. Activarlo con: source /opt/vaultier/venv/bin/activate
4. Instalar los requirements que dejo en este directorio o si no aquí: https://gist.github.com/eduherraiz/4271b521dc74be7c2850
5. Seguir la instalación del paquete con: dpkg --configure -a
- Revisar Configure de nginx y demás (certificados, etc)
#!/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