Skip to content

Instantly share code, notes, and snippets.

@rubencaro
rubencaro / setup_go.md
Last active April 28, 2024 21:52
Golang installation guide

Golang installation guide

Since Golang version 1.11 this process is finally (almost) as easy as it should (!!). You can see full docs here. For older guides see here.

These are my notes, not a generic solution. They are not meant to work anywhere outside my machines. Update version numbers to whatever are the current ones while you do this.

Installing everything needed the first time

Install asdf and its golang plugin, then install golang

@boukeversteegh
boukeversteegh / functionalprogramming.py
Last active December 17, 2015 02:09
How to do functional programming in Python
import inspect
# Callable class to wrap functions
class F:
def __init__(self, func, *args):
self.func = func
self.args = args
# Currying
@ericmoritz
ericmoritz / step.erl
Created July 27, 2012 19:01
An experiment with immutable iterators.
%%% File : step.erl
%%% Author : Moritz <emoritz@gci-esansone>
%%% Description : An example of an iterator protocol
%%% Created : 27 Jul 2012 by Eric Moritz <eric@themoritzfamily.com>
%%
%% Goals
%%
%% - Pausable iteration
%% - Infinite streams
@ericmoritz
ericmoritz / .gitignore
Created July 25, 2012 17:39
Check github pull requests for python file changes
*.beam
@ericmoritz
ericmoritz / itertoolsplus.py
Created October 19, 2011 20:16
itertools plus
def ichunk(s, size):
return (s[i: i+size] for i in xrange(0, len(s), size))
def ichain(iterable):
"""Better than itertools.chain because it does not use *args"""
for inner in iterable:
for item in inner:
yield item
@ericmoritz
ericmoritz / riakmap.py
Created July 30, 2011 17:05
riak mapping interface
from collections import Mapping
def force_str(str_or_unicode):
if type(str_or_unicode) is unicode:
return str_or_unicode.encode("utf-8")
else:
return str_or_unicode
class RiakMapping(Mapping):
@ericmoritz
ericmoritz / README.rst
Created May 13, 2011 01:17
crazy-template.js

crazy_template

A template engine in 42 lines of code.

About

I was thinking of a way to generate HTML without using strings as embedding strings in Javascript is a pain if they are multi-lined. There isn't a nice triple quote like there exists in Python.

So I took my inspiration from Lisp HTML generators that use S-expressions to generate HTML. I thought, hell, S-expressions are just a bunch of nested lists, I could do the same thing in Javascript.

@ericmoritz
ericmoritz / greetings.py
Created March 23, 2011 19:51
My nano-framework
"""A simple little hello/goodbye example which takes advantage of urlvars"""
from nano import FrontController
import routes
from routes.middleware import RoutesMiddleware
from webob.dec import wsgify
from webob.exc import HTTPNotFound
from webob import Response
resources = {}