Skip to content

Instantly share code, notes, and snippets.

@kesor
kesor / Dockerfile
Last active Jun 18, 2020
example node.js production Dockerfile
View Dockerfile
FROM node:14.4
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app \
&& chown node:node /app
ENV NODE_ENV production
View debug-grid.css
/* DEBUG Grid */
body {
position: relative;
background: blue;
}
body:after {
background-size: var(--grid-size) var(--grid-size);
background-repeat: repeat;
background-image:
linear-gradient(
View helm-ingress-disable-https.values.yaml
controller:
kind: DaemonSet
ingressClass: XXX-ingress
daemonset:
useHostPort: true
hostPorts:
http: 68888
https: null
containerPort:
http: 68888
@kesor
kesor / docker-cli-install.sh
Last active May 25, 2020
install docker-cli on centos/amazon-linux
View docker-cli-install.sh
## optional: run the amazon cli container
docker run -ti --rm --name amazon-cli \
-v ~/.aws:/root/.aws \
-v ~/.docker:/root/.docker \
-v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint /bin/bash \
amazon/aws-cli
## (slow) optional: generate yum repository configuration using an additional tool
@kesor
kesor / http-fs-server.js
Created May 22, 2020
Node.js HTTP server to stream static files from the filesystem
View http-fs-server.js
// based on https://nodejs.org/en/knowledge/HTTP/servers/how-to-serve-static-files/
const http = require('http'),
fs = require('fs')
const PORT = process.env.PORT || '8080'
function handler(req, res) {
const filename = __dirname + req.url
let stat
View .eslintrc.js
module.exports = {
env: {
browser: true,
commonjs: true,
es2020: true,
node: true,
mocha: true
},
extends: [
'eslint:recommended',
@kesor
kesor / Dockerfile
Last active Jan 22, 2021
Compile DENO on Alpine (w/MUSL C)
View Dockerfile
FROM rust:alpine
RUN apk add --no-cache \
bash \
binutils-gold \
ca-certificates \
clang \
curl \
g++ \
git \
@kesor
kesor / closed-captions-realtime.html
Last active Apr 29, 2020
use speech recognition and output captions into console
View closed-captions-realtime.html
<html>
<body>
<button id="button" onclick="toggleStartStop()"></button>
<div style="border:dotted;padding:10px">
<span id="final_span"></span>
<span id="interim_span" style="color:grey"></span>
</div>
<script type="text/javascript">
var recognizing;
var recognition = new (window['SpeechRecognition'] || window['webkitSpeechRecognition'])
@kesor
kesor / vinny3693-build-script.sh
Created Apr 6, 2020
Remove all the Python files and replace them with a tiny shell script
View vinny3693-build-script.sh
#!/bin/sh
just_the_file_please() {
sed -e 's!^[^/]*\(/.*\)$!\1!'
}
remove_magic() {
sed -e 's!__pycache__/!!; s!\.[^.]*\.pyc$!.pyc!'
}
View example.js
const hierarchy = {
config: {
settings: sinon.fake(),
log: {
info: sinon.fake()
}
}
}
verifyPassword(hierarchy)