Skip to content

Instantly share code, notes, and snippets.

View louisdecharson's full-sized avatar
🎯
Focusing

Louis de Charsonville louisdecharson

🎯
Focusing
View GitHub Profile
@szobov
szobov / config.el
Created January 18, 2021 07:48
emacs: Google-style docstring in python
(defun python-google-docstring ()
"Generate google-style docstring for python."
(interactive)
(if (region-active-p)
(progn
(call-process-region (region-beginning) (region-end) "python3" nil t t "/home/szobov/bin/scripts/format-g-docs.py")
(message "Docs are generated")
(deactivate-mark))
(message "No region active; can't generate docs!"))
)
@jdingel
jdingel / NBERwp_rename.sh
Last active July 10, 2019 20:51
Shell script to automatically rename downloaded NBER WP PDFs
#!/bin/bash
#This script searches the Downloads folder for NBER working papers (PDFs starting with "w2") and renames them in "Author - Title (NBER Year)"" format.
cd ~/Downloads
papers=$(find . -name "w2[0-9]*.pdf" | sed 's/^.\//\ /' | sed 's/.pdf//' | tr -d '\n')
echo "$papers"
for wp in $papers
do
curl https://www.nber.org/papers/$wp.ris > temp.txt
grep 'AU' temp.txt | awk -F- '{print $2}' | awk -F, '{printf $1 ","}' > temp2.txt
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs