Skip to content

Instantly share code, notes, and snippets.

@bds
bds / .dockerignore
Last active March 25, 2020 04:03
Crystal Docker Starter
.env
.gitignore
*.swp
node_modules
npm-debug.log
@bds
bds / docker-shell.sh
Created June 17, 2019 17:06 — forked from falvarez/docker-shell.sh
Run docker container, mount current working directory and get interactive shell
docker run -ti -v $(pwd):/tmp DOCKER_IMAGE /bin/bash
@bds
bds / docker-image-delete-feedback.sh
Created May 28, 2019 16:15
Delete Docker images with feedback
# https://github.com/docker/for-mac/issues/2501#issuecomment-436997480
docker images -f "dangling=true" -q | xargs -I {} echo docker rmi -f {}
@bds
bds / jwtRS256.sh
Created May 27, 2019 04:00 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
// http://www.2ality.com/2013/09/javascript-unicode.html
function toUTF16(codePoint) {
var TEN_BITS = parseInt('1111111111', 2);
function u(codeUnit) {
return '\\u'+codeUnit.toString(16).toUpperCase();
}
if (codePoint <= 0xFFFF) {
return u(codePoint);
}
@bds
bds / .dockerignore
Last active May 28, 2019 05:11
Docker Node Starter
.env
.gitignore
*.swp
node_modules
npm-debug.log
@bds
bds / http_streaming.md
Created September 24, 2018 16:12 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@bds
bds / docker-gdb.sh
Last active September 3, 2018 19:45
Use gdb with Docker
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
@bds
bds / osx-gui-notify.sh
Created September 1, 2018 19:34
OSX GUI notification
osascript -e 'display notification "Lorem ipsum dolor sit amet 2" with title "Title"'
@bds
bds / inotify-compile.sh
Created September 1, 2018 19:31
Use inotify modify events to compile Crystal Lang
#! /usr/bin/env sh
#
# https://github.com/rvoicilas/inotify-tools/wiki#inotifywait
#
CURPATH=`pwd`
inotifywait -mr \
--exclude "[^c][^r]$" \
--timefmt '%d/%m/%y %H:%M:%S' --format '%T %w %f' \
-e modify /usr/src/app/my-app/src | while read date time dir file; do