This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decorator import decorator | |
from line_profiler import LineProfiler | |
@decorator | |
def profile_each_line(func, *args, **kwargs): | |
profiler = LineProfiler() | |
profiled_func = profiler(func) | |
try: | |
return profiled_func(*args, **kwargs) | |
finally: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"flag" | |
"encoding/xml" | |
) | |
type Offer struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
from html5lib import HTMLParser | |
from html5lib.tokenizer import HTMLTokenizer | |
from html5lib.sanitizer import HTMLSanitizerMixin | |
class WysiwygSanitizerMixin(HTMLSanitizerMixin): | |
allowed_elements = ['b','i','strong', 'em', 'strike', 'a'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
from django.conf import settings | |
from django.conf.urls import patterns, include, url | |
from django.http import HttpResponse | |
filename = os.path.splitext(os.path.basename(__file__))[0] | |
urlpatterns = patterns('', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
virtualenv_auto_activate() { | |
GITPATH=`git rev-parse --show-toplevel 2>/dev/null` | |
if [[ "$GITPATH" != "" ]] | |
then | |
if [[ "$VIRTUAL_ENV" == "" ]] | |
then | |
[ -f $GITPATH"/python/bin/activate" ] && source $GITPATH"/python/bin/activate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import django | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") | |
django.setup() | |
# write your code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set list | |
set expandtab | |
retab 4 | |
set shiftwidth=4 | |
set tabstop=4 | |
syntax on | |
set nu | |
set ai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pathspec.match_files(map(pathspec.GitIgnorePattern, ["*.css", "!*.ie.css"]), ["styles.css", "styles.ie.css", ".tmp"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readline | |
texts = ['hello', 'world', 'readline'] | |
def completer(text, state): | |
options = [x for x in texts if x.startswith(text)] | |
try: | |
return options[state] | |
except IndexError: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# save it to "/etc/init.d/vagrant-boxes" | |
# sudo update-rc.d vagrant-boxes defaults 99 01 | |
RETVAL=0 | |
USER='ilya' | |
stop() { | |
LIST=`sudo -u $USER vagrant global-status | grep running | awk '{print $1}'` | |
for i in `echo $LIST`; do |
OlderNewer