Skip to content

Instantly share code, notes, and snippets.

View armonge's full-sized avatar
🏠

Andrés Reyes Monge armonge

🏠
View GitHub Profile
@armonge
armonge / .vimrc
Created April 3, 2014 15:42
Compile less on save
function LessToCss()
let current_file = shellescape(expand('%:p'))
let filename = shellescape(expand('%:r'))
let command = "silent !lessc " . current_file . " " . filename . ".css"
echo 'less compilation finished'
execute command
endfunction
autocmd BufWritePost,FileWritePost *.less call LessToCss()
import itertools
import random
import math
def map_d(c):
return math.hypot(random.random(), random.random())
def reduce_d(count_inside, d):
if d < 1:
return count_inside + 1
gitfs_remotes:
- https://github.com/saltstack-formulas/nginx-formula.git
- https://github.com/saltstack-formulas/apache-formula.git
- https://github.com/saltstack-formulas/mysql-formula.git
- https://github.com/saltstack-formulas/vim-formula.git
- https://github.com/saltstack-formulas/build-essential-formula.git
- https://github.com/saltstack-formulas/pip-formula.git
fileserver_backend:
- git
@armonge
armonge / retry.py
Created August 13, 2014 14:30
Decorator for retrying a function if it fails
def retry(exception):
def retry_decorator(func):
def _wrapper(*args, **kwargs):
tries = 0
while True:
try:
return func(*args, **kwargs)
except exception as error:
tries += 1
if tries <= 5:
import requests
from concurrent import futures
from faker import Factory
import functools
from collections import namedtuple
fake = Factory.create()
url = 'http://www.solucionescamelot.com/index.php/contactenos'
DataTuple = namedtuple('DataTuple', ['email', 'name'])
from django.http import StreamingHttpResponse
from django.conf import settings
import subprocess
def _backup():
db_config = settings.DATABASES['default']
db_config['HOST'] = db_config.get('HOST') or 'localhost'
db_config['PORT'] = db_config.get('PORT') or 3306
A = 3200
B = 1800
C = 1920
D = 1080
E = 2
F = 2
values = {
@armonge
armonge / Questions
Created June 22, 2011 03:08
Kiwi Pycon Give-away
GitHub username:armonge
Day job:Web Developer
Favorite open source project:Django
Open Source contributions (if any):
Stranded on an island, what 3 items do you take:Flashlight,matches, satellite phone
Tie-breaker, pick a number between 1 and 20,000:32433
@armonge
armonge / gist:1163934
Created August 22, 2011 23:43 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Web Developer in Nicaragua
Favorite Python project: Django
Favorite Conference: Haven't attended any yet :(
Python Experience Level: Intermediate
@armonge
armonge / Questions
Created September 6, 2011 00:49
GOTO Amsterdam
Day job: Web Developer
What is your language of choice: Python
Open Source contributions: No biggies here, just some patch in https://github.com/mozes/smpp.pdu
How do you use GitHub: Mostly i work for organizations that provide me some git repos here, but i also mantain some gists and template django projects i use regularly