Skip to content

Instantly share code, notes, and snippets.

View michaelbernstein's full-sized avatar

Michael Bernstein michaelbernstein

View GitHub Profile
@michaelbernstein
michaelbernstein / LLM.md
Created March 29, 2023 05:19 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@michaelbernstein
michaelbernstein / attributes.rb
Created April 21, 2019 09:57 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
➤ go test -bench=.
BenchmarkSearch/Div-8 50000000 31.5 ns/op
BenchmarkSearch/Shift-8 100000000 21.1 ns/op
PASS
ok experiments/binarysearch 3.754s

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

### Keybase proof
I hereby claim:
* I am michaelbernstein on github.
* I am michaelbernstein (https://keybase.io/michaelbernstein) on keybase.
* I have a public key ASAvVhbr82MxZirfhJdWXraOMhKW_z0XIAeb6yH9s184SQo
To claim this, I am signing this object:
@michaelbernstein
michaelbernstein / gist:1afffcd8a0ecd54340b0
Last active December 22, 2015 16:26 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan Developer Preview 2

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat

Distributed Read-Write Mutex in Go

The default Go implementation of sync.RWMutex does not scale well to multiple cores, as all readers contend on the same memory location when they all try to atomically increment it. This gist explores an n-way RWMutex, also known as a "big reader" lock, which gives each CPU core its own RWMutex. Readers take only a read lock local to their core, whereas writers must take all locks in order.

@michaelbernstein
michaelbernstein / extconf.rb
Created March 27, 2011 19:55
My snappy wrapper from earlier in the week to show igrigorik
require 'mkmf'
# Give it a name
extension_name = 'lrsnappy'
# The destination
dir_config(extension_name)
$LIBS << " -lstdc++ -lsnappy"
@michaelbernstein
michaelbernstein / mindstorm.rb
Created March 14, 2011 00:29
Lego Mindstorm Installer Gist
#!/usr/local/bin/ruby
require 'find'
p "This script will copy the contents of your LEGO MINDSTORMS NXT disc to your desktop, make necessary adjustments to the installer for Mac OS X 10.6 and later, and then initiate the MINDSTORMS installer. Please insert the MINDSTORMS NXT disc before you continue. Would you like to continue? (Y/N)"
$name = gets.chomp
if $name[0,1].casecmp("Y") == 0
$NXT_CD_Mounted = false
Dir.entries("/Volumes").each do |path|