Skip to content

Instantly share code, notes, and snippets.

:atom:
Thinking

Jacob Salmela jacobsalmela

:atom:
Thinking
Block or report user

Report or block jacobsalmela

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jacobsalmela
jacobsalmela / verifyChecksum.sh
Created Mar 7, 2016
Displays a dialog with three checksums to prevent the installation of malware
View verifyChecksum.sh
osascript <<EOT
display dialog "MD5:
$(openssl md5 $1 | awk '{print $2}')
SHA1:
$(openssl sha1 $1 | awk '{print $2}')
SHA256:
$(openssl dgst -sha256 $1 | awk '{print $2}')" with title "$(basename $1)" with icon Caution
EOT
@jacobsalmela
jacobsalmela / recentServersSFL.py
Created Dec 28, 2015 — forked from pudquick/recentServersSFL.py
Working with SharedFileList (.sfl) files from OSX 10.11 El Capitan in python
View recentServersSFL.py
from Foundation import NSKeyedUnarchiver
from struct import unpack
# This entire function is black magic of the highest order and I'll blog about it later
def extract_share(bookmark_data):
content_offset, = unpack('I', bookmark_data[12:16])
first_TOC, = unpack('I', bookmark_data[content_offset:content_offset+4])
first_TOC += content_offset
TOC_len, rec_type, level, next_TOC, record_count = unpack('IIIII', bookmark_data[first_TOC:first_TOC+20])
TOC_cursor = first_TOC + 20
@jacobsalmela
jacobsalmela / sortDropboxPhotos.sh
Created May 10, 2015
Sort Dropbox Camera Uploads by EXIF location
View sortDropboxPhotos.sh
#!/bin/bash
apiKey="abcD12345efGhIJkLmn-abcD12345efGhIJkLmn_cO_8"
filename=$(basename "$1")
filename="${filename%.*}"
directoryname=$(dirname "$1")
latitude=$(mdls "$1" | awk '/Latitude/ {print $3}')
longitude=$(mdls "$1" | awk '/Longitude/ {print $3}')
data=$(curl -s https://maps.googleapis.com/maps/api/geocode/json?latlng="$latitude","$longitude"&key="$apiKey")
city=$(echo "$data" | grep "formatted_address" | head -1 | cut -d',' -f2 | sed -e 's/^[ \t]*//')
case "$city" in
@jacobsalmela
jacobsalmela / pmset.py
Created Mar 9, 2015
pmset every computer with one script
View pmset.py
#!/usr/bin/python
#----------AUTHOR------------
# Jacob Salmela
# 02 March 2015
#-----------IMPORTS----------
from os import system
from subprocess import call
from socket import gethostname
@jacobsalmela
jacobsalmela / setFavServers.sh
Created Mar 9, 2015
Add unlimited servers to the Connect To... menu in OS X
View setFavServers.sh
#!/bin/bash
bud='/usr/libexec/Plistbuddy'
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist'
servers=('afp://servername'
'smb://servername'
'vnc://servername'
'ftp://servername')
killall cfprefsd
@jacobsalmela
jacobsalmela / removeLoginItems.sh
Created Mar 3, 2015
Removes the current user's login items
View removeLoginItems.sh
osascript -e 'tell application "system events" to delete login items'
@jacobsalmela
jacobsalmela / create_users.py
Created Mar 3, 2015
Create users via the JSS based on the computer name.
View create_users.py
#!/usr/bin/python
#----------AUTHOR------------
# Jacob Salmela
# 20 February 2014
# Updated: 2014-12-11
#-----------IMPORTS----------
from os import system
from subprocess import call
from socket import gethostname
@jacobsalmela
jacobsalmela / set_dock.py
Created Mar 3, 2015
Single script to set the dock for multiple users
View set_dock.py
#!/usr/bin/python
#----------AUTHOR------------
# Jacob Salmela
# 3 January 2014
#-----------IMPORTS----------
from subprocess import call
from platform import mac_ver
from re import findall
from socket import gethostname
@jacobsalmela
jacobsalmela / enforceMacHD.sh
Created Feb 26, 2015
Reset the volume name to "Macintosh HD" if it is different.
View enforceMacHD.sh
#!/bin/bash
volumeName=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}')
echo "Current volume name: $volumeName"
# If the volume is not named Macintosh HD
if [ "$volumeName" != "Macintosh HD" ];then
# Rename it
diskutil renameVolume "$volumeName" "Macintosh HD"
volumeName=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}')
echo "Root volume is now named: $volumeName"
@jacobsalmela
jacobsalmela / removeSSID.sh
Created Feb 26, 2015
Remove an SSID from the preferred networks list
View removeSSID.sh
#!/bin/bash
#----------VARIABLES---------
undesiredNetwork="SSID-To-Remove"
wifiOrAirport=$(/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(Wi-Fi|AirPort)')
echo $wifiOrAirport
wirelessDevice=$(networksetup -listallhardwareports | awk "/$wifiOrAirport/,/Device/" | awk 'NR==2' | cut -d " " -f 2)
echo $wirelessDevice
#-----------SCRIPT-----------
# Remove the SSID from the list of preferred networks
You can’t perform that action at this time.