Skip to content

Instantly share code, notes, and snippets.

View farazdagi's full-sized avatar

Victor Farazdagi farazdagi

View GitHub Profile
@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
@farazdagi
farazdagi / jsonp-in-flask.py
Created July 18, 2011 15:54
JSONP in Flask
import json
from functools import wraps
from flask import redirect, request, current_app
def support_jsonp(f):
"""Wraps JSONified output for JSONP"""
@wraps(f)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', False)
if callback:
@farazdagi
farazdagi / list_crons.sh
Created August 17, 2011 11:49
List cron jobs for all users
#!/bin/bash
# see http://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users/137173#137173
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
@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: