Skip to content

Instantly share code, notes, and snippets.

edc /
Last active Nov 8, 2018
tensorflow + eGPU on Ubuntu

GPU Driver

Run sudo ubuntu-drivers devices to find what drivers are available, and then use apt to install the driver. In my case, it is apt install nvidia-driver-390. Reboot after installation completes, and use nvidia-smi command to ensure the driver is loaded.

Install Anaconda

Use Anaconda to simplify the process of installing tensorflow and related packages. Install it with wget and then execute it.

Install TensorFlow with GPU Support with Anaconda

edc /
Last active Jul 14, 2020 — forked from Willian-Zhang/
Install TensorFlow 1.8 on macOS High Sierra 10.13.6 with CUDA

Tensorflow 1.8 with CUDA on macOS High Sierra 10.13.6

Forked from @William-Zhang's gist


  • NVIDIA Web-Drivers 387. for 10.13.4 (17E199) (w/o Security Update)
  • CUDA-Drivers 387.128
  • CUDA 9.1 Toolkit
  • cuDNN 7.0.5 (latest for macOS)
edc /
Created Aug 28, 2015
Find big files committed recently in Git
# Taken from
RANGE=$1 # like '1.month.ago'
SIZE_THRESHOLD=$2 # size in bytes
# Iterate over a list of commits
for commit in $(${GIT_CMD} rev-list --all --since={${RANGE}} --pretty=oneline | cut -d' ' -f1); do
edc /
Created Jul 30, 2015
How to fail an import in tests
import mock
import sys
class Finder(object):
def find_module(self, name, path=None):
print name, path
raise ImportError
import threading
edc / clone-youtube-playlist.js
Last active Sep 21, 2018
Add a whole Youtube playlist to watch later - so you can clone the list easily
View clone-youtube-playlist.js
// this script copies a youtube playlist to the "watch later" list, so you can easily clone the
// list by creating a new one off the watch later list. You must run this on a playlist overview
// page like
// this script is meant to be converted into a bookmarklet, using something like
// after conversion, it becomes this:
// javascript:(function()%7Bvar%20buttons%20%3D%20document.querySelectorAll(%22button.addto-watch-later-button%22)%3Bvar%20videos%20%3D%20document.querySelectorAll(%22.playlist-video-item%22)%3Bif%20(videos.length%20!%3D%20buttons.length)%20%7Balert(%22Some%20videos%20are%20already%20in%20watch%20later!%20Found%20%22%20%2B%20videos.length%20%2B%20%22%20videos%20but%20%22%20%2B%20buttons.length%20%2B%20%22%20buttons.%20Abort%20now.%22)%3B%7D%20else%20%7Bif%20(confirm(%22Add%20%22%20%2B%20buttons.length%20%2B%20%22%20videos%3F%22))%20%7Bvar%20dialog%20%3D%20document.createElement(%22h1%22)%3Bdialog.innerHTML%20%3D
edc / gist:5520005
Created May 5, 2013
Boilerplate code for Core Data project
View gist:5520005
- (NSManagedObjectContext *) managedObjectContext {
if (_managedObjectContext != nil) {
return _managedObjectContext;
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
_managedObjectContext = [[NSManagedObjectContext alloc] init];
[_managedObjectContext setPersistentStoreCoordinator: coordinator];
edc /
Last active Dec 16, 2015
A simple bootstrap generator using virtualenv. It packs a standalone script (``), a run script (``) into the generated bootstrap script. The bootstrap script will also install dependency based on `requirements.txt`, and run the pip command in a controlled shell environment declared in `bootstrap.env`. The controlled environment allow…
import sys
import os
import json
import virtualenv
RUNSH = ''
REQUIREMENTS = 'requirements.txt'
BOOTSTRAPENV = 'bootstrap.env'
edc / Time stamp on photo
Created Feb 18, 2011
Add time stamp on photos for printing
View Time stamp on photo
echo Processing $1
SIZE=`convert -identify -ping $1 /dev/null | cut -d ' ' -f 3`
X=`echo $SIZE | cut -d 'x' -f 1`
Y=`echo $SIZE | cut -d 'x' -f 2`
X=`expr $X - 1500`
Y=`expr $Y - 100`
mv $1 _$1
set -o verbose
convert _$1 -font ~/Downloads/digital_7/digital-7-mono.ttf -pointsize 300 -fill red -annotate +$X+$Y %[exif:DateTimeOriginal] $1