Skip to content

Instantly share code, notes, and snippets.

@elmarcoh
elmarcoh / table_init.js
Created October 26, 2012 21:35
Using Tastypie as an Ajax Source for DataTables
$('#participantes-table').dataTable({
bProcessing: true,
bServerSIde: true,
sAjaxSource: "/path/to/your/tastypie/api/list/objects/?format=json",
sAjaxDataProp: "objects",
aoColumns: [
// Put the resource name that corresponds to each table column
{'mData': "your"},
{'mData': "columns"},
],
@elmarcoh
elmarcoh / form_fill.js
Created November 24, 2012 01:25
Form fill Bookmarklet with Chilean RUT
//Caution when minifiyng this file: the modulus operator in getRut must have spaces around it, otherwise
//Chrome throws an error, and the damn thing won't work
var auto =
{
names: 'Steve Buscemi Catherine Keener Dermot Mulroney Danielle Zerneck James LeGros Rica Martens Peter Dinklage Kevin Corrigan Hilary Gilford Robert Wightman Tom Jarmusch Michael Griffiths Matthew Grace Ryan Bowker Francesca DiMauro',blurb: 'phpBB is a free, open source Internet community application, with outstanding discussion forums and membership management. Written in the PHP scripting language, and making use of the popular MySQL database, phpBB is a standard among web hosting companies throughout the world, and is one of the most widely-used bulletin board packages in the world. phpBB short-circuits the need for you to be a web development master in order to create and manage massive online communities',password: 'secret',fillerup: function()
{
var all_inputs = document.getElementsByTagName('input');var all_selects = documen
@elmarcoh
elmarcoh / install_node.sh
Created December 10, 2012 14:38
Install node & npm in virtualenv
#!/bin/sh
#
# This script will download NodeJS, NPM and lessc, and install them into you Python
# virtualenv.
#
# Based on a post by Natim:
# http://stackoverflow.com/questions/8986709/how-to-install-lessc-and-nodejs-in-a-python-virtualenv
NODEJS="http://nodejs.org/dist/v0.8.3/node-v0.8.3.tar.gz"
@elmarcoh
elmarcoh / grabssh
Created August 16, 2013 14:30
Fix ssh with auth (cert) fowarding (ssh -A) to work with screen Run this script prior to attaching or launching screen, and it will generate a file named "fixssh" exporting a series of envvars. Once on screen you must source ~/fixssh to use your machine's cert intead of the remote's one.
#!/bin/sh
SSHVARS="SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION DISPLAY"
for x in ${SSHVARS} ; do
(eval echo $x=\$$x) | sed 's/=/="/
s/$/"/
s/^/export /'
done 1>$HOME/fixssh
@elmarcoh
elmarcoh / pair_generator.html
Created October 19, 2013 20:21
A dumb app to generate pairs for XP, useful for lazy rehashing
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Pair generator</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" charset="utf-8">
function make_pairs() {
people = $('#people').val().split('\n');
░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░
@elmarcoh
elmarcoh / selenium_proxy.py
Last active October 31, 2017 23:13
Selenium + Browsermob proxy example
"""
Selenium webdriver + BrowserMob proxy example
First, you have to download browsermob:
wget --no-check-certificate https://s3-us-west-1.amazonaws.com/lightbody-bmp/browsermob-proxy-2.0-beta-9-bin.zip
unzip inside the directory you are running this
pip install selenium browsermob-proxy
@elmarcoh
elmarcoh / game.sh
Created March 24, 2014 03:44
Run a game with wine using only one monitor (on multimonitor setup)
#!/usr/bin/env bash
xrandr --auto --output HDMI1 --above LVDS1
xrandr --output LVDS1 --off
WINEDEBUG=-all \
WINEPREFIX=~/.wineprefixes/spore \
/usr/bin/wine <game.exe>
@elmarcoh
elmarcoh / git_list_commits_to_develop.sh
Created August 19, 2015 18:10
List number of commits that are not in develop
for b in `git branch --remote`; do echo $b `git lg origin/develop..$b|wc -l` ; done
@elmarcoh
elmarcoh / esp8266.ino
Created December 2, 2015 20:05
Arduino Wifi
#include <SoftwareSerial.h>
SoftwareSerial ESP8266(2, 3);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); //HARDWARE
ESP8266.begin(9600);//SOFTWARE
enviar_dato("AT", 1000);