Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
@sfan5
sfan5 / alpine-container.sh
Last active February 15, 2025 13:49
Create bootable systemd-nspawn containers with Alpine, Arch Linux or Ubuntu
#!/bin/bash -e
# Creates a systemd-nspawn container with Alpine
MIRROR=http://dl-cdn.alpinelinux.org/alpine
VERSION=${VERSION:-v3.21}
APKTOOLS_VERSION=2.14.6-r3
wget_or_curl () {
if command -v wget >/dev/null; then
@nolanlawson
nolanlawson / parens-and-perf-counterpost.md
Last active August 14, 2023 20:08
"Parens and Performance" – counterpost

"Parens and Performance" – counterpost

Kyle Simpson (@getify) wrote a very thoughtful post decrying optimize-js, which is a tool I wrote that exploits known optimizations in JavaScript engines to make JS bundles parse faster (especially minified bundles, due to what could be reasonably described as a bug in Uglify).

Kyle lays out a good case, but I tend to disagree with nearly all his points. So here's my rebuttal.

@davidmarkclements
davidmarkclements / fast.md
Last active March 31, 2017 18:45
Idea - Single Request SPA
@postpostscript
postpostscript / replify
Last active November 7, 2024 02:47
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
@junosuarez
junosuarez / firstJank.js
Created August 16, 2016 17:05
key RUM perf metric: time-to-first-jank
if (window.requestAnimationFrame) {
function checkForJank () { // eslint-disable-line no-inner-delcarations
const frameStart = Date.now()
window.requestAnimationFrame(() => {
const frameDuration = Date.now() - frameStart
if (frameDuration > 17) {
Perf.log(FirstJank)
} else {
checkForJank()
}
alias ..='cd ..'
alias ls='gls --color=auto'
alias ll='ls -lh --group-directories-first'
alias slt='open -a "Sublime Text"'
alias npm-offline="npm --cache-min Infinity "
alias publish='git push && git push --tags && npm publish'
alias nodeir='node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --print-opt-code --trace_hydrogen_file=hydrogen.cfg'
export HISTCONTROL=ignoredups
export PS1="\[\033[44m\] \W \[\033[49m\]\[\033[42m\]\$(__git_ps1 \" %s \")\[\033[49m\] "
@ahdinosaur
ahdinosaur / choo.txt
Created July 21, 2016 01:24
chat logs from freenode #choo
20:04 < ahdinosaur> if anyone is interested in a choo-like API where it's pull-streams all the way down, i made some helpers for `inu`: https://github.com/ahdinosaur/inux
20:04 < yoshuawuyts> ahdinosaur: I'm curious: how big is inu?
20:04 < yoshuawuyts> probably smaller than choo I'd think
20:05 < yoshuawuyts> well, inux would be more fair to compare I reckon but still
20:05 < ahdinosaur> one sec, i'll discify
20:05 < yoshuawuyts> ahdinosaur: I'm using this for choo https://github.com/yoshuawuyts/choo/blob/master/scripts/instrument#L24-L35
20:06 < yoshuawuyts> gzip size tends to translate slightly better I find
20:06 < ronnross> So curious how one would use something like https://codemirror.net/ in Choo.
20:07 < ronnross> Would you work directly with the dome of use subscriptions to handle working with it.
20:07 < ronnross> Might sound like a crazy question, but when I implemented it in Elm I had to use ports and subscriptions.

Tests

✔ Platform [pass: 1, fail: 0, duration: 1ms]
✔ init [pass: 22, fail: 0, duration: 1ms]
✔ emit [pass: 27, fail: 0, duration: 12ms]
✔ emit with context [pass: 42, fail: 0, duration: 5ms]
✔ emit one value - two listeners [pass: 57, fail: 0, duration: 2ms]
✔ emit one value - one listener [pass: 40, fail: 0, duration: 1ms]
✔ emit many listeners [pass: 30, fail: 0, duration: 1ms]

Tests

✔ Platform [pass: 1, fail: 0, duration: 1ms]
✔ init [pass: 22, fail: 0, duration: 1ms]
✔ emit [pass: 27, fail: 0, duration: 12ms]
✔ emit with context [pass: 42, fail: 0, duration: 5ms]
✔ emit one value - two listeners [pass: 57, fail: 0, duration: 2ms]
✔ emit one value - one listener [pass: 40, fail: 0, duration: 1ms]
✔ emit many listeners [pass: 30, fail: 0, duration: 1ms]
@bmhatfield
bmhatfield / .profile
Last active January 29, 2025 11:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else