Skip to content

Instantly share code, notes, and snippets.

View thesephist's full-sized avatar
🍷
Ridin' in a getaway car

Linus Lee thesephist

🍷
Ridin' in a getaway car
View GitHub Profile
// Code to measure selection rects
// NOTE: this isn't actually JS... it's Oak. But I think the code is readable if you know JS :/
// NOTE: I *think* this event listener only works when attached to `document`.
with document.addEventListener('selectionchange') fn handleSelectionChange {
if active := document.activeElement {
? -> ?
_ -> if active.classList.contains('textarea-itself') {
false -> ?
@karpathy
karpathy / stablediffusionwalk.py
Last active April 25, 2024 11:25
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@svoisen
svoisen / main.rs
Last active May 20, 2022 03:03
Print histogram of file line lengths using Rust
// Dependencies required in Cargo.toml
// clap = { version = "3.1.7", features = ["derive"] }
// deque = "0.3.2"
// ignore = "0.1.6"
// num_cpus = "1.13.1"
use clap::Parser;
use deque::{Stealer, Stolen};
use ignore::WalkBuilder;
use num_cpus;

What Hiring Should Look Like

This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.

I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.

But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.

If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.

@ityonemo
ityonemo / nbody-zig.zig
Last active June 17, 2020 02:40
benchmarks game: zig
//! The Computer Language Benchmarks Game
//! https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
//!
//! This implementation is written in simple and idiomatic Zig.
//! The only optimization is using SIMD vector intrinsics.
const std = @import("std");
/////////////////////////////////////////////////////////////////////////
// important constants. ALLCAPS constants are not idiomatic Zig, but it's
@thesephist
thesephist / analysis.ink
Last active June 8, 2020 11:19
Blog writing analysis script, referenced in thesephist.com/posts/blog-analysis/ ✍️
` Count sentence length, word size distribution over past posts `
std := load('std')
str := load('str')
quicksort := load('quicksort')
log := std.log
f := std.format
append := std.append
cat := std.cat
Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@thesephist
thesephist / queue.ink
Created December 23, 2019 15:31
Concurrent asynchronous queue in Ink
` concurrent task queue `
std := load('std')
log := std.log
each := std.each
range := std.range
new := maxConcurrency => (
s := {
@yevbar
yevbar / domain_lookup.py
Created December 18, 2019 06:45
Given a TLD will search for all single letter domans that are _not_ registered
from string import ascii_lowercase
import subprocess
import sys
from time import sleep
tld = sys.argv[1] # ie python main.py capital
for c in ascii_lowercase:
output = subprocess.check_output("whois {}.{}".format(c, tld), shell=True)
if "Domain not found" in str(output):
print("The domain {}.{} is available".format(c, tld))
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {