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 / 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 / unshare_all_printers.sh
Last active Nov 19, 2018 — forked from rmanly/unshare_all_printers.bash
Unshares printers and disables Printer Sharing
View unshare_all_printers.sh
#!/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 / set-wallpaper-universal.py
Last active Aug 29, 2015 — forked from gregneagle/gist:6957826
(OS X) Universal script for setting the wallpaper. Works on 10.6-10.9
View set-wallpaper-universal.py
#!/usr/bin/python
# Universal wallpaper script for 10.6 and up
from AppKit import NSWorkspace, NSScreen
from Foundation import NSURL
from platform import mac_ver
from subprocess import call
from os import system
# Set path here for 10.9
picture_path = "/Library/Desktop Pictures/Custom.jpg"
You can’t perform that action at this time.