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 / 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 / GrayZone.css
Created Jul 1, 2013
My own take on GrayZone theme for LimeChat.
View GrayZone.css
html {
font: 13px/1.3em 'Lucida Grande' sans-serif;
background-color: #eee;
color: #333;
word-wrap: break-word;
margin: 0;
padding: 0;
}
body {
@peregrinogris
peregrinogris / make-leanpub.py
Created Aug 18, 2016
Build a leanpub book source to epub, using pandoc
View make-leanpub.py
with open("Book.txt") as f:
print ('echo "Starting build of {book}.epub";'
"pandoc {files} " +
"--smart --table-of-contents --chapters -o {book}.epub;"
'echo " {book}.epub created."'
).format(book="Book", files=f.read().replace("\n", " "))
@peregrinogris
peregrinogris / main-tuples.rs
Last active Jul 19, 2018
Twelve Days of Christmas implementation in Rust.
View main-tuples.rs
fn main() {
let gifts = [
("First", "a Partridge in a Pear Tree"),
("Second", "Two Turtle Doves"),
("Third", "Three French Hens"),
("Fourth", "Four Calling Birds"),
("Fifth", "Five Gold Rings"),
("Sixth", "Six Geese a-Laying"),
("Seventh", "Seven Swans a-Swimming"),
("Eighth", "Eight Maids a-Milking"),
@peregrinogris
peregrinogris / .gvimrc
Last active May 4, 2018
Vim Config Files
View .gvimrc
set guioptions-=r
set guioptions-=L
set guicursor=a:blinkon0
set guioptions=egmrt
hi ColorColumn guibg=#3E3D32
View .bash_profile
export CLICOLOR=1
# Modifies PS1 when called (to fix line-wrapping issues)
hg_branch() {
red=$(tput setaf 1)
reset=$(tput sgr0)
branch=`hg branch 2> /dev/null | awk '{print $1}'`
if [[ -n $branch ]]; then
PS1="$PS1 \[$red\](\[$reset\]$branch\[$red\])\[$reset\]"
fi
@peregrinogris
peregrinogris / README.md
Created Apr 8, 2018
Updating GNU screen on Raspbian
View README.md

Updating GNU screen on Raspbian

I've been frustrated for a few years that GNU screen didn't have emoji support but I just rechecked the issue... And guess what? It's fixed as of version 4.6.0!! While this is great news, the last available version in raspbian is 4.1.0, meaning that yes, we have to compile.

Compiling

The steps are easy:

View change-mail-git.sh
# 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" = "<INITIAL-EMAIL>" ];
then
GIT_AUTHOR_EMAIL="<FINAL-EMAIL>";
git commit-tree "$@";
else
View snippets.cson
'.source.js':
'i18n translation singular':
'prefix': 'i18'
'body': '{i18n.gettext(\'$1\')}$2'
'i18n translation plural':
'prefix': 'i18n'
'body': '{i18n.ngettext(\'$1\', \'$2\', ${3:idx})}$4'
'New test suite':
'prefix': 'newtest'
'body': """
@peregrinogris
peregrinogris / git-usebranch
Last active Feb 1, 2017
Use this to checkout a branch ending with a certain string
View git-usebranch
#!/usr/bin/env bash
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1`
git checkout $branch