Skip to content

Instantly share code, notes, and snippets.

(defun read-lines (filePath)
"Return a list of lines of a file at filePath."
(with-temp-buffer
(insert-file-contents filePath)
(split-string (buffer-string) "\n" t)))
(defun parse-spec (s)
(let ( (parsed (split-string s " " t) ) )
(list
def apply_processors(processors, df, callback=None):
def _callback(processor, df):
if callback is None:
return
callback(processor, df)
for fn in processors:
df = fn(df)
_callback(fn, df)
@mfcabrera
mfcabrera / installing_nvidia_driver_cuda_cudnn_linux.md
Created November 11, 2020 07:02 — forked from kmhofmann/installing_nvidia_driver_cuda_cudnn_linux.md
Installing the NVIDIA driver, CUDA and cuDNN on Linux

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.

@mfcabrera
mfcabrera / ansible-macos-homebrew-packages.yml
Created May 6, 2019 18:33 — forked from mrlesmithjr/ansible-macos-homebrew-packages.yml
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- 'atom'
- 'docker'
- 'dropbox'
- 'firefox'
@mfcabrera
mfcabrera / braking.md
Last active June 12, 2019 19:05
Theorie Test / Q & A - These are the more difficult questions. They are not all of the questions you may encounter on the test.

Braking

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
mfcabrera / unit-to-pytest.sh
Last active February 7, 2019 15:47
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
mfcabrera / install-tensorflow.sh
Last active November 20, 2016 20:20 — forked from erikbern/install-tensorflow.sh
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:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# I extened Erick using additional instructions from http://ramhiser.com/2016/01/05/installing-tensorflow-on-an-aws-ec2-instance-with-gpu-support/
# Install various packages
sudo apt-get update
sudo apt-get upgrade -y # choose “install package maintainers version”
;; Doopla
(defun doopla ()
(interactive)
(with-output-to-temp-buffer "*doopla*"
(shell-command "doopla 2>/dev/null &" "*doopla*" "*Messages*")
(pop-to-buffer "*doopla*")))
db.getCollection("all").stats(scale=1024*1024*2014)
{
"ns" : "group_category.all",
"count" : 2092188, //2 million
"size" : 23, //GB
"avgObjSize" : 23470 (~23 KB),
}
@mfcabrera
mfcabrera / gist:0296b7830c4009cd859c
Created November 2, 2015 09:57 — forked from mayoff/gist:1185476
Emacs Lisp to reload a URL in Chrome (using AppleScript)
(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 "