Skip to content

Instantly share code, notes, and snippets.

View bhpayne's full-sized avatar
💭
wandering in the wilderness

Ben bhpayne

💭
wandering in the wilderness
View GitHub Profile
@bhpayne
bhpayne / latency.txt
Created May 27, 2023 23:23 — 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
@bhpayne
bhpayne / scar_tissue.md
Created May 27, 2023 16:56 — forked from gtallen1187/scar_tissue.md
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@bhpayne
bhpayne / duck.sty
Created December 31, 2022 20:30 — forked from cereda/duck.sty
Sample duck package
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{duck}[2012/18/07 Duck style for memoir]
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{tikz}
\RequirePackage{xspace}
\definecolor{cffffff}{RGB}{255,255,255}
\definecolor{cffcc00}{RGB}{255,204,0}

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@bhpayne
bhpayne / README.md
Created June 18, 2022 13:54
screenshots in mac osx with timer

For the impatient:

  1. determine the relative coordinates for the cropped screenshot
  2. determine the coordinates of the mouse click
  3. compile click.m using cc
  4. run the shell script

Schedule a variable number of people into a variable number slots for multiple time steps.

Maximize for diversity of slots per person.

Not optimal

@bhpayne
bhpayne / delete_large_file.md
Created June 14, 2021 16:09
fake git history for testing file deletion

Following command edits the bare repo (rather than a clone of the repo)

cd bare_git_repo
git filter-branch --prune-empty -d /Users/username/software/git_test/git_backup --index-filter "git rm --cached -f --ignore-unmatch a_large_binary" --tag-name-filter cat -- --all

Then run the following on the bare repo

git update-ref -d refs/original/refs/heads/master
git reflog expire --expire=now --all
git gc --prune=now
@bhpayne
bhpayne / Dockerfile
Last active May 8, 2021 18:56
concurrent pathos password search
FROM centos:7
RUN yum install -y \
python3-devel
RUN pip3 install setuptools_rust && \
pip3 install cryptography==3.2 && \
pip3 install msoffcrypto-tool
RUN pip3 install pathos