Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
graylevel = 1.0 
mpl.rc('figure', facecolor = (graylevel, graylevel, graylevel), edgecolor ='r')
%pylab inline
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.define :ejabberdbox do |ejabberdbox_config|
ejabberdbox_config.vm.box = 'precise64'
ejabberdbox_config.vm.box_url = "http://dl.dropbox.com/u/1537815/precise64.box"
@jassinm
jassinm / .ycm_extra_conf.py
Last active May 1, 2016 14:20
youcompleteme c
import os
import ycm_core
from clang_helpers import PrepareClangFlags
compilation_database_folder = ''
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-Wall',
@jassinm
jassinm / .ycm_extra_conf.py
Last active April 7, 2020 04:05
c++11 youcompleteme
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
std::vector<std::string> split(const std::string &s, const std::string &tosplit){
const std::regex rsplit(tosplit + "+");
auto rit = std::sregex_token_iterator(s.begin(), s.end(), rsplit, -1);
auto rend = std::sregex_token_iterator();
auto res = std::vector<std::string>(rit, rend);
return res;
}
xen-create-image --hostname ubuntu.dev --size=30G --swap=1G --dhcp --memory=8192Mb --mirror=http://archive.ubuntu.com/ubuntu/ --lvm server --dist=precise --passwd --force
@jassinm
jassinm / gist:3200136
Created July 29, 2012 16:44
scipy , numpy , matplotlib on clean install mac osx 10.8 mountain lion
brew install python
easy_install pip
#install scipy use temp branch
pip install git+https://github.com/minrk/scipy-1.git@accelerate
#ft2build.h not found ==>
pip install git+git://github.com/matplotlib/matplotlib.git
@jassinm
jassinm / mongocleanup.py
Created June 15, 2012 14:53
Clean's up a nested structure for mongo
import re
def mongo_cleanup(item, replacement=''):
"""clean's a nested structure keys to adapt to mongodb's
legal keys
see http://www.mongodb.org/display/DOCS/Legal+Key+Names """
if hasattr(item, 'items'):
newdict = {}
for key, value in item.items():
nkey = key
@jassinm
jassinm / helpers.py
Created June 6, 2012 21:01
dumps a json including dates
dthandler = lambda obj: obj.isoformat() if isinstance(obj, datetime.datetime) else None
def jsonify(data):
return Response(json.dumps(data, default=dthandler))
(defn send_multipart [socket iter]
(map mq/send-more (repeat socket) (pop iter))
(mq/send socket (last iter)))