Skip to content

Instantly share code, notes, and snippets.

View ecarreras's full-sized avatar
💡
IT for utilities

Eduard Carreras ecarreras

💡
IT for utilities
View GitHub Profile
@nvie
nvie / new_workers.py
Created August 30, 2012 21:22
Initial experiment with a possible new worker structure for RQ
from gevent import monkey
monkey.patch_all()
import gevent.pool
import os
import random
import time
import datetime
from multiprocessing import Semaphore, Array
@kennethreitz
kennethreitz / pr.md
Created September 12, 2012 20:56 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dvarrazzo
dvarrazzo / prepare.py
Created September 28, 2012 01:19
An example of psycopg2 cursor supporting prepared statements
#!/usr/bin/env python
"""An example of cursor dealing with prepared statements.
A cursor can be used as a regular one, but has also a prepare() statement. If
prepare() is called, execute() and executemany() can be used without query: in
this case the parameters are passed to the prepared statement. The functions
also execute the prepared statement if the query is the same prepared before.
Prepared statements aren't automatically deallocated when the cursor is
deleted, but are when the cursor is closed. For long-running sessions creating
@dcramer
dcramer / gist:3898601
Created October 16, 2012 10:40
pmp Concept
@ecarreras
ecarreras / VARS.sh
Last active December 11, 2015 02:28
Scripts per actualització de versió de l'ERP
VERSION="2.35.0"
@mikeyk
mikeyk / watch_wal-e.py
Created January 16, 2013 20:24
Watch_wal-e script
#! /usr/bin/env python
from boto.ses.connection import SESConnection
import os
import sys
import subprocess
import socket
TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp'
if __name__ == '__main__':
@ecarreras
ecarreras / README.md
Last active December 11, 2015 17:09
Install/Upgrade packages without (re)starting services in Debian/Ubuntu
anonymous
anonymous / gist:4747864
Created February 10, 2013 01:14
TPB AFK Subtítulos en español
10:01:47:24 10:01:51:10 
Tres suecos fueron detenidos el día de hoy,
sospechosos de administrar-
10:01:51:14 10:01:57:10
-uno de los sitios web de descargas
ilegales más grandes del mundo... -
10:01:57:14 10:02:02:01
Buenas noches. EE.UU. amenazó
@ecarreras
ecarreras / REAME.md
Last active December 13, 2015 17:58
Switcht to previous workspace

Switch to previous workspace

  1. Start the server.
 $ python lw.py server
  1. Bind a shortcut to python lw.py client.

Paralize your scripts with Redis

  1. Setup your redis server
  2. Install python-rq
  3. Clone this gist
  4. Start n workers
  5. Run tas_rq.py
  6. Wait workers do the job :)