Skip to content

Instantly share code, notes, and snippets.

View pcostesi's full-sized avatar

Pablo Alejandro Costesich pcostesi

View GitHub Profile
@pcostesi
pcostesi / gist:3071259
Created July 8, 2012 14:52
Permisos para .ssh
pcostesi@hp425 11:50
~ $ ls -lash .ssh
total 44K
4,0K drwx------ 2 pcostesi pcostesi 4,0K jul 1 17:09 .
4,0K drwxr-xr-x 73 pcostesi pcostesi 4,0K jul 6 18:32 ..
4,0K -rw------- 1 pcostesi pcostesi 788 may 23 2011 authorized_keys
4,0K -rw------- 1 pcostesi pcostesi 337 jul 1 17:09 config
4,0K -rw------- 1 pcostesi pcostesi 1,8K abr 3 2011 id_rsa
4,0K -rw------- 1 pcostesi pcostesi 396 abr 3 2011 id_rsa.pub
20K -rw------- 1 pcostesi pcostesi 17K jul 1 17:00 known_hosts
@pcostesi
pcostesi / example.py
Created August 15, 2012 03:43
Flask view decorator to dispatch a request into different handlers by mimetypes.
@split
@login_required
def hello():
return render_template('hello.html')
@hello.for_mimetype("application/json")
@login_required
def hello():
return jsonify({"hello":"flask"})
@pcostesi
pcostesi / gootils.js
Created October 15, 2012 20:03
Google shortener and qr utils.
(function($){
Gootils = window.Gootils || {};
var getEndpoint = function(endpoint, options){
var result = [endpoint + "?"];
for (var key in options) {
result.push(key + "=" + encodeURIComponent(options[key]));
};
return result.join("&");
@pcostesi
pcostesi / core.py
Created November 5, 2012 17:44
El Core del TP de EDA, en Python.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import izip as zip, ifilter as filter, imap as map, product
import logging
logging.basicConfig(level='INFO')
def distance(src, dst):
""" Given two tuples, returns the maximum manhattan distance. """
#!/usr/bin/env python
import SocketServer
import struct
import shutil
import hashlib
import zlib
from StringIO import StringIO
import os
try:
import wx
@pcostesi
pcostesi / reducer.py
Last active December 13, 2015 20:58
Reducer decorator, for things more complex than just lambdas.
def reducer(f):
def x(): pass
def g(sequence, initial=x):
if initial is x:
return reduce(f, sequence)
return reduce(f, sequence, x)
return g
@pcostesi
pcostesi / diag.sh
Last active December 13, 2015 21:08
regnum diag script
#!/bin/bash
clear
echo Juntando información
DATE=$(date --rfc-3339=date)
LOGFILE=~/regnum-$DATE.txt
CPU=$(cat /proc/cpuinfo | grep -i "model name")
MHZ=$(cat /proc/cpuinfo | grep 'cpu MHz')
CACHE=$(cat /proc/cpuinfo | grep 'cache size')
KERNEL=$(uname -a)
/**
* "Google Now" Card
*/
body {
background: #e1e1e1;
min-height: 100%;
margin: auto;
}
ul.gNow {
width: 450px;
@pcostesi
pcostesi / dabblet.css
Created September 15, 2013 19:38
"Google Now" Card
/**
* "Google Now" Card
*/
body {
background: #e1e1e1;
min-height: 100%;
margin: auto;
}
div.center {
@pcostesi
pcostesi / golf.py
Last active December 27, 2015 17:48
GOLF!
import ImageFont, ImageDraw, Image, xlrd
font = ImageFont.truetype("arial.ttf", 18)
sh = xlrd.open_workbook("the_excel.xls").sheet_by_index(0)
data = [[sh.cell_value(rowx=x, colx=y) for y in range(sh.ncols)]
for x in range(sh.nrows)]
for i, row in enumerate(data):
im = Image.open("template.png")
draw = ImageDraw.Draw(im)
draw.text((0, 0), '\n'.join(row), font=font, fill="#000")
im.save("cert-%d.png" % i, "PNG")