Skip to content

Instantly share code, notes, and snippets.

View stjohnjohnson's full-sized avatar

St. John Johnson stjohnjohnson

View GitHub Profile
// Animate triggers the application to redraw every 50ms
func Animate(app *tview.Application) {
globalAnimationMutex.Lock()
defer globalAnimationMutex.Unlock()
for {
app.QueueUpdateDraw(func() {})
time.Sleep(50 * time.Millisecond)
}
}
all: build test clean
test:
@echo "========== Internal Domains =========="
dig @127.0.0.1 haas.example.com +short
dig @127.0.0.1 pihole.example.com +short
dig @127.0.0.1 plex.example.com +short
dig @127.0.0.1 go +short
dig @127.0.0.1 modem +short
docker: ca.pem server.pem server-key.pem
docker-compose up
ca.pem ca-key.pem:
cfssl gencert \
-initca ca-csr.json | cfssljson -bare ca
server.pem server-key.pem:
cfssl gencert \
-ca=ca.pem \
@stjohnjohnson
stjohnjohnson / Makefile
Last active December 9, 2019 04:20
Reproducing a potential bug in faiface/beep
default:
-@make local
-@make docker
local:
@echo Running locally
GOOS=linux GOARCH=amd64 go build
docker:
@echo Running in Docker
@stjohnjohnson
stjohnjohnson / decoded.js
Last active September 18, 2020 10:06
USPS Obfusticated Login Code
<script>
var bundle;
(function() {
function a(b) {
var c = "";
for (var d = 0, e = b.length; d < e; ++d) {
var f = b.charCodeAt(d);
c += f >= 55296 ? b[d] : String.fromCharCode((f + 55296 - 6858) % 55296)
}
return c
#!/usr/bin/env python
# coding=utf-8
import socket
from string import Template
from subprocess import check_output, call, STDOUT, PIPE
dockerTemplate = '''
version: '2'
services:
api:
@stjohnjohnson
stjohnjohnson / Dockerfile
Created October 15, 2016 16:21
Screwdriver API Dockerfile
FROM node:6
# Create our application directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install Screwdriver API
COPY package.json /usr/src/app/
RUN npm install --production
@stjohnjohnson
stjohnjohnson / coverage.sh
Last active March 13, 2018 16:48
List of scripts to help automate publishing to NPM and Docker
#!/bin/bash -e
echo Uploading coverage to Coveralls
export CI_PULL_REQUEST=${SD_PULL_REQUEST}
export COVERALLS_SERVICE_NAME=screwdriver
cat ./artifacts/coverage/lcov.info | ./node_modules/.bin/coveralls
---
# GET /v3/secrets/e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4
id: e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4
# upper-case only (as they are environment variables)
name: NPM_TOKEN
# secret should be iron encrypted
value: aHVudGVyMg==
# variable or ssh-key
type: variable
# system, pipeline, or job
apiVersion: batch/v1
kind: Job
metadata:
generateName: sd-
spec:
completions: 1
template:
spec:
restartPolicy: Never
containers: