Skip to content

Instantly share code, notes, and snippets.

Avatar

Morten Back Nielsen void32

View GitHub Profile
@void32
void32 / smart copy.py
Last active May 16, 2019
Copy from src to dst, with option to make make parent folders and overwrite dst
View smart copy.py
def copy_smart(src, dst, make_parents=True, overwrite=False, dry_run=False):
""" Copy from src to dst, with option to make make parent folders and overwrite dst """
if not os.path(dst):
if os.path.exists(dst):
if not overwrite:
return False
if make_parents:
# Make parent directories as needed
local_dir_path = os.path.dirname(dst)
@void32
void32 / mkdir_p.py
Last active Apr 11, 2019
mkdir -p' in Python
View mkdir_p.py
def mkdir_p(path):
""" 'mkdir -p' in Python """
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
@void32
void32 / rm_rf.py
Last active Apr 11, 2019
Recursively remove paths as rm -rf [FILE]...
View rm_rf.py
import glob
import os
import shutil
def rm_rf(path):
""" 'rm -rf' in Python """
fp_list = glob.glob(path)
for fp in fp_list:
if os.path.islink(fp):
@void32
void32 / DoneList.py
Created Dec 18, 2018
Python class to record a GUID as done processed
View DoneList.py
class DoneList:
FILE_NAME = 'done_list.txt'
def __init__(self):
self.done_set = set()
# Load file ...
try:
with open(DoneList.FILE_NAME, "r") as fp:
for line in fp:
annotation_id = line.strip()
@void32
void32 / installing_caffe.md
Created Jul 20, 2018 — forked from nikitametha/installing_caffe.md
Installing Caffe on Ubuntu 16.04 and above (CPU ONLY, WITHOUT CUDA OR GPU SUPPORT)
View installing_caffe.md

This is a guide on how to install Caffe for Ubuntu 16.04 and above, without GPU support (No CUDA required).

Prerequisites:

OpenCV

sudo apt-get install libopencv-dev python-opencv

OpenBLAS OR Atlas