Skip to content

Instantly share code, notes, and snippets.

View jacobsalmela's full-sized avatar
:octocat:
To all that makes us unique

Jacob Salmela jacobsalmela

:octocat:
To all that makes us unique
View GitHub Profile
@jacobsalmela
jacobsalmela / system-check-win.py
Last active August 29, 2015 14:12
Windows: Open TestNav system check
# Open a URL once a user is logged in
import webbrowser
new = 2 # open in a new tab, if possible
system_check = "https://proctorcaching.pearsonaccess.com/ems/systemCheck/systemCheck.jsp?acc=mn"
webbrowser.open(system_check,new=new)
@jacobsalmela
jacobsalmela / make-full-screen.py
Created January 5, 2015 19:12
Make full screen
# Keystrokes
import win32api
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
# Alt+Space+X or F11 makes it full screen
win32api.Sleep(2500)
# One or the other below should work depending on what browser is being used
#shell.SendKeys("% X")
shell.SendKeys("{F11}")
@jacobsalmela
jacobsalmela / windows-credentials.py
Created January 5, 2015 19:14
Enter sample user credentials
# Click Username field
click(1058,278)
sleep(1)
shell.SendKeys("username")
sleep(1)
shell.SendKeys("{TAB}")
sleep(1)
shell.SendKeys("testcode")
sleep(1)
shell.SendKeys("{ENTER}")
@jacobsalmela
jacobsalmela / sample-test-win.py
Created January 5, 2015 19:15
Opens a sample TestNav site
# Open a URL once a user is logged in
import webbrowser
new = 2 # open in a new tab, if possible
sample_test = "https://testnav.com/mnqc/
webbrowser.open(system_check,new=new)
@jacobsalmela
jacobsalmela / open-testnav.py
Created January 5, 2015 19:17
Opens the real TestNav site
# Open a URL once a user is logged in
import webbrowser
new = 2 # open in a new tab, if possible
testnav = "http://testnav.com/mn/testnav-7.5.22.36/selfRegistration.htm"
webbrowser.open(system_check,new=new)
@jacobsalmela
jacobsalmela / click-win.py
Created January 5, 2015 19:57
Click a coordinate in Windows
click(1000,500)
@jacobsalmela
jacobsalmela / open-in-chrome.sh
Created January 9, 2015 16:32
Opens TestNav in Chrome
# Open test site
osascript -e 'tell application "Google Chrome"
activate
open location "https://testnav.com/mn/testnav-7.5.22.36/"
end tell'
@jacobsalmela
jacobsalmela / launch-tt.sh
Last active August 29, 2015 14:13
Opens the TestTaker app
# Open the TestTaker app
osascript -e 'tell application "NWEA Lockdown Browser"
activate
end tell'
@jacobsalmela
jacobsalmela / osx-set-all-names.sh
Created January 12, 2015 16:38
Set all four OS X computer names using a script.
#!/bin/bash
# Bonjour name ending in .local
scutil --set LocalHostName "My-iMac"
# Friendly name shown in System Preferences > Sharing
scutil --set ComputerName "My-iMac"
# The name recognized by the hostname command
scutil --set HostName "My-iMac"
# Save the computer's serial number in a variable so it can be used in the next command.
serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }')
# Set the NetBIOS name as the serial number
@jacobsalmela
jacobsalmela / html-auto-response.scpt
Created January 12, 2015 19:59
When paired with an Apple Mail rule, this will send a HTML-formatted response automatically to the sender
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
set theName to extract name from sender of eachMessage
if exists reply to of eachMessage then
set theAddress to reply to of eachMessage
else
set theAddress to extract address from sender of eachMessage
end if