Skip to content

Instantly share code, notes, and snippets.

@hxu
hxu / Vagrantfile
Created August 13, 2014 15:07
Ubuntu 64 Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
require 'rbconfig'
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@hxu
hxu / provision.sh
Created August 13, 2014 15:05
Base provisioner for Ubuntu vagrant
sudo apt-get update
sudo apt-get -y install build-essential python-dev python-setuptools python-virtualenv python-pip vim tmux htop git libffi-dev libxml2-dev libxslt1-dev curl python-software-properties software-properties-common
@hxu
hxu / gist:43aa9c99acea0e37ad75
Created May 25, 2014 09:26
Starter base template
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Title{% endblock title %}</title>
<!-- STYLES GO HERE -->
#!/bin/bash
# For bootstrapping the Vagrant box with Ansible, then provisioning the rest of the box with Ansible
# This is because Ansible is not supported in Windows, so we can't use the Ansible provisioner directly
# with Vagrant.
# Taken from and https://github.com/geerlingguy/JJG-Ansible-Windows
# Windows shell provisioner for Ansible playbooks, based on KSid's
# windows-vagrant-ansible: https://github.com/KSid/windows-vagrant-ansible
@hxu
hxu / logger.py
Created January 23, 2014 03:58
Generic python logger setup
import logging
logger = logging.getLogger('log')
logger.setLevel(logging.DEBUG)
log_formatter = logging.Formatter('%(asctime)s - %(module)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
# Log to file
logfile = logging.FileHandler('run.log')
logfile.setLevel(logging.DEBUG)
logfile.setFormatter(log_formatter)
@hxu
hxu / setup.sh
Last active January 2, 2016 08:39
Scientific Python stack on GCE Debian / AWS Ubuntu
sudo apt-get update
# General utilities
sudo apt-get install vim tmux less
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
# Need to edit .bashrc to set up the virtualenv(wrapper) paths: