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 / alpine-nfs.md
Last active May 2, 2024 16:02
Setting up an Alpine NFS v4 Server
Welcome to Alpine!

The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org>.

You can setup the system with the command: setup-alpine

You may change this message by editing /etc/motd.
@jnovack
jnovack / break.go
Last active April 4, 2024 15:06
Handle CTRL-C in Golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
@jnovack
jnovack / README.md
Last active April 3, 2024 03:24
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --add-service=mosh --permanent
  3. firewall-cmd --reload

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@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 / install_tmux.sh
Last active January 17, 2024 18:05
tmux installation on Mac OSX Catalina
#!/bin/sh
## setup _________________________________
TMUX_VER=3.3a
LIBEVENT_VER=2.1.12-stable
OPENSSL_VER=1_1_1v
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
@jnovack
jnovack / README.md
Last active November 1, 2023 23:07
Proxy SSL Client Certificate through NGINX Load-Balancer

Proxy SSL Client Certificate through NGINX Load-Balancer

The frontend stream proxy_pass can be used for load-balancing without SSL off-loading. All SSL connections will be terminated on the backend and client certificate information can be properly authenticated.

This should be used in cases:

  • you have enough CPU to decrypt SSL on the backend servers
  • you require direct client AUTHENTICATION on the backend servers

Backend

@jnovack
jnovack / bluetooth.sh
Created January 18, 2017 15:38
Control Bluetooth Daemon through Command Line OSX
#read the current pref, returns '0' for off and '1' for on.
defaults read /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState
#set bluetooth pref to off
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0
#set bluetooth pref to on
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1
#kill the bluetooth server process
@jnovack
jnovack / alfred-4-open-iterm.applescript
Created May 31, 2019 11:14
Alfred 4 Custom Terminal Applescript to Open iTerm
-- Alfred 4 Custom Terminal Script for iTerm
-- To Install, copy to: Alfred --> Features --> Terminal --> Custom
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"iTerm\"
activate
try
@jnovack
jnovack / untitled.js
Created July 23, 2020 15:08
ServiceNow - Decrypt sys_auth_profile_basic Password
var sysid = "INSERT_SYS_ID_HERE";
var Encrypter = new GlideEncrypter();
var gr = new GlideRecord('sys_auth_profile_basic');
gr.addQuery("sys_id", sysid);
gr.query();
while (gr.next()) {
var encrypted = gr.password;
var decrypted = Encrypter.decrypt(encrypted);
gs.addInfoMessage(decrypted);
}
@jnovack
jnovack / cisco-decrypt-type7-password.js
Last active July 20, 2021 17:38
Javascript function() to decrypt Type 7 passwords from Cisco
function crackPassword(password) {
var crypttext = password.toUpperCase();
var plaintext = '';
var xlate = "dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87";
var seed, i, val = 0;
if(crypttext.length & 1)
return;
seed = (crypttext.charCodeAt(0) - 0x30) * 10 + crypttext.charCodeAt(1) - 0x30;