Skip to content

Instantly share code, notes, and snippets.

View tresni's full-sized avatar

Brian Hartvigsen tresni

View GitHub Profile
@tresni
tresni / README.md
Created September 8, 2020 17:49
Enabling Yubikey for sudo on OSX

Intro

Primarily, I use TouchID for sudo authentication on OSX, but I also tend to be connected to a CalDigit TS3 Plus dock and external monitors with my laptop lid closed. TouchID does not work in that situation.

In my quest to have another solution I found the instructions from Yubikey[1][2]. Unfortunately, the instructions are not well laid out, with formatting issues and some necessary information just missing. I hope to rectify that with this document.

Prerequisites

This has been tested on MacOS 10.14.6 and should work on MacOS 10.15. This README assumes you are using Homebrew; it should be possible to configure everything w

@tresni
tresni / gist:83b9181588c7393f6853
Last active February 19, 2024 08:00
Authy to 1Password

Moving Authy to 1Password

1Password 5.3 for OSX, 5.2 for iOS, and 4.1.0.538 for Windows support OTP. I've been using Authy for a while now, but the fact is, I haven't really been using 2FA for some time. As mentioned by 1Password in a recent blog post, having the OTP generator and password on the same device is very much not 2FA. It's just an expiring OTP, which can help, but let's not kid ourselves too much.

With that out of the way. One of the things that was interesting to me was moving my OTP out of Authy and into 1Password. I like the control I get with 1Password, but I didn't want to have to reset all my OTP right away, that would suck. So, I got to dissecting the Authy Chrome App to see what I could do.

Run the Authy Chrome app and make sure it's unlocked.

Now, enable Developer mode in Chrome. We'll need this to inspect the background application that stores al

@tresni
tresni / gist:bff44200a3afec4d3696724b1d22d636
Created August 1, 2023 22:08
So you are leaving your company...

🎉 Congratulations! 🎉

Making the decision to leave a company can be a hard decision to make. Whether it was or not, you've made the choose and are going on a new adventure, that always deserves congratulations.

In this gist you'll find resources that people have found useful to know about when transitioning companies.

Stock and Equity

Most companies give you a limited time to exercise your options after you leave the company (usually somewhere in the 90 day range.)

#! /bin/bash
GIT_REPO=${GIT_REPO:-git@github.com:tresni/dotfiles.git}
DOTFILES_PATH=${DOTFILES_PATH:-$HOME/.dotfiles}
git clone --bare "${GIT_REPO}" "${DOTFILES_PATH}"
function dotfiles {
/usr/bin/git --git-dir="${DOTFILES_PATH}" --work-tree="$HOME" $@
}
mkdir -p "${DOTFILES_PATH}-backup"
@tresni
tresni / maximal.zsh-theme
Created September 12, 2020 21:07
My custom ZSH theme, hacked up minimal theme.
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}%{$fg[white]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_SCM_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_SCM_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
@tresni
tresni / add_route.sh
Last active April 27, 2020 22:32
openconnect utilities
#! /bin/bash
INTERFACE=$(route -n get wwwin.cisco.com | awk ' /interface: / { print $2 } ')
DEFAULT=$(route -n get default | awk ' /interface: / { print $2 } ')
add_route () {
sudo route add -net $1 $2
}
if [ $DEFAULT != $INTERFACE ]; then
@tresni
tresni / 1.Start.gcode
Last active April 21, 2020 02:21
Ender 3 Startup Code
; Ender 3 Custom Start G-code
M117 Heating bed...
M190 S{material_bed_temperature_layer_0} ; Want bed hot before level
M117 Reset extruder
G92 E0 ; Reset Extruder
M117 Homing all...
G28 ; Home all axes
;M117 Homing Z Probe...
#!/bin/sh
reset_host() {
all="$1 $(dig +short $1) $(dig +short aaaa $1)"
for ident in $all
do
ssh-keygen -f ~/.ssh/known_hosts -R $ident
ssh-keyscan $ident >>~/.ssh/known_hosts
done
@tresni
tresni / csd-wrapper.sh
Created September 14, 2017 23:56 — forked from l0ki000/csd-wrapper.sh
Cisco Anyconnect CSD wrapper for OpenConnect (exhanced to autodownload and autoupdate hostscan)
#!/bin/bash
# Cisco Anyconnect CSD wrapper for OpenConnect
# Enter your vpn host here
if [[ -z ${CSD_HOSTNAME} ]]
then
echo "Define CSD_HOSTNAME with vpn-host in script text. Exiting."
exit 1
fi
import re
import os
import sys
for root, dirs, files in os.walk("."):
for f in files:
if f == "README.md" or f == "test.py":
continue
if f.startswith("."):
continue