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 json | |
import functools | |
class Property: | |
def __init__(self, name, descr_or_enum, required=False): | |
self.name = name | |
self.descr_or_enum = descr_or_enum | |
self.required = required | |
def to_dict(self): |
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
""" | |
Schedule Work Breakdown Structure Uncertainty with Monte Carlo Simulations | |
""" | |
import numpy as np | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
def simulate(wbs, n=100000, proba=0.9): | |
""" Simulate the possible completion time of a WBS project. | |
Parameters |
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
sudo apt-get install pdftk poppler-utils texlive-extra-utils | |
# Merge | |
pdfunite in-1.pdf in-2.pdf in-n.pdf out-merged.pdf | |
# Rotate | |
# 1-endnorth |
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 numpy as np | |
import pandas as pd | |
from scipy.io import loadmat | |
def mat2csv(file_mat, index=False): | |
mat = loadmat(file_mat, squeeze_me=True) | |
for colname in mat.keys(): | |
# ignore private column names | |
if colname.startswith("__"): |
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
#include <vector> | |
#include <boost/dynamic_bitset.hpp> | |
namespace morton { | |
/** | |
Interleaves a vector of bitsets into a unique bitset. | |
@param axes the vector of axis. | |
@return a interleaved bitset. | |
*/ |
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
# -*- coding: utf-8 -*- | |
import pandas as pd | |
from shapefile import Reader as read_shp | |
def shp_to_df(shp_filepath): | |
data = {} | |
shp = read_shp(shp_filepath) | |
fields = shp.fields[1:] # Skip 'DeletionFlag' | |
records = shp.records() | |
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
def arithmetic_features(X, operations=['+', '-', '/', '*'], commutative=False, inplace=False): | |
df = X | |
if not inplace: | |
df = X.copy() | |
from itertools import combinations | |
for x, y in combinations(df.columns, 2): | |
if '+' in operations: | |
df['%s+%s' % (x, y)] = df[x] + df[y] |
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
# Functions | |
__err() { echo -e "\033[31mError:\033[0m $1"; exit; } | |
__warn(){ echo -e "\033[33mWarn :\033[0m $1"; } | |
__info(){ echo -e "\033[34mInfo :\033[0m $1"; } | |
# Use | |
__err "You must be root." | |
__warn "Missing temp file" | |
__info "Copying 'x' file" |