Skip to content

Instantly share code, notes, and snippets.

@eliangcs
eliangcs / ssh-config
Created Apr 10, 2014
Auto select SSH key
View ssh-config
# ~/.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 Aug 29, 2015
Scrapy dependencies on Ubuntu
View install_scrapy_dep.sh
sudo apt-get install -y gcc python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev build-essential
View sleekxmpp_client.py
#!/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 Aug 29, 2015
My Vim cheatsheet
View vim_cheatsheet.md

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 Dec 1, 2014
Common imports for IPython startup
View ipython_startup.py
# ~/.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 Aug 29, 2015
My oh-my-zsh theme
View arrow2.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 Aug 29, 2015
Export/import data from Vertica
View export_import_vertica.sql
-- 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 '|';
View vsql_commands.txt
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 Nov 5, 2011
Creating a Triangle Mesh with 3ds Max SDK
View gist:1341253
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 Sep 24, 2013
phpmyadmin on Nginx
View gist:6682975
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;