Skip to content

Instantly share code, notes, and snippets.

View day2.el
(defun read-lines (filePath)
"Return a list of lines of a file at filePath."
(insert-file-contents filePath)
(split-string (buffer-string) "\n" t)))
(defun parse-spec (s)
(let ( (parsed (split-string s " " t) ) )
def apply_processors(processors, df, callback=None):
def _callback(processor, df):
if callback is None:
callback(processor, df)
for fn in processors:
df = fn(df)
_callback(fn, df)

Installing the NVIDIA driver, CUDA and cuDNN on Linux (Ubuntu 20.04)

This is a companion piece to my instructions on building TensorFlow from source. In particular, the aim is to install the following pieces of software

on an Ubuntu Linux system, in particular Ubuntu 20.04.

View ansible-macos-homebrew-packages.yml
- name: Install MacOS Packages
hosts: localhost
become: false
- 'atom'
- 'docker'
- 'dropbox'
- 'firefox'
mfcabrera /
Last active Jun 12, 2019
Theorie Test / Q & A - These are the more difficult questions. They are not all of the questions you may encounter on the test.


Standard Braking Distance

  • DE: (Geschwindigkeit / 10) * (Geschwindigkeit / 10)
  • EN: (Speed / 10) * (Speed / 10)

Evasive (Emergency) Braking Distance

  • DE: ((Geschwindigkeit / 10) * (Geschwindigkeit / 10)) / 2
  • EN: ((Speed / 10) * (Speed / 10)) / 2
mfcabrera /
Last active Feb 7, 2019
Sed commands to change from Unittest assertion to pytest style
sed -i ".bak" -E 's/self\.assertFalse\((.*)\)/assert not \1/g' tests/*.py
sed -i ".bak" -E 's/self\.assertTrue\((.*)\)/assert \1/g' tests/*.py
sed -i ".bak" -E 's/self\.assertEqual\(([^,]*), (.*)\)$/assert \1 == \2/g' tests/*.py
sed -i ".bak" -E 's/self\.assertIn\(([^,]*), (.*)\)$/assert \1 in \2/g' tests/*.py
sed -i ".bak" -E 's/self\.assertNotEqual\(([^,]*), (.*)\)$/assert \1 != \2/g' tests/*.py
sed -i ".bak" -E 's/self\.assertNotIn\(([^,]*), (.*)\)$/assert \1 not in \2/g' tests/*.py
sed -i ".bak" -E 's/self\.assertIsNone\((.*)\)$/assert \1 is None/g' tests/*.py
sed -i ".bak" -E 's/self\.assertIsNotNone\((.*)\)$/assert \1 is not None/g' tests/*.py
sed -i ".bak" -E 's/self\.assertAlmostEqual\(([^,]*), (.*)\)$/\2 == pytest.approx\(\1\)/g' tests/*.py
mfcabrera /
Last active Nov 20, 2016 — forked from erikbern/
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
# This install Tensorflow 0.11, Cuda 8.0 and cudnn-8.0
# The CUDA part is mostly based on this excellent blog post:
# I extened Erick using additional instructions from
# Install various packages
sudo apt-get update
sudo apt-get upgrade -y # choose “install package maintainers version”
View doopla.el
;; Doopla
(defun doopla ()
(with-output-to-temp-buffer "*doopla*"
(shell-command "doopla 2>/dev/null &" "*doopla*" "*Messages*")
(pop-to-buffer "*doopla*")))
View test.js
"ns" : "group_category.all",
"count" : 2092188, //2 million
"size" : 23, //GB
"avgObjSize" : 23470 (~23 KB),
mfcabrera / gist:0296b7830c4009cd859c
Created Nov 2, 2015 — forked from mayoff/gist:1185476
Emacs Lisp to reload a URL in Chrome (using AppleScript)
View gist:0296b7830c4009cd859c
(defun mayoff:open-url-in-chrome (url)
"Open URL in Google Chrome. I use AppleScript to do several things:
1. I tell Chrome to come to the front. If Chrome wasn't launched, this will also launch it.
2. If Chrome has no windows open, I tell it to create one.
3. If Chrome has a tab showing URL, I tell it to reload the tab, make that tab the active tab in its window, and bring its window to the front.
4. If Chrome has no tab showing URL, I tell Chrome to make a new tab (in the front window) showing URL."
(when (symbolp url)
; User passed a symbol instead of a string. Use the symbol name.
(setq url (symbol-name url)))
(do-applescript (format "