Skip to content

Instantly share code, notes, and snippets.

View peregrinogris's full-sized avatar
🧉
Drinking mate

Hernán Rodríguez Colmeiro peregrinogris

🧉
Drinking mate
View GitHub Profile
@peregrinogris
peregrinogris / main.js
Created February 4, 2011 00:34
Testcase for memory leak on widgets
const widgets = require("widget");
const timer = require("timer");
var instance = 0;
var widget = widgets.Widget({
label: "Mozilla website",
content: instance.toString(),
onClick: function() {
tabs.open("http://www.mozilla.org/");
}
@peregrinogris
peregrinogris / gist:faf88d2c1dadc549380f
Created June 11, 2011 04:17
Change Committer Email on a git repository
# name an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
# Based off of the script from here:
# http://coffee.geek.nz/how-change-author-git.html
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "<OLDMAIL>" ];
then
GIT_AUTHOR_EMAIL="<NEWMAIL>";
git commit-tree "$@";
else
@peregrinogris
peregrinogris / grepc.sh
Last active December 2, 2021 20:17
Custom flavored grep
#!/bin/bash
EXCLUDEDIR=${EXCLUDEDIR:-"env/*"}
COLOR=${COLOR:-always}
CONTEXT=${CONTEXT:-0}
grep -IiRn --exclude="$EXCLUDE" --exclude-dir="$EXCLUDEDIR" --color=$COLOR -C$CONTEXT "$1" * \
| less -iFRX
@peregrinogris
peregrinogris / simpleLogger.py
Created November 30, 2011 17:47
Extra simple remote logger
#!/usr/bin/python
from bottle import route, run, debug
import argparse
parser = argparse.ArgumentParser(description='Really simple remote logger.')
parser.add_argument('-n', '--name', default="localhost", help="Name of the host from which the server will start (default: %(default)s)")
parser.add_argument('-p', '--port', default=1234, type=int, help="Port the server will be listening (default: %(default)s)")
args = parser.parse_args()
@peregrinogris
peregrinogris / .hgrc
Created February 15, 2012 20:58
my HG conf file
[extensions]
color =
pager =
hgext.mq =
[pager]
pager = LESS='FSRX' less
[diff]
git = true
@peregrinogris
peregrinogris / quickbrownfox.js
Created February 24, 2012 06:07
The sentence, “The quick brown fox jumps over the lazy dog” uses every letter in the English language.
var phrase = "the quick brown fox jumps over the lazy dog"
alert(phrase.replace(/ /g,'').split('').sort().join(''))
@peregrinogris
peregrinogris / colors.css
Created March 30, 2012 13:40
LimeChat Colors
.sender[type=normal][colornumber='0'] { color: #033 }
.sender[type=normal][colornumber='1'] { color: #699 }
.sender[type=normal][colornumber='2'] { color: #f33 }
.sender[type=normal][colornumber='3'] { color: #f60 }
.sender[type=normal][colornumber='4'] { color: #3D3242 }
.sender[type=normal][colornumber='5'] { color: #6600CC }
.sender[type=normal][colornumber='6'] { color: #2C6700 }
.sender[type=normal][colornumber='7'] { color: #154890 }
.sender[type=normal][colornumber='8'] { color: #6B78B4 }
.sender[type=normal][colornumber='9'] { color: #E47297 }
@peregrinogris
peregrinogris / panel-dates.js
Created June 30, 2012 14:37
Script to bring life to the delorean panel by @mart3ll, prior art by @dolske
// Add script to bottom of page
// Convert a JS Date object to an array of characters
function dateToArray(date) {
console.log("Converting date: " + date);
var a = [];
var s = date.toString().toUpperCase().split(" ");
// eg "FRI JUN 29 2012 16:22:59 GMT-0700 (PDT)"
var month = s[1],
day = s[2],
@peregrinogris
peregrinogris / lines.sh
Created July 1, 2012 22:17
A script to count the js lines a set of folders contain
for folder in `ls -1d */`
do
files=`find $folder -type f -name "*.js" -exec cat {} \; | wc -l`
echo "$files - $folder";
done
@peregrinogris
peregrinogris / process.py
Created March 4, 2013 22:08
Split text into sentences and output that json.
from BeautifulSoup import BeautifulSoup
import json
import sys
if len(sys.argv) < 2:
print sys.argv[0] + ' <input file>'
else:
in_file = sys.argv[1]
if len(sys.argv) < 3:
tag = 'div'