Skip to content

Instantly share code, notes, and snippets.

View kesor's full-sized avatar
🏠
Working from home

Evgeny Zislis kesor

🏠
Working from home
View GitHub Profile
const hierarchy = {
config: {
settings: sinon.fake(),
log: {
info: sinon.fake()
}
}
}
verifyPassword(hierarchy)
@kesor
kesor / vinny3693-build-script.sh
Created April 6, 2020 20:23
Remove all the Python files and replace them with a tiny shell script
#!/bin/sh
just_the_file_please() {
sed -e 's!^[^/]*\(/.*\)$!\1!'
}
remove_magic() {
sed -e 's!__pycache__/!!; s!\.[^.]*\.pyc$!.pyc!'
}
@kesor
kesor / closed-captions-realtime.html
Last active April 29, 2020 02:12
use speech recognition and output captions into console
<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 / Dockerfile
Last active September 15, 2024 11:36
Compile DENO on Alpine (w/MUSL C)
FROM rust:alpine
RUN apk add --no-cache \
bash \
binutils-gold \
ca-certificates \
clang \
curl \
g++ \
git \
@kesor
kesor / .eslintrc.js
Last active May 14, 2020 05:51
eslint
module.exports = {
env: {
browser: true,
commonjs: true,
es2020: true,
node: true,
mocha: true
},
extends: [
'eslint:recommended',
@kesor
kesor / http-fs-server.js
Created May 22, 2020 20:08
Node.js HTTP server to stream static files from the filesystem
// 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
@kesor
kesor / docker-cli-install.sh
Last active May 25, 2020 16:29
install docker-cli on centos/amazon-linux
## 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
controller:
kind: DaemonSet
ingressClass: XXX-ingress
daemonset:
useHostPort: true
hostPorts:
http: 68888
https: null
containerPort:
http: 68888
@kesor
kesor / debug-grid.css
Created June 8, 2020 08:25
debug css grid
/* DEBUG Grid */
body {
position: relative;
background: blue;
}
body:after {
background-size: var(--grid-size) var(--grid-size);
background-repeat: repeat;
background-image:
linear-gradient(
@kesor
kesor / Dockerfile
Last active June 18, 2020 11:23
example node.js production 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