Skip to content

Instantly share code, notes, and snippets.

View rpip's full-sized avatar

Yao rpip

View GitHub Profile
@rpip
rpip / gist:9922137
Created April 1, 2014 20:12
Erlang installation prerequisites
sudo apt-get -y install build-essential m4 libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxgtk2.8-dev libglu1-mesa-dev fop xsltproc default-jdk

Keybase proof

I hereby claim:

  • I am mawuli-ypa on github.
  • I am mawuli (https://keybase.io/mawuli) on keybase.
  • I have a public key whose fingerprint is F784 6E89 53C8 037C 8910 AF99 9283 B67A 05C4 E7DD

To claim this, I am signing this object:

@rpip
rpip / service_phpbb_auth.erl
Last active August 29, 2015 13:59
Expose Zotonic authentication via a REST API service. This example is built for use with phpBB authentication as documented here: https://wiki.phpbb.com/Authentication_plugins
-module(service_phpbb_auth).
-svc_title("External Zotonic Authentication service").
%% You can change this to restrict access
-svc_needauth(false).
-export([process_get/2]).
-include_lib("zotonic.hrl").
defmodule DefStructPlusPlus do
@doc """
Macro for defining structs
## Examples
defmodule Models do
import DefStructPlusPlus
@rpip
rpip / edfs.md
Last active August 29, 2015 14:04

Design

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.

@rpip
rpip / emacs-notes.md
Last active August 29, 2015 14:04
Notes on learning Emacs

Notes on learning Emacs

basics

C-x f => open file

C-x s => save file

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

@rpip
rpip / asm-notes.md
Last active August 29, 2015 14:05
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
rpip / passwd.py
Last active August 29, 2015 14:09
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
rpip / arithmetic_protocol.ex
Last active December 10, 2015 17:18
Arithmetic protocol for Elixir
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)
end
The responses attached to the examples were taken from the Params part of the events method arguments
in the controller as in:
event({_Event, Params, _TriggerId, _TargetId}, Context) ->
io:format("Mod_Buffer Event params : ~p", [Params]).
# 1
{% wire id="delete-{{ buffer.id }}" action={growl text="buffer deleted"} %}
<a id="delete-{{ buffer.id }}" href="#delete-{{ buffer.id }}"><i class="icon-trash"></i>Delete</a>