Skip to content

Instantly share code, notes, and snippets.

View olorin's full-sized avatar

Sharif Olorin olorin

View GitHub Profile
@olorin
olorin / daemonextension.py
Created May 28, 2011 14:48 — forked from screeley/daemonextension.py
compatible with python-daemon 1.6
"""
Copyright (c) 2009, Sean Creeley
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@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):
@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 / .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 / 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 / .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
#! /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 / 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);
}
}

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:

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: