Skip to content

Instantly share code, notes, and snippets.

Avatar
🧉
Drinking mate

Hernán Rodríguez Colmeiro peregrinogris

🧉
Drinking mate
View GitHub Profile
@peregrinogris
peregrinogris / main.js
Created Feb 4, 2011
Testcase for memory leak on widgets
View main.js
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 Jun 11, 2011
Change Committer Email on a git repository
View gist:faf88d2c1dadc549380f
# 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 Dec 2, 2021
Custom flavored grep
View grepc.sh
#!/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 Nov 30, 2011
Extra simple remote logger
View simpleLogger.py
#!/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 Feb 15, 2012
my HG conf file
View .hgrc
[extensions]
color =
pager =
hgext.mq =
[pager]
pager = LESS='FSRX' less
[diff]
git = true
@peregrinogris
peregrinogris / quickbrownfox.js
Created Feb 24, 2012
The sentence, “The quick brown fox jumps over the lazy dog” uses every letter in the English language.
View quickbrownfox.js
var phrase = "the quick brown fox jumps over the lazy dog"
alert(phrase.replace(/ /g,'').split('').sort().join(''))
View colors.css
.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 Jun 30, 2012
Script to bring life to the delorean panel by @mart3ll, prior art by @dolske
View panel-dates.js
// 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 Jul 1, 2012
A script to count the js lines a set of folders contain
View lines.sh
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 Mar 4, 2013
Split text into sentences and output that json.
View process.py
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'