This file contains 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
""" | |
Python Singleton with parameters (so the same parameters get you the same object) | |
with support to default arguments and passing arguments as kwargs (but no support for pure kwargs). | |
And implementation for MongoClient class from pymongo package. | |
""" | |
from pymongo import MongoClient | |
import inspect | |
This file contains 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 pickle | |
import atexit | |
from threading import Thread, Condition, Lock | |
class PerlineSaver(object): | |
def __init__(self, save_file, index_file): | |
self.save_file = save_file | |
self.index_file = index_file |
This file contains 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
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# Must use Powerline font, for \uE0A0 to render. | |
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$FG[013]%}\uE0A0 " | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}‹" |
This file contains 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
use std::ops::Index; | |
pub struct MaskedArray<'a, T> { | |
pub data: &'a Vec<T>, | |
mask: Vec<usize>, | |
} | |
impl<'a, T> MaskedArray<'a, T> { | |
pub fn new(data: &Vec<T>, mask: Vec<usize>) -> MaskedArray<T> { |
This file contains 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 pandas as pd | |
from itertools import chain | |
from collections import namedtuple | |
# Comes from : https://github.com/eric-heiden/mocap-roboschool-demo/blob/master/mocap_demo.py line 19-35 | |
def get_frames(filename): | |
# filename : amc file | |
frames = [] # list of dicts {property: value(s)} | |
current_frame = {} |
This file contains 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
#!/bin/bash | |
# Uninstall Cuda 9 | |
sudo apt-get --purge remove cuda | |
sudo apt autoremove | |
sudo apt-get clean | |
# install CUDA Toolkit v8.0 | |
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" |