This file contains hidden or 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 time | |
import random | |
# fill the input list | |
a = [random.randrange(0,130) for x in range(10**6)] | |
# std sort, keep a unsorted | |
t = time.time() | |
b = sorted(a) | |
print(time.time() - t) |
This file contains hidden or 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
# subcommunities.py | |
import sys | |
sys.modules['__main__'].__dict__.update({ | |
'PyCon': type('PyCon', (object,), {}), | |
'numpy': type('numpy', (object,), {'infty': 'foo'}), | |
'pythonistas': type('Foo', (object,), {'enjoy': lambda x: x, 'fun': 'foo'}) | |
}) | |
sys.modules['subcommunities'] = list() | |
sys.modules['numpy.nifty'] = 'foo' |
This file contains hidden or 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 nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
" Plugins begin | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-fugitive' |
This file contains hidden or 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 | |
osascript <<EOF | |
tell application "Terminal" | |
activate | |
set _tab to do script "telnet 127.0.0.1 2001 ; exit" | |
delay 1 | |
repeat while _tab exists | |
delay 1 | |
end repeat |
This file contains hidden or 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
PREFIX=projectA #adjust this | |
TAB=$'\t' | |
git filter-branch --index-filter ' | |
git ls-files -s | | |
sed "s,${TAB},&"$PREFIX"/," | | |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && | |
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE | |
' HEAD |
This file contains hidden or 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 | |
VENV=$1 | |
if [ -z $VENV ]; then | |
echo "usage: runinenv [virtualenv_path] CMDS" | |
exit 1 | |
fi | |
. ${VENV}/bin/activate | |
if [ -f ${VENV}/bin/postactivate ]; then | |
. ${VENV}/bin/postactivate |
This file contains hidden or 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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="masci" | |
# Example aliases |
This file contains hidden or 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
[user] | |
name = Massimiliano Pippi | |
email = [email protected] | |
signingkey = 22AA96CA | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch |
This file contains hidden or 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/python | |
""" | |
PyMol Widget | |
Usage: | |
main.py [input_files] | |
Options: | |
-h, --help: print this screen | |
""" |
This file contains hidden or 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
function _virtualenv_prompt_info { | |
[[ -n $(whence virtualenv_prompt_info) ]] && virtualenv_prompt_info | |
} | |
function _git_prompt_info { | |
[[ -n $(whence git_prompt_info) ]] && git_prompt_info | |
} | |
function _python_ver { | |
[[ -n $(/usr/bin/env python --version) ]] && python_ver |