Skip to content

Instantly share code, notes, and snippets.

View regnerjr's full-sized avatar

John Regner regnerjr

View GitHub Profile
@regnerjr
regnerjr / books24x7Reload.scpt
Created October 10, 2012 15:50
Reload Books24x7 with AppleScript
tell application "Safari"
--trim_line(currentURL, "login.asp", 1)
set the URL of the front document to "http://ezproxy.msoe.edu:2091/"
end tell
--Click Button
tell application "Safari"
delay 3
do JavaScript "document.getElementsByName('loginform')[0].submit()" in front document
end tell
@regnerjr
regnerjr / GoToWebAddress.py
Created December 21, 2012 14:43
Written for Linux Autokey. Prompts for a website then opens that website in you favorite browser.
#Launches specified Website
#Press Hotkey type in web address then goes to that page
siteToVisit=dialog.input_dialog(title="Enter a website", message='', default='google.com')
system.exec_command("/usr/bin/iceweasel", getOutput=False)
window.wait_for_focus("Websites - Iceweasel", timeOut=5)
keyboard.send_keys("<ctrl>+l")
keyboard.send_keys(siteToVisit[1])
keyboard.send_keys("<enter>")
@regnerjr
regnerjr / RunInTerminal.py
Created December 21, 2012 14:45
Written for Linux Autokey. This script prompts for a command and then runs that command in the terminal.
commandToRun=dialog.input_dialog(title="Terminal Command", message='', default='ls')
system.exec_command("/usr/bin/gnome-terminal", getOutput=False)
window.wait_for_focus("Terminal", timeOut=5)
keyboard.send_keys(commandToRun[1])
keyboard.send_keys("<enter>")
(defun john-convert ()
"Takes Hex dump from Wireshark, looks for the ack offset \"3032\"
Then finds the byte offset requested, and converts that hex to binary"
(interactive)
(beginning-of-line)
(search-forward "3032")
(newline)
(while (not (eolp))
(forward-char 2)(princ " " (current-buffer)))
(beginning-of-line)
@regnerjr
regnerjr / SVN log human calendar
Created June 3, 2014 14:33
A shell function for retrieving the svn log for a given human readable time frame, i.e. 2 weeks ago, 1 hour ago. Great for when you get back from lunch and want to see what your co-workers have been upto.
s () {
svn log -r {$(date --date="$*" +%FT%T)}:HEAD -v -g
}
@regnerjr
regnerjr / bfunct
Created June 13, 2014 14:47
Shown declared bash_functions
declare -f | grep -E '^[a-zA-Z]'
@regnerjr
regnerjr / bfunctdef
Created June 13, 2014 14:50
View the details of a defined bash function
bfunctdef () {
#show the definition of a bash_function
# Note the quoting, so the input variable is expanded.
declare -f | awk '/^'$1'/,/^}/'
}
history | awk '{ print $2 }' | awk '{ a[$0]++ } END { for(key in a) print a[key], key }' | sort -rn | head -n 100
//
// ViewController.swift
// Quiz
//
// Created by John Regner on 7/26/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
@regnerjr
regnerjr / Chapter2
Last active August 29, 2015 14:04
iOS Programming: Chapter 2 in Swift
//
// BNRItem.swift
// Created by John Regner on 7/28/14.
//
import Foundation
extension Array {
func randomItem() -> T {
let random = Int(arc4random()) % self.count