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 / bookmark-safari.sh
Last active August 20, 2022 13:57
Bookmark the current site
# Open real test site
killall Safari > /dev/null
osascript -e 'tell application "Safari"
activate
set the URL of the front document to "http://selfregister.testnav.com"
end tell'
sleep 10
# Bookmark site
@jacobsalmela
jacobsalmela / credentials.sh
Last active August 29, 2015 14:08
Enter sample TestNav credentials
# Click full-screen button so all computers have the Safari window in the same position
osascript -e 'tell application "System Events"
set frontmost of process "Safari" to true
tell process "Safari"
click button 4 of window 1
end tell
end tell'
# Sleep for a bit seconds to make sure full screen is fully-activated
sleep 3
@jacobsalmela
jacobsalmela / safari-exceptions.sh
Last active August 20, 2022 13:57
Adds URLs to Safari's exception list
killall Safari > /dev/null
# Set your variable values here
bud='/usr/libexec/Plistbuddy'
plist='/Users/student/Library/Preferences/com.apple.Safari.plist'
urls=('https://www.testnav.com/mn/testnav-7.5.22.36/'
'https://proctorcaching.pearsonaccess.com/ems/systemCheck/systemCheck.jsp?acc=mn'
'https://testnav.com/mnqc/testnav-7.5.22.36/epatLogin.jsp?testnavTestId=TRG10R14&testnavFormId=S01M4'
'https://testnav.com/mnqc/')
@jacobsalmela
jacobsalmela / disable-java-cache.sh
Created November 4, 2014 14:26
Disable Java cache for TestNav
# Set your variable values here
bud='/usr/libexec/Plistbuddy'
plist='/Users/student/Library/Preferences/com.oracle.javadeployment.plist'
# Disable Java cache by adding or setting the plist entry
killall cfprefsd
${bud} -c "Add /com/oracle/javadeployment/:deployment.cache.enabled bool false" ${plist}
#${bud} -c "Set /com/oracle/javadeployment/:deployment.cache.enabled false" ${plist}
killall cfprefsd
@jacobsalmela
jacobsalmela / notifier-via-jss.py
Last active August 29, 2015 14:11
Run terminal-notifier script as root without hanging
#!/usr/bin/python
#-----------IMPORTS----------
import sys,pwd,os
import subprocess
from platform import mac_ver
#----------VARIABLES---------
v, _, _ = mac_ver()
v = float('.'.join(v.split('.')[:2]))
@jacobsalmela
jacobsalmela / app-store-pkgs.sh
Created December 30, 2014 03:15
Save App Store downloads as .pkgs
#!/bin/bash
appStoreFolder=$(sudo find /private/var/folders -type f -name "*.pkg")
i=0
for package in $appStoreFolder
do
sudo ln $package ~/Downloads/_MAS_$i.pkg
i=$(($i+1))
done
@jacobsalmela
jacobsalmela / seeOfficeKey.vbs
Created December 30, 2014 13:59
Reveal Office product key
'http://www.howtogeek.com/206329/how-to-find-your-lost-windows-or-office-product-keys/
'http://discuss.howtogeek.com/t/see-system-product-key-fast/12931
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
@jacobsalmela
jacobsalmela / chrome-settings-for-testnav.sh
Created January 5, 2015 14:24
Enable Java and pop-ups for Pearsons wonderful product.
echo '<?xml version="1.0" encoding="UTF-8"?>' > /Library/Preferences/com.google.Chrome.plist
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> /Library/Preferences/com.google.Chrome.plist
echo '<plist version="1.0">' >> /Library/Preferences/com.google.Chrome.plist
echo ' <dict>' >> /Library/Preferences/com.google.Chrome.plist
echo ' <key>EnabledPlugins</key>' >> /Library/Preferences/com.google.Chrome.plist
echo ' <array>' >> /Library/Preferences/com.google.Chrome.plist
echo ' <string>Java*</string>' >> /Library/Preferences/com.google.Chrome.plist
echo ' </array>' >> /Library/Preferences/com.google.Chrome.plist
echo ' </dict>' >> /Library/Preferences/com.google.Chrome.plist
echo '</plist>' >> /Library/Preferences/com.google.Chrome.plist
@jacobsalmela
jacobsalmela / enable-accessibility.sh
Created January 5, 2015 18:54
00.Enable accessiblity
case ${OSTYPE} in
# Snow Leopard through Mountain lion
darwin10*) touch /private/var/db/.AccessibilityAPIEnabled;;
darwin11*) touch /private/var/db/.AccessibilityAPIEnabled;;
darwin12*) touch /private/var/db/.AccessibilityAPIEnabled;;
# Mavericks and Yosemite
darwin13*) sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT INTO access VALUES('kTCCServiceAccessibility','com.apple.systemevents',0,1,1,NULL);";
sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT INTO access VALUES('kTCCServiceAccessibility','com.apple.RemoteDesktopAgent',0,1,1,NULL);";;
darwin14*) sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT INTO access VALUES('kTCCServiceAccessibility','com.apple.systemevents',0,1,1,NULL);";
sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT INTO access VALUES('kTCCServiceAccessibility','com.apple.RemoteDesktopAgent',0,1,1,NULL);";;
@jacobsalmela
jacobsalmela / safari-fullscreen.sh
Created January 5, 2015 19:02
Make Safari full-screen
# Click full-screen button so all computers have the Safari window in the same position
osascript -e 'tell application "System Events"
set frontmost of process "Safari" to true
tell process "Safari"
click button 4 of window 1
end tell
end tell'