Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Powell stringsn88keys

View GitHub Profile
@stringsn88keys
stringsn88keys / send_message.applescript
Created Sep 16, 2022
Send an iMessage from the command line (one arg at a time)
View send_message.applescript
#!/usr/bin/env osascript
# https://chrispennington.blog/blog/send-imessage-with-applescript/
on run parameters
# the number here is the number of seconds
set theDelay to 3
# Verify if this can use display names
set phoneNumber to "+1 (555) 555-1212"
tell application "Messages"
set targetBuddy to phoneNumber
@stringsn88keys
stringsn88keys / bundle_info_all
Last active Aug 31, 2022
bundle info for all gems
View bundle_info_all
bundle list 2>&1 | sed 's/^ \* \(.*\) (.*)/\1/' | grep -v 'bundle info' | grep -v 'bundle:' | xargs -I {} bundle info {}
@stringsn88keys
stringsn88keys / keep_alive_and_window_mover.ino
Last active Apr 28, 2022
Arduino LCD Keypad hotkey example which moves windows
View keep_alive_and_window_mover.ino
#include <Keyboard.h>
#include <Mouse.h>
#include <LiquidCrystal.h>
/*
Arduino 2x16 LCD - Detect Buttons
modified on 18 Feb 2019
by Saeed Hosseini @ Electropeak
https://electropeak.com/learn/
@stringsn88keys
stringsn88keys / keep_alive_with_led_reset_blink.ino
Created Apr 26, 2022
Arduino mouse mover to keep PC awake
View keep_alive_with_led_reset_blink.ino
@stringsn88keys
stringsn88keys / convert_times
Last active Apr 22, 2022
Ruby script to display time zone equivalents for a given time
View convert_times
#!/usr/bin/env ruby
require 'time'
require 'tzinfo'
require 'colorize'
def usage
puts %q(
usage:
convert_times {time string to parse, spaces ok}
@stringsn88keys
stringsn88keys / parse_pipedelimited.sql
Created Mar 1, 2022
MySQL to parse multiline pipe delimited strings into returned rows
View parse_pipedelimited.sql
<!-- wp:code -->
<pre class="wp-block-code"><code>
select list.i,
substring_index(substring_index(
substring_index(
substring_index(
'9977034 | e9e82737-db8f-44c0-985b-d004788aa91d | 208
3393402 | aa1cbfe0-a66d-44ac-9b66-bd2369c96e52 | 136
3524174 | 490dbaa0-faed-4773-b3c0-4c979e1b07cb | 250
@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 Apr 21, 2022
"Type" old and new passwords into Windows Server 2016 change password screen when 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 / .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