Skip to content

Instantly share code, notes, and snippets.

View void32's full-sized avatar

Morten Back Nielsen void32

View GitHub Profile
@void32
void32 / installing_caffe.md
Created July 20, 2018 10:58 — forked from nikitametha/installing_caffe.md
Installing Caffe on Ubuntu 16.04 and above (CPU ONLY, WITHOUT CUDA OR GPU SUPPORT)

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

@void32
void32 / DoneList.py
Created December 18, 2018 07:02
Python class to record a GUID as done processed
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 / rm_rf.py
Last active April 11, 2019 07:09
Recursively remove paths as rm -rf [FILE]...
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 / mkdir_p.py
Last active April 11, 2019 07:09
mkdir -p' in Python
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 / smart copy.py
Last active May 16, 2019 11:30
Copy from src to dst, with option to make make parent folders and overwrite dst
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)