a
: after cursori
: before cursorA
: after lineI
: before lineo
: add a new line belowO
: add a new line above
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
# ~/.ipython/profile_default/startup/00_common.py | |
import base64 | |
import codecs | |
import cPickle as pickle | |
import cStringIO as StringIO | |
import csv | |
import hashlib | |
import importlib | |
import json | |
import math |
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
# Forked from https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/arrow.zsh-theme | |
git_describe() { | |
echo $(git describe --tag 2> /dev/null) | |
} | |
my_git_prompt_info() { | |
prompt=$(git_prompt_info) | |
if [ ! -z "$prompt" ]; then | |
echo "$(git_describe) ($(git_prompt_info))" |
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
-- Export | |
\a -- Disable alignment | |
\t -- Disable column header | |
\o output.txt -- Set output filename | |
SELECT * FROM table; -- Select the data to export | |
-- Import | |
COPY table FROM '/path/to/output.txt' DELIMITER '|'; |
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 logging | |
import time | |
from celery import shared_task as orig_shared_task | |
def timeit(func): | |
"""A decorator used to log the function execution time.""" | |
logger = logging.getLogger('tasks') |
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
See the Vertica Programmer's Guide for information on available commands. | |
General | |
\c[onnect] [DBNAME|- [USER]] | |
connect to new database (currently "localdev") | |
\cd [DIR] change the current working directory | |
\q quit vsql | |
\set [NAME [VALUE]] | |
set internal variable, or list all if no parameters | |
\timing toggle timing of commands (currently off) |
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
# Clear local merged branches | |
function clearbranches(){ | |
cur_branch=`git rev-parse --abbrev-ref HEAD` | |
if [[ "$cur_branch" == "master" ]]; then | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d | |
else | |
echo "Not on master branch!" | |
fi | |
} |
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
""" | |
A minimal web server that runs shell commands, powered by Tornado and its | |
Subprocess module. It does non-blocking IO and streams the response. | |
To start the server: | |
$ python tornado_subprocess.py | |
To send a shell command using httpie: |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.background { | |
fill: #e7e7e7; | |
} | |
.axis path, | |
.axis line { |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.svg { | |
border: 1px solid #000; | |
} | |
.result { | |
color: #05c; |