Skip to content

Instantly share code, notes, and snippets.

View jnovack's full-sized avatar
😠
Changing tabs to spaces...

Justin J. Novack jnovack

😠
Changing tabs to spaces...
View GitHub Profile
@jnovack
jnovack / journal.go
Created October 13, 2018 21:07
Go Journaling
package main
import (
journal "github.com/coreos/go-systemd/journal"
)
func j(message string) {
err := journal.Send(message, journal.PriInfo, tags)
if err != nil {
log.Fatalf("%s", err)
@jnovack
jnovack / break.go
Last active May 29, 2024 16:10
Handle CTRL-C in Golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
@jnovack
jnovack / docker-compose.yml
Created September 17, 2018 14:13
Docker Swarm ElasticSearch Cluster (Exposed)
# Exposes the ElasticSearch cluster on :9200
# of all Docker Swarm Nodes (poor man's clustering)
# [NSFW] X-Pack-Security Disabled, Kibana-Monitoring Enabled
version: '3.7'
services:
node:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
ports:
- "9200:9200"
@jnovack
jnovack / wrap.sh
Created September 9, 2018 20:42
awk word-wrap / trim at certain number of columns
!/bin/bash
# `export WIDTH=120` to change the width
## awk-wrap
alias wrap='awk -v WIDTH="${WIDTH:-72}" '\''
{
gsub("\t"," ")
$0 = line $0
while (length <= WIDTH) {
@jnovack
jnovack / file_env.sh
Created April 25, 2018 20:56
Variables of Variables in /bin/sh
#!/bin/sh
file_env() {
local envVar="$1"
local fileVar="${envVar}_FILE"
eval envVarContents="\$${envVar}"
eval fileVarContents="\$${fileVar}"
if [ ! -z "$envVarContents" ] && [ ! -z "$fileVarContents" ]; then
echo >&2 "error: both $envVar and $fileVar are set (but are exclusive)"
exit 1
fi

Keybase proof

I hereby claim:

  • I am jnovack on github.
  • I am jnovack (https://keybase.io/jnovack) on keybase.
  • I have a public key whose fingerprint is BF9C 783D 2222 5964 3191 04A6 0CD0 19C2 B340 6656

To claim this, I am signing this object:

@jnovack
jnovack / ovfenv.py
Created March 31, 2018 13:21
ovfenv
#!/usr/bin/python
#
# Copyright 2011 VMware, Inc. All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@jnovack
jnovack / README.md
Created October 8, 2017 14:33
Custom Fibaro RGBW LED Controller in SmartThings

This extends the native SmartThings device handler to support editing the device's parameters from the SmartThings GUI, and to support the use of one or more of the controller's channels in IN/OUT mode.

First go to http://bit.ly/rgbwfib and select all, copy. Then Google search SmartThings IDE . Log in there, and then click on "My Device Handlers" and add new. Click "From Code" along the top then paste in the box. Hit "Save"

@jnovack
jnovack / README.md
Created September 28, 2017 00:27
OSX Mac Mini ESXi 6.5 Set Bootable Device

As I tried a bare metal installation of VMware vSphere 6.5 on a fresh Mac mini I ran into the condition that I wasn’t able to boot from a USB stick. It simply didn’t show up as a Startup Disk in macOS in the respective application to flag it as a boot device! That’s something that always had been working flawlessly.

After hours of intensive research and trial and error I finally was able to boot into vSphere 6.5 from a USB stick.

Here’s how:

@jnovack
jnovack / highsierra_iso.sh
Last active March 24, 2019 09:04 — forked from peterbladen/highsierra_iso.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
# Do not copy the core, recovery CD ONLY
cp /Volumes/highsierra/Packages/EmbeddedOSFirmware.pkg /Volumes/OS\ X\ Base\ System/System/Installation/
cp /Volumes/highsierra/Packages/FirmwareUpdate.pkg /Volumes/OS\ X\ Base\ System/System/Installation/
cp /Volumes/highsierra/Packages/OSInstall.mpkg /Volumes/OS\ X\ Base\ System/System/Installation/