Skip to content

Instantly share code, notes, and snippets.

View cooperpellaton's full-sized avatar
👨‍🎨
Making memes!

Cooper Pellaton cooperpellaton

👨‍🎨
Making memes!
View GitHub Profile
@jboner
jboner / latency.txt
Last active October 15, 2025 09:07
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
@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

@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active October 5, 2025 07:57
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@niw
niw / SafariHack.m
Last active August 29, 2015 14:09
Show favicon on Safari tabs.
/*
SafariHack
==========
Use with SIMBL or compatible extension like EasySIMBL. Only tested on OS X 10.10.
LICENSE
-------
Copyright (c) 2014 Yoshimasa Niwa
@vasanthk
vasanthk / System Design.md
Last active October 14, 2025 22:32
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active September 27, 2025 02:50
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@sidsenkumar11
sidsenkumar11 / README.md
Last active March 30, 2025 14:46
GDB Tutorial

GDB for the Uninitiated

Overview

You're working on a C project for CS 2200. There's 2 days left before the assignment is due and for some reason, you're getting a segmentation fault after writing your last function. You've looked over your code 23 times but you just can't figure out where the bug is! Giving up and calling it a day, you decide to go to office hours and ask a TA for help.

If it sounds like this might be you in the near future, then allow me to run through a typical scenario for what happens when you come in and ask for help. You'll sit down, wait for 30 minutes while the TAs get through the queue of students asking questions, and finally notice that it's your turn next. The TA will walk over and ask you what's up. You'll explain that your code is seg-faulting and for the life of you, you can't figure out why. So the TA will take a quick peak at your code for any obvious errors, and then ask you the following question:

Did you run it through GDB?

#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@cooperpellaton
cooperpellaton / choco-bootstrap.ps1
Last active March 7, 2021 23:54
🍫 A PowerShell script that self-elevates and installs programs from Chocolatey.
# List of packages to be installed.
$Packages = 'firefox', 'vlc', '7zip', 'vscode', `
'everything', 'sharex', 'scansnapmanager', 'steam', 'discord', `
'Revo.Uninstaller', 'battle.net'
# Packages that won't be installed and the user will be reminded of.
$Extras = "Windows Store apps, Oculus, AMD/Radeon Drivers"
# Get the ID and security principal of the current user account
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal = new-object System.Security.Principal.WindowsPrincipal($myWindowsID)