Skip to content

Instantly share code, notes, and snippets.

@salotz
salotz / latency.txt
Created April 24, 2020 15:31 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@salotz
salotz / python-daemon_apscheduler.py
Created April 4, 2020 04:50 — forked from timss/python-daemon_apscheduler.py
A combination of python-daemon and APScheduler
#!/usr/bin/env python
import apscheduler.scheduler
import daemon.runner
import os.path
import sys
import time
class Core():
def __init__(self):
@salotz
salotz / automation.md
Created October 10, 2018 06:43 — forked from cube-drone/automation.md
Automation For The People

Automation for the People

Long ago, the first time I read "The Pragmatic Programmer", I read some advice that really stuck with me.

"Don't Use Manual Procedures".

This in the chapter on Ubiquitous Automation. To summarize, they want you to automate all the things.

The trouble was that I hadn't much of an idea how to actually go

@salotz
salotz / install-docker-deb9.sh
Created June 17, 2018 18:28 — forked from upbeta01/install-docker-deb9.sh
Install Docker In Debian 9 (Stretch)
#!/bin/bash
#
# -----------------------
#
# This is a script that installs docker-ce (Docker Community Edition) on Debian 9
# Inspired by https://gist.github.com/frgomes/a6f889583860f5b330c06c8b46fa0f42
#
# -----------------------
# Pre-requesite
@salotz
salotz / Abbreviate Journal Names in Bibtex Database.py
Created December 19, 2017 22:08 — forked from FilipDominec/Abbreviate Journal Names in Bibtex Database.py
Using the translation table from the Jabref program, finds and replaces all scientific journal names to their standardized abbreviated form. First argument is the file to be processed; outputs safely to 'abbreviated.bib'
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Supporting Python 3
import sys, os, re
try: bibtexdb = open(sys.argv[1]).read()
except: print("Error: specify the file to be processed!")
if not os.path.isfile('journalList.txt'):
@salotz
salotz / colormaputil.py
Created October 7, 2015 01:08
Matplotlib colormap utility functions: get_cmap, array_cmap, truncate_colormap, stack_colormap, band_colormap .
#...............................................................................
""" new colormaps from old: stack, truncate builtin cmaps / files / numpy arrays
What's a colormap or cmap in matplotlib ?
Mainly a bar or array of 256 colors, rgb or rgba values 0 .. 1,
used in
pl.imshow( a 2d numpy array, cmap=cmap, ... )
pl.colorbar()
Cmaps can be indexed with () like
cmap( .25 ), cmap( [0, .25, .5] ), cmap( np.linspace( ... ))