Skip to content

Instantly share code, notes, and snippets.

View farazdagi's full-sized avatar

Victor Farazdagi farazdagi

View GitHub Profile
@farazdagi
farazdagi / distributed-systems-reasources.md
Last active August 29, 2015 14:12
Distributed Systems: Amazing Resources

Distributed Systems: Amazing Resources

A list of amazing resources related to Distributed Systems.

Projects

Some noteworthy projects.

### Keybase proof
I hereby claim:
* I am farazdagi on github.
* I am farazdagi (https://keybase.io/farazdagi) on keybase.
* I have a public key whose fingerprint is 0F9C BFAE 03CD 209B 51E7 D19F BA58 0291 4C6B 4732
To claim this, I am signing this object:
@farazdagi
farazdagi / bitonic.go
Created September 3, 2015 15:22
Bitonic Sorter in Go
package bitonic
const (
SORT_ASC bool = true
SORT_DESC bool = false
)
var lst []int
func Sort(input []int, dir bool) {
@farazdagi
farazdagi / gist:b60972f006fb272c2fc8
Last active September 12, 2015 12:07 — forked from siddarth/gist:6241382
Stripe FX: Getting the converted amount from the BalanceTransaction

Creating a USD charge on a GBP account:

$ curl https://api.stripe.com/v1/charges \
    -u REDACTED: \
    -d amount=400 \
    -d currency=usd \
    -d card[number]=4242424242424242 \
    -d card[exp_month]=04 \
    -d card[exp_year]=16 \

-d card[cvv]=390 \

@farazdagi
farazdagi / gist:846403
Created February 27, 2011 18:37
Mark WSGI file type = python
" WSGI, syntax highlight as python
au BufNewFile,BufRead *wsgi set filetype=python
@farazdagi
farazdagi / gist:964207
Created May 10, 2011 10:00
Vim gitcommit filetype syntax
" Git Syntax Highlighting
hi gitcommitSummary guifg=#8ac6f2 gui=none
hi gitcommitOnBranch guifg=#99968b gui=italic
hi gitcommitBranch guifg=#FFCC66 gui=none
hi gitcommitHeader guifg=#C4C4C4 gui=none
hi gitcommitDiscardedType guifg=#99968b gui=none
hi gitcommitSelectedType guifg=#99968b gui=none
hi gitcommitUnmergedType guifg=#99968b gui=none
@farazdagi
farazdagi / svn-add.sh
Created May 19, 2011 09:27
Svn add only non-tracked files
svn st --ignore-externals | grep ^? | sed 's/\?/svn add/' | sh
@farazdagi
farazdagi / gist:1045809
Created June 24, 2011 22:29
Fix mongodb after unclean shutdown
sudo rm /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo start mongodb
sudo status mongodb
@farazdagi
farazdagi / check-image-loaded.js
Created June 25, 2011 20:18
check if image loaded using jQuery
var image = $(document.createElement("img"))
.height("100px")
.width("100px")
.hide()
.load(function () { // show image only if it is loaded ok
$(this).show();
});
// box is some div having background image (which serves as default if image above is not loaded)
box.append(image);
@farazdagi
farazdagi / gist:1073753
Created July 9, 2011 17:02
paginator compatible with pymongo and mongoengine
# pagination.py
class Paginator(object):
def __init__(self, query, per_page):
"""Initialize a paginator.
Arguments:
- query -- queryset from pymongo or mongoengine
- per_page -- number of items per page