Skip to content

Instantly share code, notes, and snippets.

@eliangcs
eliangcs / ssh-config
Created April 10, 2014 02:12
Auto select SSH key
# ~/.ssh/config
Host *.compute-1.amazonaws.com
IdentityFile ~/.ssh/us-east-1.pem
Host *.ap-northeast-1.compute.amazonaws.com
IdentityFile ~/.ssh/ap-northeast-1.pem
@eliangcs
eliangcs / install_scrapy_dep.sh
Last active August 29, 2015 14:01
Scrapy dependencies on Ubuntu
sudo apt-get install -y gcc python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev build-essential
@eliangcs
eliangcs / sleekxmpp_client.py
Created May 13, 2014 04:08
Sleekxmpp example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
@eliangcs
eliangcs / vim_cheatsheet.md
Last active August 29, 2015 14:10
My Vim cheatsheet

Insert

  • a: after cursor
  • i: before cursor
  • A: after line
  • I: before line
  • o: add a new line below
  • O: add a new line above

Select

@eliangcs
eliangcs / ipython_startup.py
Created December 1, 2014 22:05
Common imports for IPython startup
# ~/.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
@eliangcs
eliangcs / arrow2.zsh-theme
Last active August 29, 2015 14:16
My oh-my-zsh theme
# 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))"
@eliangcs
eliangcs / export_import_vertica.sql
Last active August 29, 2015 14:17
Export/import data from Vertica
-- 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 '|';
@eliangcs
eliangcs / vsql_commands.txt
Last active August 29, 2015 14:27
vsql info
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)
@eliangcs
eliangcs / gist:1341253
Created November 5, 2011 07:57
Creating a Triangle Mesh with 3ds Max SDK
TriObject *createTriangleMesh(const std::vector<Point3> &points,
const std::vector<Point3> &normals,
const std::vector<Point2> &uvs,
const std::vector<int> &triangleVertIndices)
{
TriObject *triobj = CreateNewTriObject();
if (triobj == NULL)
return NULL;
assert(points.size() == normals.size() && normals.size() == uvs.size());
@eliangcs
eliangcs / gist:6682975
Created September 24, 2013 10:32
phpmyadmin on Nginx
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;