Skip to content

Instantly share code, notes, and snippets.

View agaviria's full-sized avatar
:octocat:

Alejandro agaviria

:octocat:
View GitHub Profile
@gavinheavyside
gavinheavyside / mapreduce_conway.rb
Created September 19, 2010 20:02
A MapReduce algorithm for Conway's Game of Life
#!/usr/bin/env ruby
require 'rubygems'
require 'wukong'
# Given a file with the coordinate pair of a live cell on each line,
# generate the next iteration of Game of Life, using MapReduce
#
# The map phase takes each live cell, and outputs 9 key value pairs, 1 for
# each of the adjacent cells and itself. The reduce phase dedupes, detects
@sgreenfield
sgreenfield / gist:1557278
Created January 3, 2012 22:26
Compass font-face mixin
@mixin font-face(
$name,
$font-files,
$eot: false,
$weight: false,
$style: false
) {
$iefont: unquote("#{$eot}?iefix");
@font-face {
font-family: quote($name);
@meddulla
meddulla / install_tmux_mac_os_lion.sh
Created June 10, 2012 19:45
install tmux mac os lion
sudo -s
mkdir /usr/local/src
cd /usr/local/src
# If you have never eared about libevent, you probably need to compile it
curl -L -o libevent-2.0.16-stable.tar.gz http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz
tar -xvf libevent-2.0.16-stable.tar.gz
cd libevent-2.0.16-stable
./configure
make && make install
@ninnemana
ninnemana / index.go
Created July 5, 2012 19:23
Testing out the encoding/csv package in golang
package main
import (
"encoding/csv"
"net/http"
"html/template"
"fmt"
"strconv"
)
@lifepillar
lifepillar / Rakefile
Created November 3, 2012 22:29
Rake tasks for simple personal reporting in Ledger
# -*- coding: utf-8 -*-
# 2012-11-12
require 'rubygems' if RUBY_VERSION < "1.9"
require 'shellwords'
DEFAULT_CURRENCY = '$'
ASSETS = '^asset'
LIABILITIES = '^liab'
CREDIT_CARD = 'liabilities:credit card'
INCOME = '^income'
@StarpTech
StarpTech / getJSONVal.go
Last active December 14, 2015 05:29
Get nested JSON value dynamically by tail-recursion and type-assertions
package main
import (
"fmt"
)
func GetStructField(f interface{},path []string) interface{} {
rangeOver := f.( map[string]interface{})
counter := 0
maxLen := len(path)-1
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
# create our directories

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@cjyar
cjyar / memoize.go
Created December 1, 2013 01:29
Generic memoizer in Go.
package memoize
import (
"fmt"
"reflect"
)
// fptr is a pointer to a function variable which will receive a
// memoized wrapper around function impl. Impl must have 1 or more
// arguments, all of which must be usable as map keys; and it must