Skip to content

Instantly share code, notes, and snippets.

@LukeMathWalker
LukeMathWalker / audit.yml
Last active May 1, 2024 12:27
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@bentrengrove
bentrengrove / Sample.kt
Last active February 12, 2024 12:25
Sample code demonstrating using Kotlin for type safe unit conversion
val miles = 1.kilometers.to(Distance.Mile)
val kilometers = 1.miles.to(Distance.Kilometer)
val total = 2.kilometers + 1.miles + 10.meters + 1.centimeter + 1.millimeter
Log.d("MainActivity", "Total distance is ${total.meters.amount} meters")
val totalTime = 2.hours + 2.minutes + 2.seconds + 2.milliseconds
Log.d("MainActivity", "Total time is ${totalTime.amount} ${totalTime.unit}")
@eneko
eneko / git-purge
Last active June 28, 2023 03:48
`git purge` command to delete local branches that have been deleted on remote
#!/usr/bin/env sh
set -e
echo "Pulling latest code..."
git pull
echo "Deleting local branches that were removed in remote..."
git fetch -p
git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
echo "Remaining local branches:"
git branch -vv
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jboner
jboner / latency.txt
Last active May 4, 2024 21:16
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