Skip to content

Instantly share code, notes, and snippets.

@mmourafiq
mmourafiq / latency.txt
Created June 19, 2023 19:06 — 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
@mmourafiq
mmourafiq / fastbook.py
Created February 22, 2023 10:01 — forked from dbieber/fastbook.py
fastbook speeds up the silence in audiobooks, and can speed up the non-silence too
"""Performs automatic speed edits to audio books.
Example usage:
Assuming you have an audiobook book.aax on your Desktop:
1. Convert it to wav:
ffmpeg -i ~/Desktop/book.aax ~/Desktop/book.wav
2. Adjust the speed:
# https://github.com/lotharschulz/akkahttp-playground/releases/tag/0.0.6-minikube-lb-ing-presentation-leipzig
# prerequsites: scala, sbt, docker, minikube, kubectl, local registry, project's docker images in local registry
kubectl create -f minikube-deployment-config.yaml
kubectl expose deployment akkahttpplayground-deployment --type="LoadBalancer" --port=8181 -target-port=8181
minikube service akkahttpplayground-deployment # opens browser window
minikube addons enable ingress
kubectl create -f minikube-ingress.yaml
echo "$(minikube ip) myminikube.info" | sudo tee -a /etc/hosts
# check the service
@mmourafiq
mmourafiq / akmtdfgen.py
Created August 5, 2017 10:17 — forked from timehaven/akmtdfgen.py
kmtdfgen: Keras multithreaded dataframe generator
"""akmtdfgen: A Keras multithreaded dataframe generator.
Works with Python 2.7 and Keras 2.x.
For Python 3.x, need to fiddle with the threadsafe generator code.
Test the generator_from_df() functions by running this file:
python akmtdfgen.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class FeederConfig(object):
"""The FeederConfig holds information needed to create data feeders for training and evaluating.
@mmourafiq
mmourafiq / RLbyDavidSilverNotes.ipynb
Created April 8, 2017 10:57 — forked from ntaylorwss/RLbyDavidSilverNotes.ipynb
Notes on David Silver's RL course
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mmourafiq
mmourafiq / labels_1024.tsv
Created March 2, 2017 11:09 — forked from teamdandelion/labels_1024.tsv
TensorBoard: TF Dev Summit Tutorial
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
7
2
1
0
4
1
4
9
5
9
@mmourafiq
mmourafiq / company-ownership.md
Created January 18, 2017 15:13 — forked from jdmaturen/company-ownership.md
Who pays when startup employees keep their equity?

Who pays when startup employees keep their equity?

JD Maturen, 2016/07/05, San Francisco, CA

As has been much discussed, stock options as used today are not a practical or reliable way of compensating employees of fast growing startups. With an often high strike price, a large tax burden on execution due to AMT, and a 90 day execution window after leaving the company many share options are left unexecuted.

There have been a variety of proposed modifications to how equity is distributed to address these issues for individual employees. However, there hasn't been much discussion of how these modifications will change overall ownership dynamics of startups. In this post we'll dive into the situation as it stands today where there is very near 100% equity loss when employees leave companies pre-exit and then we'll look at what would happen if there were instead a 0% loss rate.

What we'll see is that employees gain nearly 3-fold, while both founders and investors – particularly early investors – get dilute

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@mmourafiq
mmourafiq / docker.sock.plist
Created December 28, 2016 13:03
MacOS script to start docker sock for Jetbrains docker integration with Docker for Mac.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>docker.sock</string>
<!-- This file should be ~/Library/LaunchAgents/docker.sock.plist -->
<!-- Start with: launchctl load ~/Library/LaunchAgents/docker.sock.plist -->
<!-- Configure jetbrains with tcp://localhost:2375 -->