Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin BinaryShrub

View GitHub Profile
@BinaryShrub
BinaryShrub / README.md
Last active Jan 11, 2021
Plant UML Theme
View README.md

To use this theme, add !include right after @startuml

@startuml
!include https://gist.githubusercontent.com/BinaryShrub/f60cd9e5a9658ae5b0f53b69969ac577/raw/6003ccc69dfffbe66f8984614bfedaa1e0e1507d/theme.puml

.
.
.
@BinaryShrub
BinaryShrub / logger.ts
Last active Jun 27, 2020
Winston with console.log and colors support with util.format
View logger.ts
import winston from 'winston';
import util from 'util';
const utilFormat = (enableColor: boolean) => {
const printFormat = winston.format.printf(({ level, message, timestamp }) => `${timestamp} ${level}: ${message}`);
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform: (info: any) => {
const args = info[Symbol.for('splat')] || [];
info.message = util.formatWithOptions({ colors: enableColor }, info.message, ...args);
@BinaryShrub
BinaryShrub / index.js
Last active May 10, 2020
Alexa, play white noise
View index.js
/**
* Alexa Skill Lambda Function that will play an audio file
* on loop, indefinitely - no libraries required! 🎉
*/
const debug = false
exports.handler = async(event) => {
const session = { event, response: error() }
@BinaryShrub
BinaryShrub / dnd.sh
Created Mar 20, 2020
macOS Mojave script that automates Do No Disturb and Badge app icons in the Dock 🎉
View dnd.sh
#!/bin/bash
# run 'dnd' to enable Do Not Disturb and disable all Badge app icons in the Dock
# run 'dnd off' to disable Do Not Disturb and enable all Badge app icons in the Dock
dnd () {
local ENABLE
local ENABLE_NUM
local ENABLE_STRING_NEG
case "$1" in
off)
@BinaryShrub
BinaryShrub / initramfs-unlocker.sh
Last active May 29, 2020
LUKS remote decrypt (dropbear) for Ubuntu 16.04.1 on btrfs array
View initramfs-unlocker.sh
#!/bin/bash
## LUKS remote decrypt for Ubuntu 16.04.1 - by BinaryShrub
# NOTES:
# Tailor lines 67 - 69 to your system before running!
# Use at your own risk!
# Safety Check
if [ "$EUID" -ne 0 ]
then echo "You must run this as root"