Skip to content

Instantly share code, notes, and snippets.

Avatar

John Elliott johnelliott

  • Brooklyn, NY
View GitHub Profile
View README.md

Multiple mutually-exclusive A-B tests available in parallel

Example code for selecting which A-B test to place a user in when wanting to run many tests. It's assumed a cookie or other state is stored with the user. Once a user is "in" a test they shouldn't be considered.

the number line approach

The number line approach uses a range of numbers between zero and one. Each test we want to run 'consumes' fractional space on the number line, with the remainder unoccupied. When an elegible user arrives at the experience —i.e. they do not have the piece of state or cookie indicating they're already

@johnelliott
johnelliott / opentx-model-image-convert.sh
Created Apr 20, 2020
Convert OpenTX model images with ImageMagick
View opentx-model-image-convert.sh
#!/usr/local/bin/bash
# convert should be from ImageMagick 7+
# e.g. $ cat input.jpg | ./opentx-model-image-convert.sh > output.bmp
convert - \
-resize 64x32 \
-gravity center \
-extent 64x32 \
-colorspace gray \
View pcd.md

Tips for using PCD: https://github.com/kvannotten/pcd

... I also wanted [range downloads], but then I first used the seq and parallel programs. It's a very unix-y solution, but it turns out ids being integers is great. You may need to install and play with seq and parallel a bit, but this works for me:

episode downloads (echo must be removed for real downloading):

$ seq 4 10 |parallel echo pcd download mypodcast {}
pcd download mypodcast 4
pcd download mypodcast 5
pcd download mypodcast 6
@johnelliott
johnelliott / .vimrc.coworker.vim
Last active Dec 19, 2019
.vimrc.coworker.vim
View .vimrc.coworker.vim
unlet! skip_defaults_vim
if (filereadable($VIMRUNTIME .'/defaults.vim'))
source $VIMRUNTIME/defaults.vim
elseif (filereadable($VIMRUNTIME .'/vimrc_example.vim'))
source $VIMRUNTIME/vimrc_example.vim
endif
set noswapfile nobackup nojoinspaces gdefault ignorecase wildignorecase showcmd
set tabstop=4 expandtab softtabstop=2 shiftwidth=2
set undodir=~/.vim/undo clipboard=unnamed
View BTFL_cli_20191018_202623.txt
#
# dump
# version
# Betaflight / STM32F7X2 (S7X2) 4.1.0 Aug 9 2019 / 11:41:22 (41a0b5938) MSP API: 1.42
# start the command batch
batch start
View html2jsonld
#!/usr/local/bin/bash
pup script[type=application/ld+json]|head -n2 |tail -n1|jq
View kubectlproxy.plist
<?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">
<dict>
<key>Label</key>
<string>local.kubelproxy.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/kubectl</string>
<string>proxy</string>
@johnelliott
johnelliott / chrome.service
Last active Apr 30, 2019
Raspi TV Web Dashboard
View chrome.service
[Unit]
Description="Start chromium datadog on startup"
PartOf=graphical.target
[Service]
# public url https://my.prom
ExecStart=/usr/bin/chromium-browser --kiosk --disable-session-crashed-bubble --incognito "https://my.prom"
Restart=always
RestartSec=3
@johnelliott
johnelliott / create-macos-solid-color.sh
Created Mar 31, 2019
macOS desktop background solid color imagemagick script
View create-macos-solid-color.sh
#convert is from imagemagick
convert "xc:#$1[128x128!]" /Library/Desktop\ Pictures/Solid\ Colors/$1.png
#TODO find out how to make icon preview same aspect ratio as apple images
You can’t perform that action at this time.