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 / regex.js
Created June 18, 2020 13:29
Docker Hub Regex for Non-Master Branches
/^([^m].....|.[^a]....|..[^s]...|...[^t]..|....[^e].|.....[^r]|.{0,5}|.{7,})$/
@jnovack
jnovack / test-for-ssh-extension.js
Last active June 14, 2020 17:24
Chrome Test for SSH Extension
var detect=function(base,if_installed,if_not_installed){
var s=document.createElement("script");
s.onerror=if_not_installed,s.onload=if_installed,document.body.appendChild(s),s.src=base+"/html/nassh.html"
};
detect("chrome-extension://pnhechapfaindjhompbnflcldabbghjo",
function(){
console.log("Yes");
},
function(){
@jnovack
jnovack / lscolors.zsh
Created October 19, 2019 11:34
LSCOLORS for zsh
export LSCOLORS=ExFxBxDxCxegedabagacad
cat files | awk '{for(i=1;i<=NF;i++){ tmp=match($i, /PATTERN/); if(tmp){print $i}} }' | sort | uniq -c | sort -rn
@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 March 3, 2025 03:40
Handle CTRL-C in Golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
@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:
#