Skip to content

Instantly share code, notes, and snippets.

Yao Adzaku rpip

Block or report user

Report or block rpip

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rpip
rpip / redux.py
Last active Jan 21, 2018
pseudo implementation of the redux concept in Python https://code-cartoons.com/a-cartoon-intro-to-redux-3afb775501a6
View redux.py
# events can be any structure, recommendation is to have a type keys
# to identify the event type and then add the payload keys
class DumpComponent:
# the views/models
# emit their own DOM, have own css styles
pass
class SmartComponents:
@rpip
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)
end
@rpip
rpip / business-models.md
Last active Aug 29, 2015 — forked from ndarville/business-models.md
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.
View business-models.md

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@rpip
rpip / passwd.py
Last active Aug 29, 2015
Generate passwords for KeePass database. Output: (password, hash)
View passwd.py
#!/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 / asm-notes.md
Last active Aug 29, 2015
my study notes ASM x86/i386
View asm-notes.md

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 / emacs-notes.md
Last active Aug 29, 2015
Notes on learning Emacs
View emacs-notes.md

Notes on learning Emacs

basics

C-x f => open file

C-x s => save file

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

View edfs.md

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.

View defstructplusplus.ex
defmodule DefStructPlusPlus do
@doc """
Macro for defining structs
## Examples
defmodule Models do
import DefStructPlusPlus
You can’t perform that action at this time.