Skip to content

Instantly share code, notes, and snippets.

View dreamiurg's full-sized avatar

Dmytro Gaivoronsky dreamiurg

  • CISO & VP of Engineering @ Assurance IQ
  • Seattle
  • 05:44 (UTC -07:00)
View GitHub Profile
@dreamiurg
dreamiurg / fabfile.py
Created July 22, 2011 09:03
fabfile.py with support of vagrant
from __future__ import with_statement
from fabric.api import local, settings, abort, run, cd, env, sudo
from fabric.colors import green as _green
from fabric.colors import yellow as _yellow
from fabric.colors import red as _red
from fabric.contrib.console import confirm
from fabric.contrib.project import rsync_project
from fabric.contrib.files import upload_template, exists
from fabric.operations import require
from fabric.context_managers import prefix
@dreamiurg
dreamiurg / .gitconfig
Created April 14, 2011 11:13
git configuration with BeyondCompare as difftool/mergetool and pretty log
[alias]
st = status
co = checkout
ci = commit
br = branch
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset' --abbrev-commit --date=relative
[color]
ui = auto
factorial1 n = if n == 0 then 1 else n * factorial1 (n-1)
factorial2 0 = 1
factorial2 n = n * factorial2 (n-1)
factorial3 n = foldr (*) 1 [1..n]
factorial4 = foldr (*) 1 . enumFromTo 1
void tokenize(const string& instr, Tokens& tokens)
{
// trim spaces & not valid chars
string str;
trim_acс trimmer(str);
for_each(instr.begin(), instr.end(), trimmer);
string::size_type numPos = str.find_first_of(NUMS, 0);
string::size_type endPos = str.find_first_not_of(NUMS, numPos);
string::size_type opPos;