Skip to content

Instantly share code, notes, and snippets.

@defn
defn / kv
Created December 28, 2018 02:00 — forked from nilium/kv
A few shell scripts for creating JSON from a shell
#!/usr/bin/env bash
while [ $# -gt 0 ]; do
jq -nc --arg k "$1" --arg v "$2" '{($k): (try ($v|fromjson) catch $v)}'
shift; shift
done | jq -sc add
@defn
defn / docker-compose.yml
Created November 1, 2018 23:56 — forked from BlinkyStitt/docker-compose.yml
zerotier 6PLANE, docker, and consul
# you need to set ZT6PLANE to match your network
version: '2.3'
networks:
zerotier:
driver: bridge
enable_ipv6: true
internal: false
ipam:
@defn
defn / cljs-serverless.md
Created September 11, 2018 00:56 — forked from lilactown/cljs-serverless.md
CLJS in AWS Lambda Quick Start
@defn
defn / README.md
Created August 6, 2018 06:51 — forked from mfikes/README.md
eval in ClojureScript

ClojureScript master now has cljs.core/eval. This delegates to cljs.core/*eval* which, by default throws, but you can bind it to any implementation that can compile and evaluate ClojureScript forms.

If you require the cljs.js namespace (which is the main support namespace for self-hosted ClojureScript), then cljs.core/*eval* is set to an implementation that uses self-hosted ClojureScript for this capability. This means that all self-hosted ClojureScript environments will now have a first-class eval implementation that just works. For example, Planck master:

$ planck -q
cljs.user=> (eval '(+ 2 3))
5

On the server with tmux

Create a new tmux session:

tmux new-session -s my-session # launch `top`, `htop`, or anything that will regularly updates, then detach

Stream your session:

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@defn
defn / yubitouch.sh
Created March 7, 2018 04:48 — forked from a-dma/yubitouch.sh
Bash script for setting or clearing touch requirements for cryptographic operations in the OpenPGP application on a YubiKey 4.
#!/bin/bash
# Bash script for setting or clearing touch requirements for
# cryptographic operations the OpenPGP application on a YubiKey 4.
#
# Author: Alessio Di Mauro <alessio@yubico.com>
GCA=$(which gpg-connect-agent)
DO=0
UIF=0

Prerequisites

You'll need to have a system running that is accessible through a DNS record. It should have access to the public Habitat depot, https://app.habitat.sh so it can download the required packages.

You'll need to register an OAuth application for GitHub. You need the client ID and client secret that are created for the application later in this guide. Your system needs to have access to https://github.com so that it can authenticate.

Your system also needs to have an FQDN that can be resolved, for example depot.example.com. This will be used in your OAuth application's "Authorization Callback URL." For this example, use http://depot.example.com/#/sign-in. The /#/sign-in is required.

Operating System

@defn
defn / overlay.sh
Created January 24, 2018 09:24 — forked from cjbottaro/overlay.sh
Convert ECS Optimized AMI to use overlay/overlay2
set -e
# Stop the docker daemon
/etc/init.d/docker stop
# Configure ECS Agent
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/automated_image_cleanup.html
cat > /etc/ecs/ecs.config << "EOF"
ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=1h
@defn
defn / docker-compose.yml
Created October 26, 2017 06:09 — forked from janjaapbos/docker-compose.yml
docker compose for ZeroTier 6plane
version: '2.1'
# run with IPv6 network of the docker container as enviroment variable
# e.g. ZT6PLANE=fc7b:59ab:4811:901c:40ea docker-compose up
networks:
zerotier:
driver: bridge
enable_ipv6: true
internal: false