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."
(with-temp-buffer
(insert-file-contents filePath)
(split-string (buffer-string) "\n" t)))
(defun parse-spec (s)
(let ( (parsed (split-string s " " t) ) )
(list
View apply_processors.py
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)
View installing_nvidia_driver_cuda_cudnn_linux.md

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
vars:
brew_cask_packages:
- 'atom'
- 'docker'
- 'dropbox'
- 'firefox'
@mfcabrera
mfcabrera / braking.md
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.
View braking.md

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 Feb 7, 2019
Sed commands to change from Unittest assertion to pytest style
View unit-to-pytest.sh
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 Nov 20, 2016 — forked from erikbern/install-tensorflow.sh
Installing TensorFlow on EC2
View install-tensorflow.sh
# 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”
View doopla.el
;; Doopla
(defun doopla ()
(interactive)
(with-output-to-temp-buffer "*doopla*"
(shell-command "doopla 2>/dev/null &" "*doopla*" "*Messages*")
(pop-to-buffer "*doopla*")))
View test.js
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 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 "