This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In Groovy | |
// collect = "map" | |
// inject = "reduce" | |
// | |
// See http://docs.groovy-lang.org/next/html/documentation/working-with-collections.html for docs | |
//////////////////////////////////////////////////////////////////////////////// | |
// Arrays | |
def myNumbers = [3, 5, 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e; | |
npm init -y | |
node -e "const pkg = require('./package.json'); | |
pkg.version = '0.0.0-dev' | |
pkg.license = 'MIT'; | |
pkg.scripts = pkg.scripts || {}; | |
pkg.scripts.lint = \"eslint . \"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# echo, but to stderr | |
function echoerr { | |
echo "$@" 1>&2; | |
} | |
# Retry a command up to a specific numer of times until it exits successfully, | |
# with exponential back off. | |
# | |
# $ retry 5 echo Hello | |
# Hello | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p ~/Pictures/Wallpapers | |
WIDTH=1280 | |
HEIGHT=800 | |
RANDOM_NAME=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '') | |
curl -JL -o "$HOME/Pictures/Wallpapers/${RANDOM_NAME}.jpeg" https://picsum.photos/g/$WIDTH/$HEIGHT?random | |
osascript -e "tell application 'Finder' to set desktop picture to POSIX file '$HOME/Pictures/Wallpapers/${RANDOM_NAME}.jpeg'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} dimensions Ex. 12"3'x10"7' | |
* @customfunction | |
*/ | |
function SQUAREFT(dimensions) { | |
var parts = dimensions.split("x") | |
var width = parseFeet(parts[0]) | |
var height = parseFeet(parts[1]) | |
return width * height | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e; | |
npm init -y | |
node -e "const pkg = require('./package.json'); | |
pkg.version = '0.0.0-dev' | |
pkg.license = 'MIT'; | |
pkg.scripts = pkg.scripts || {}; | |
pkg.scripts['lint:eslint'] = 'eslint --ext .ts,.js . '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3-alpine | |
RUN apk --no-cache upgrade && \ | |
apk --no-cache add \ | |
openssl | |
WORKDIR /app | |
RUN openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes \ | |
-subj "/C=CA/ST=Ontario/L=Toronto" | |
COPY serve.py index.html /app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To use this open your GitHub profile page and then open the browser dev tools | |
* console and paste this in. | |
*/ | |
async function sleep(n) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(), n); | |
}); | |
} |
OlderNewer