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 / rename.sh
Created January 12, 2015 20:21
Rename computers to prepend something
#!/bin/bash
# Get the entire computer name and save it in a variable
#existingName=$(hostname | cut -d'-' -f2-)
existingName=$(hostname)
# Set the computer name to Repurpose-"Existing computer name"
scutil --set LocalHostName "Repurpose-$existingName"
scutil --set ComputerName "Repurpose-$existingName"
scutil --set HostName "Repurpose-$existingName"
serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }')
@jacobsalmela
jacobsalmela / disable-animations.sh
Created January 13, 2015 19:54
Disables a bunch of animations
#!/bin/bash
# opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# showing and hiding sheets, resizing preference windows, zooming windows
# float 0 doesn't work
defaults write -g NSWindowResizeTime -float 0.001
#!/bin/bash
# Click username field
click -x 864 -y 546
# Enter username
osascript -e 'tell application "System Events"
keystroke "I love Pearson"
end tell'
@jacobsalmela
jacobsalmela / safari-bookmarks-testnav.sh
Created January 22, 2015 18:31
Add TestNav bookmarks to Safari
#!/bin/bash
# Set as many bookmarks in Safari as needed
# Adapted from the script by David Koff, 2012 for the J. Paul Getty Trust
# many thanks to both Chris Norris ([email protected]) & Ryan Manly ([email protected]) for their invaluable input
# https://jamfnation.jamfsoftware.com/discussion.html?id=6031
bud='/usr/libexec/Plistbuddy'
plist="/Users/student/Library/Safari/Bookmarks.plist"
urls=('https://testnav.com/mn/testnav-7.5.22.36/'
'https://proctorcaching.pearsonaccess.com/ems/systemCheck/systemCheck.jsp?acc=mn'
@jacobsalmela
jacobsalmela / disable-java-auto-update.sh
Created January 23, 2015 23:57
Disables Java's "Check for updates automatically"
#!/bin/sh
# Modified from https://jamfnation.jamfsoftware.com/discussion.html?id=6489#responseChild49255
# Java Plugin Location
javaPlugin="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"
# Config File Location
configFile="/Library/Application Support/Oracle/Java/Deployment/deployment.config"
# Properties File Location
propFile="/Library/Application Support/Oracle/Java/Deployment/deployment.properties"
@jacobsalmela
jacobsalmela / unshare_all_printers.sh
Last active August 20, 2022 13:57 — forked from rmanly/unshare_all_printers.bash
Unshares printers and disables Printer Sharing
#!/bin/bash
#while read -r _ _ printer _; do
# /usr/sbin/lpadmin -p "${printer/:}" -o printer-is-shared=false
#done < <(/usr/bin/lpstat -v)
# Slightly faster when there are a lot of printers
lpstat -p | grep printer | cut -d" " -f2 | xargs -I{} lpadmin -p {} -o printer-is-shared=false
# Also disable Printer Sharing in the Sharing pane
cupsctl --no-share-printers
@jacobsalmela
jacobsalmela / aprilFoolsMoveMouse.sh
Created January 27, 2015 19:20
April Fools to move mouse to random positions at random intervals
#!/bin/bash
# Randomly moves the mouse and/or clicks
#
# Random delay (in seconds) to trigger an action
function random_delay()
{
RANGE=180
delayInSeconds=$RANDOM
let "delayInSeconds %=$RANGE"
@jacobsalmela
jacobsalmela / suckSafari.scpt
Created January 27, 2015 21:14
April fools Safari "suck" prank
repeat
tell application "System Events" to delay 3.0
tell application "System Events" to set currentApp to name of first process where frontmost is true
if currentApp is "Safari" then
try
tell application "System Events"
tell process "Safari"
key down {shift}
-- Click the minimize button
@jacobsalmela
jacobsalmela / siriControlsSpotify.scpt
Created January 30, 2015 15:33
April fool's Spotify script
repeat
tell application "System Events" to delay 3.0
tell application "System Events" to set currentApp to name of first process where frontmost is true
if currentApp is "Spotify" then
try
-- Create a random number to do one of three things
set randomNum to random number from 1 to 3
if randomNum is 1 then
tell application "Spotify" to pause
@jacobsalmela
jacobsalmela / com.domain.enforceWallpaper
Created February 17, 2015 13:30
Launch Agent to run a script that enforces the wallpaper on Mavericks and Yosemite
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.domain.enforceWallpaper</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/triggers/enforceWallpaper.py</string>
</array>