Skip to content

Instantly share code, notes, and snippets.

@rrotter
rrotter / completion.zsh
Created May 24, 2024 21:39
zsh completion for kubectl and anything else
# Adding the following to the _end_ of your zshrc should
# (1) enable completion for most commands
# (2) work on any os zsh and kubectl can be installed on
# (3) enable completion for kubectl even if some common configuration issues are present
# (4) enable zsh completion for aws and tk
# (5) be safe to append to .zshrc without a further thought (please don't)
#
# That being said, you almost certainly don't need every line in this file.
# Reading through this should help you understand zsh completion setup enough
# to choose what to copy for your own configuration.
@rrotter
rrotter / create_issue.rb
Last active February 7, 2019 16:50
Use jira-ruby Jira API Gem to make a new issue
#!/usr/bin/env ruby
require 'jira-ruby'
options = {
:username => 'service-account-user',
:password => 'service-account-pass',
:site => 'https://jira.server.domain',
:context_path => '/jira',
:auth_type => :basic
@rrotter
rrotter / resolv-fix
Created November 16, 2018 23:23
Script to write resolv.conf in WSL
#!/bin/bash
# Write out resolv.conf based on Windows DNS settings.
# I have attemped to replicate the stock WSL behavior, except where noted.
# To run this w/ password-less sudo, add the following to your shell initialization
# If you don't understand what this does, look it up, DO NOT just trust me that it's okay
# %sudo ALL=(ALL:ALL) NOPASSWD: /usr/local/sbin/resolv-fix
# Set powershell path, you may have to change this for your environment
@rrotter
rrotter / shutdown_if_idle.sh
Last active June 22, 2018 19:17
Run this out of root cron to shut down inactive server
#!/bin/bash
# true if console users are idle or non-existant
function no_active_users()
{
if [ `w -sh | sed 's/\s\{1,\}/\t/g' | cut -f4 | egrep '^[0-9\:\.s]+$' | wc -l` -eq 0 ]
then
return 0
fi
return 1
@rrotter
rrotter / keys.ahk
Last active March 11, 2018 21:22
Make Surface Book 2 Keyboard shortcuts as Mac-like as possible
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; First, use a registry remapping tool like SharpKeys to swap Alt and Ctrl
; This is an exercise left to the reader.
; (I map both Alts to Right Ctrl, Caps to LCtrl, and the Application Key to RWin. You should at least make all Ctrls
; Alts and all Alts Ctrls)
@rrotter
rrotter / README.md
Last active July 20, 2017 01:07
LaunchAgent to fix dev paths in vmdk for "Boot Camp" disk on hackintosh

vmdkcheck

LaunchAgent to fix dev paths in vmdk for "Boot Camp" disk on hackintosh. If your motherboard can't enumerate disk consistantly this will help VMware find your Windows partition.

  1. Put the ruby script somewhere.
  2. Put your own UUID and VMDK paths in the script.
  3. Install the plist in /Library/LaunchAgents
  4. Fix the path in the plist to match where your script is.
@rrotter
rrotter / boxstarter.txt
Created July 16, 2017 07:35
My choco/boxstarter file
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Disable-GameBarTips
Install-WindowsUpdate -Full
cinst GoogleChrome
cinst VisualStudioCode
cinst Steam
@rrotter
rrotter / better_search.user.js
Last active June 4, 2024 20:19
Userscript to make Jira search suck less
// ==UserScript==
// @name Jira Better Search
// @namespace tools.lib.umich.edu
// @description Makes the useless Jira search bar into a palette for saved queries and query fragments
// @include *tools.lib.umich.edu/jira*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js
// @version 1
// @grant none
// ==/UserScript==
@rrotter
rrotter / gist:59ebefe9d981a3c69bdb13add253bc87
Created December 19, 2016 21:32
Fix incorrect DNS search domain behavior on OS X
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist AlwaysAppendSearchDomains -bool YES
sudo launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
@rrotter
rrotter / private.xml
Created October 30, 2015 04:21
My Karabiner settings, including fixes for Matias Ergo Pro
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>APPLE</vendorname>
<vendorid>0x05ac</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>MATIAS_ERGO_PRO</productname>
<productid>0x024f</productid>
</deviceproductdef>