Skip to content

Instantly share code, notes, and snippets.

View andykais's full-sized avatar

Andrew Kaiser andykais

View GitHub Profile
FROM node:8-alpine
COPY entrypoint.sh /usr/bin/entrypoint.sh
# create npmrc with enviroment variable
RUN echo "\$NPM_TOKEN" > /root/.npmrc
# entrypoint script performs envsubst on npmrc
RUN printf '#!/bin/sh\n\
sed -i "s~\$NPM_TOKEN~$NPM_TOKEN~" /root/.npmrc\n\
$@' > /usr/bin/entrypoint.sh \
@andykais
andykais / .gitignore
Created May 4, 2016 11:19
.gitignore file for my home directory
#blacklist top level folder
/*
#whitelist files & folders
!.gitignore
!README.md
!.i3/
!.i3status.conf
@andykais
andykais / slideshow.sh
Last active July 14, 2023 10:12
use feh to create a slideshow, meant for i3-wm, to be launched at startup
#!/bin/bash
#wait (in seconds) for background to change
wait=$((60 * 60))
#in the future, could load files from a general bin/config file
#sed -c -i "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE
dir="$(cat /home/andrew/bin/data/slideshow_all.txt)"
#finds the image files in $dir, optionally can add --max-depth 1 to keep from searching subdirs
files=$(find "$dir" -regex ".*\.\(jpg\|gif\|png\|jpeg\)" | sort -n)
@andykais
andykais / wgetter.sh
Created January 17, 2017 21:58
download manga from mangasee
#!/bin/bash
N=50
i=1
down_dir="$HOME/wget/Kingdom/"
while [ $i -lt $N ]; do
echo -==: downloading chapter $i :==-
# old locations
{
"0 debug pnpm:scope": {
"selected": 1,
"workspacePrefix": null
},
"1 debug pnpm": {
"isCaseSensitive": false,
"store": "/Users/andrew/.pnpm-store/2"
},
"2 debug pnpm:package-manifest": {
@andykais
andykais / optional_chaining.py
Last active July 11, 2019 15:56
details two optional chaining methods
empty = None
deep = dict(a=dict(b='c'))
def chain_optional(func, default_value=None):
try:
return func()
except AttributeError:
return default_value
except TypeError:
@andykais
andykais / timing-utils.js
Created May 16, 2019 16:59
A couple of handy timing functions I use often
// async
const timeout = n => new Promise(resolve => setTimeout(resolve, n))
// sync
const sleep = n => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n)
// async
const scheduleAsync = startAtEpoch => async fn => {
const now = Date.now()
const millisecondsTillStartAt = startAtEpoch - now
await timeout(millisecondsTillStartAt)