Skip to content

Instantly share code, notes, and snippets.

View olorin's full-sized avatar

Sharif Olorin olorin

View GitHub Profile

Code review: principle and practice

As an engineering team, code review is the single most important tool we have available to ensure the quality of the code we write and the safety of the systems we build. Automated testing is critical component too - but for a testsuite to be effective, it's necessary 1) that the code be "testable" - modular and well-structured, with clearly defined inputs, outputs and state transitions; and 2) that the tests accurately model the potential failure modes of the system - not

Keybase proof

I hereby claim:

  • I am olorin on github.
  • I am fractalcat (https://keybase.io/fractalcat) on keybase.
  • I have a public key whose fingerprint is 6FB7 ED25 BFCF 3E22 72AE 6E8C 47D4 CE7F 6B9F DF57

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am fractalcat on github.
  • I am fractalcat (https://keybase.io/fractalcat) on keybase.
  • I have a public key whose fingerprint is 6FB7 ED25 BFCF 3E22 72AE 6E8C 47D4 CE7F 6B9F DF57

To claim this, I am signing this object:

@olorin
olorin / HashJBCrypt.java
Created December 3, 2014 23:10
HashJBCrypt.java
// Hash a password with jBCrypt.
public class Main {
public static void main(String [] args) {
String pw1 = args[0];
String h1 = BCrypt.hashpw(pw1, BCrypt.gensalt());
System.out.println(h1);
}
}
#! /usr/bin/env python
import sys, random, optparse
def gen(generator, n, alphabet):
password = []
stream = open(generator, 'rb')
alphabet = set(map(lambda i: chr(i), alphabet))
while len(password) < n:
c = stream.read(1)
@olorin
olorin / .xmobarrc
Created June 4, 2013 09:08
sio's xmonad config.
Config {
bgColor = "black"
, fgColor = "grey"
, position = TopW L 100
, font = "xft:Bitstream Vera Sans Mono:size=12:antialias=true"
, commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%", "-H", "75", "--high", "red"] 10
, Run Swap [] 10
, Run Date "%a, %d %b | %H:%M:%S" "date" 10
, Run StdinReader
@olorin
olorin / vimrc
Created August 5, 2012 13:54
trivial Python .vimrc
syntax on
filetype indent plugin on
au FileType python setlocal textwidth=0 wrapmargin=0
@olorin
olorin / .emacs.el
Created July 22, 2012 11:54
fractalcat's .emacs
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-solarized-dark)))
(scroll-bar-mode -1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(set-face-attribute 'default nil :height 140)
@olorin
olorin / genpass.py
Created June 17, 2012 00:02
Simple Python random string generator - I use it for database passwords and the like.
#! /usr/bin/python2
import sys, random, optparse
def gen(generator, n, alphabet):
password = []
stream = open(generator, 'rb')
alphabet = set(map(lambda i: chr(i), alphabet))
while len(password) < n:
c = stream.read(1)
@olorin
olorin / widgets.py
Created August 17, 2011 22:16
Django inline radio box widget
from django.forms import widgets
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
class InlineRadioFieldRenderer(widgets.RadioFieldRenderer):
def render(self):
return mark_safe(u'\n%s\n' % u'\n'.join([u'%s'
% force_unicode(w) for w in self]))
class InlineRadioSelect(widgets.RadioSelect):