Skip to content

Instantly share code, notes, and snippets.


Alejandro agaviria

View GitHub Profile
NoraCodes /
Last active Jan 24, 2022
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
// The Solution:
BretFisher /
Last active Aug 11, 2021
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
mschoebel / main.go
Created Mar 6, 2014
Snippet: login/logout (Golang)
View main.go
package main
import (
// cookie handling
cjyar / memoize.go
Created Dec 1, 2013
Generic memoizer in Go.
View memoize.go
package memoize
import (
// 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
wsargent /
Last active Nov 11, 2021
Docker cheat sheet

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


  • 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
# 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
StarpTech / getJSONVal.go
Last active Dec 14, 2015
Get nested JSON value dynamically by tail-recursion and type-assertions
View getJSONVal.go
package main
import (
func GetStructField(f interface{},path []string) interface{} {
rangeOver := f.( map[string]interface{})
counter := 0
maxLen := len(path)-1
lifepillar / Rakefile
Created Nov 3, 2012
Rake tasks for simple personal reporting in Ledger
View Rakefile
# -*- coding: utf-8 -*-
# 2012-11-12
require 'rubygems' if RUBY_VERSION < "1.9"
require 'shellwords'
ASSETS = '^asset'
CREDIT_CARD = 'liabilities:credit card'
INCOME = '^income'