Skip to content

Instantly share code, notes, and snippets.

View snahor's full-sized avatar

Hans Roman snahor

  • Wakanda
View GitHub Profile
@snahor
snahor / retry.js
Last active September 28, 2016 07:34
function* fib() {
let a = 0;
let b = 1;
while (true) {
[a, b] = [b, a + b];
yield a;
}
}
const sleep = async (n) => await (new Promise(r => setTimeout(r, n)));
# -*- coding: utf-8 -*-
SI_NO = ((0, u'No'), (1, u'Sí'))
DILUCIONES = (
('1', '1'),
('1:2', '1:2'),
('1:4', '1:4'),
('1:8', '1:8'),
('1:16', '1:16'),
# posix
sudo echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" > /etc/apt/sources.list.d/virtualbox.list
# fish
# sudo echo "deb http://download.virtualbox.org/virtualbox/debian (lsb_release -cs) contrib" > /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install virtualbox-5.0 -y
const sleep = async (n) => await (new Promise(r => setTimeout(r, n)));
export default sleep;
@snahor
snahor / freetds.conf
Last active January 2, 2016 08:39
SQLA + pyodbc
[db_name]
host = 1.1.1.1
port = 1433
tds version = 8.0
client charset = UTF-8
from math import ceil
from mongoengine.queryset import QuerySet
__all__ = ('paginate',)
def paginate(page=1,
total=0,
adjacents=2,
per_page=1,
hgrep() {
history | grep -v grep | grep $1 | awk '{f=$1;$1="";print $0}' | awk '{$1=$1}1' | sort | uniq
}
@snahor
snahor / README.md
Last active December 27, 2015 09:39

Uso

Crea un virtualenv:

virtualenv /tmp/qwe

Esto creara un directorio en /tmp llamado qwe

Activar el virtualenv

FILE = 'wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2'
def install_wkhtmltopdf():
run('apt-get install libfontconfig libxrender1')
with cd('/usr/local/bin'):
run('wget https://wkhtmltopdf.googlecode.com/files/%s' % FILE)
run('tar xf %s' % FILE)
run('ln -s wkhtmltopdf-amd64 wkhtmltopdf')
run('rm %s' % FILE)
@snahor
snahor / dabblet.css
Created September 15, 2013 10:05
Untitled
html {
background: #eee;
}
body {
width: 600px;
height: 600px;
border: 10px solid #000000;
border-radius: 50%;
position: relative;