Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Powell stringsn88keys

View GitHub Profile
@stringsn88keys
stringsn88keys / init.lua
Last active Jul 20, 2021
Hammerspoon init script to auto-arrange for three screens.
View init.lua
-- https://en.wikipedia.org/wiki/Web_colors#X11_color_names
-- hs.streamdeck.init(function(connected, sd)
-- device = hs.streamdeck.getDevice(1)
-- device.setButtonColor("1", hs.drawing.color.x11.teal)
-- end)
applications = { "Messages", "iTunes", "Skype for Business", "iTerm2", "Microsoft Outlook", "HipChat", "Microsoft OneNote", "MacVim", "RubyMine", "Firefox" }
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "pageup", function()
@stringsn88keys
stringsn88keys / change_pass.js
Created Mar 31, 2021
"Type" old and new passwords into Windows Server 2016 change password screen went WorkSpaces doesn't allow pasting from your Mac.
View change_pass.js
#!/usr/bin/osascript -l JavaScript
// Usage:
// export OLDPASS="oldpasswordhere!"
// export NEWPASS="newpasswordgoeshere."
// get to change password screen in WorkSpace prior to running this script and make sure you're on the "old password" field.
// run script without args
var app = Application.currentApplication();
app.includeStandardAdditions = true
@stringsn88keys
stringsn88keys / change_pass.applescript
Last active Mar 31, 2021
"Type" old and new passwords into Windows Server 2016 change password screen went WorkSpaces doesn't allow pasting from your Mac.
View change_pass.applescript
#!/usr/bin/osascript
# Usage:
# export OLDPASS="oldpasswordhere!"
# export NEWPASS="newpasswordgoeshere."
# get to change password screen in WorkSpace prior to running this script and make sure you're on the "old password" field.
# run script without args
on sysKeyCode(kc)
tell application "System Events" to key code {kc} using {command down}
@stringsn88keys
stringsn88keys / update_bundles.rb
Last active May 6, 2019
My current ruby script to update vim bundles... can't remember whose blog I got the starter from at this point.
View update_bundles.rb
#!/usr/bin/env ruby
git_bundles = [
"https://github.com/kien/ctrlp.vim",
"git://github.com/tpope/vim-fugitive.git",
# "git://github.com/tpope/vim-rails.git",
# "git://github.com/tpope/vim-abolish.git",
# "https://github.com/rizzatti/dash.vim.git",
"https://github.com/wavded/vim-stylus.git",
"git://github.com/slim-template/vim-slim.git",
@stringsn88keys
stringsn88keys / .zlogin
Last active Jul 25, 2018
.zlogin hooks to switch your config back from "production"
View .zlogin
function safety_preexec() {
# Store the command that we're running.
CMD_NAME="$1"
}
function safety_precmd() {
if [[ "$CMD_NAME" =~ 'kubectl config use-context whatever-your-prod-is' ]]; then
PROD_TIME=$(date +%s)
@stringsn88keys
stringsn88keys / getuielementsinhipchat.scpt
Created Apr 8, 2018
UI Elements debug for the HipChat application
View getuielementsinhipchat.scpt
tell application "System Events"
entire contents of process "HipChat" of application "System Events"
-- UI elements of process "HipChat" of application "System Events"
end tell
@stringsn88keys
stringsn88keys / gist:b0bb6ba514e474a364606adbac9bd2a8
Last active Apr 7, 2018
AppleScript to track who you're chatting with and save it to a parseable file.
View gist:b0bb6ba514e474a364606adbac9bd2a8
set myFile to open for access (choose file name) with write permission
try
repeat
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
if (frontApp = "HipChat") then
-- set things to entire contents of group 1 of group 1 of group 1 of window 1
-- set things to UI elements of group 1 of group 1 of group 1 of window 1
@stringsn88keys
stringsn88keys / postgres_setup.sh
Created Dec 7, 2017
Setting up old version of Postgres via Homebrew
View postgres_setup.sh
# doh this is a keg-only formula. Had to manually link CLI regardless of install method
# run these to set up
brew tap homebrew/versions
brew install homebrew/versions/postgres94
brew services start postgresql@9.4 export
# in your shell's RC file:
PATH=/usr/local/opt/postgresql@9.4/bin:$PATH
LDFLAGS=-L/usr/local/opt/postgresql@9.4/lib
CPPFLAGS=-I/usr/local/opt/postgresql@9.4/include
@stringsn88keys
stringsn88keys / gosha3.go
Created Jul 22, 2017
Go Sha3 hash search, single threaded and with concurrency of 2.
View gosha3.go
package main
import (
"encoding/base64"
"fmt"
"golang.org/x/crypto/sha3"
"strings"
"time"
)
View stub_settings.rb
# a module included
module StubSettings
def stub_setting(setting_name, setting_value)
allow(Setting).to receive(:[]).with(setting_name).and_return(setting_value)
end
def stub_setting_assignment
allow(Setting).to receive(:[]=) { |setting, value| stub_setting(setting, setting) }
end
end