Skip to content

Instantly share code, notes, and snippets.

@ernestom
ernestom / renamer.py
Created December 20, 2011 22:31
Python script to search and replace uncomplicated terms recursively in a given directory, always asking for confirmation.
"""
Recursively does a search & replace in the given directory.
Usage: python renamer.py <dir> <search> <replace>
"""
import os
import re
import sys
from fabric.colors import red
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
@ernestom
ernestom / git-remove-permanently.sh
Created December 21, 2011 20:02
Script to permanently remove paths from git's tree and index.
#!/bin/bash
#
# Removes the given paths permanently from the git index and tree.
#
set -e
function stats {
echo
echo "Git Objects:"
git count-objects -v
@ernestom
ernestom / export-tickets.go
Created December 22, 2011 22:44
Exports Assembla Tickets to GitHub Issues.
// Exports Assembla tickets in XML format to GitHub issues.
//
// Usage: $ ./export-tickets path/to/tickets.xml repository_name
//
package main
import (
"os"
"fmt"
@ernestom
ernestom / word-frequency-counter.js
Created February 13, 2012 18:38
Bookmarklet to count word frequency
(function () {
function getBodyText(win) {
var doc = win.document,
body = doc.body,
selection, range, bodyText;
if (body.createTextRange) {
return body.createTextRange().text;
} else if (win.getSelection) {
selection = win.getSelection();
range = doc.createRange();
@ernestom
ernestom / juego-caras.html
Created February 15, 2012 04:30
Identificando caras Entucine.com
<!DOCTYPE html>
<html><head><title>Caritas</title></head>
<body>
<style>
body{ padding-left:50px;}
#stage {
border:1px solid #ccc;
cursor:pointer;
background:#eee;
@ernestom
ernestom / hack.sh
Created March 31, 2012 20:46 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ernestom
ernestom / akamai-apology-retry.htm
Created June 27, 2012 23:17
HTML/JS Apology page - retry self load
<!doctype html>
<html>
<head><meta charset="utf-8"></head>
<body>
<div id="loading">
<h2>Cargando información...</h2>
<h3>Esto puede tomar unos minutos</h3>
</div>
<div id="service-unavailable">
<h2>Por favor intente más tarde, disculpe las molestias</h2>
@ernestom
ernestom / connectvpn.applescript
Created August 21, 2012 17:45
Connect VPN applescript
tell application "System Events"
tell current location of network preferences
set VPNService to service "SVPN"
if exists VPNService then
connect VPNService
end if
end tell
end tell
# Expand tabs in php files.
$ for i in $(find ./* -iname "*.php"); do awk '{sub("\t"," ",$0); print $0}' $i > ~/e.tmp && cat ~/e.tmp > $i; done