Skip to content

Instantly share code, notes, and snippets.

Hernán Rodríguez Colmeiro peregrinogris

Block or report user

Report or block peregrinogris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / 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 / 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 / max_search.py
Created Jun 27, 2016
Search for the maximum valid number in a range. Useful for scanning sequential ids and quickly (O(log(max_value))) find the maximum valid id.
View max_search.py
class MaxSearch:
def __init__(self, max_value=2**16):
self.max_value = max_value
# Override this method with your validity check
def check_result(self, number):
pass
def scan(self, min_=0):
max_ = self.max_value
View keybase.md

Keybase proof

I hereby claim:

  • I am peregrinogris on github.
  • I am peregrinogris (https://keybase.io/peregrinogris) on keybase.
  • I have a public key ASAZc3TC420CeX5vwpJmnILCDp64CP67AIxLC-P2NISSbgo

To claim this, I am signing this object:

@peregrinogris
peregrinogris / eslint.md
Created Apr 11, 2016
Configure eslint based on airbnb style guides for ES5/ES6/ES7
View eslint.md

Install: $ npm install eslint babel-eslint eslint-config-airbnb

.eslintrc:

{
  "extends": "airbnb/base",
  "parser": "babel-eslint",
  "rules": {
    "max-len": [2, 80, 2, {
View pocket-links.js
View test.html
<html>
<head>
<link rel="stylesheet" href="http://localhost:3000/build.css">
<!-- <script src="https://d2y1h8z11rh263.cloudfront.net/js/zepto.custom.js"></script> -->
</head>
<body>
<select id="timezone" name="timezone" class="select-control"><option value="America/Sao_Paulo">Brasilia</option></select>
<input type=reset>
<script type="text/javascript">
var select = document.createElement('select');
You can’t perform that action at this time.