Skip to content

Instantly share code, notes, and snippets.

rpip / arithmetic_protocol.ex
Last active Dec 10, 2015
Arithmetic protocol for Elixir
View arithmetic_protocol.ex
defprotocol Arithmetic.Add do
@moduledoc """
The Arithmetic.Add protocol is responsible for adding items.
The only function required to be implemented is
`__add__` which does the addition.
def __add__(left, right)
rpip /
Last active Aug 29, 2015
Generate passwords for KeePass database. Output: (password, hash)
#!/usr/bin/env python
# USAGE: ./bin/passwd $password_prefix $dbpath $inventory_hostname -w
import sys, os
import string
import random
from datetime import datetime
from keepass import kpdb
from passlib.hash import sha256_crypt
rpip /
Last active Aug 29, 2015
my study notes ASM x86/i386

x86 / IA-32 registers

  • register is 32 bit wide

general registers

  1. eax - accumulator
  2. ebx - base
  3. ecx - counter
  4. edx - data
  5. esi - source index
rpip /
Last active Aug 29, 2015
Notes on learning Emacs

Notes on learning Emacs


C-x f => open file

C-x s => save file

C-x C-w => save to a new file



The new eDFS architecture is designed with the assumption that a single master system has a single point of failure. In a single-point-of-failure system, the failure of the master node will result in the termination of jobs and the loss of access to the entire system. This will not happen in a cluster where the master node is dynamically elected.

Therefore, each node in the cluster will be a self-containing full copy of eDFS. On startup, the system reads the cluster configuration and sets up the node cluster. All nodes start as followers; one node is elected to be a leader at the start. During normal operation, the leader maintains a heartbeat which allows the followers to detect if the leader fails or becomes partitioned.

View defstructplusplus.ex
defmodule DefStructPlusPlus do
@doc """
Macro for defining structs
## Examples
defmodule Models do
import DefStructPlusPlus
rpip / service_phpbb_auth.erl
Last active Aug 29, 2015
Expose Zotonic authentication via a REST API service. This example is built for use with phpBB authentication as documented here:
View service_phpbb_auth.erl
-svc_title("External Zotonic Authentication service").
%% You can change this to restrict access