Skip to content

Instantly share code, notes, and snippets.

@bochoven
bochoven / department_to_passphrase.sh
Created December 4, 2020 10:15
Set MunkiReport Machinegroup based on Jamf department
#!/bin/sh
# This ugly script sets the proper passphrase per department
# it retrieves the department via the JAMF API
API_URL=https://YOURJAMFSERVER:8443/JSSResource
API_USER=api_user
API_PASS=$4
# Get serial number
myserial=$(system_profiler SPHardwareDataType | awk '/Serial Number/{print $4}')
@bochoven
bochoven / stack_ibook_sync.py
Created April 11, 2019 14:21
Downloads iBooks from a public Stack repository.
#!/usr/bin/python
# encoding: utf-8
''' Downloads iBooks from Stack storage
Complexity is a result from the CSRF token that is needed for the download.
'''
import urllib, urllib2, json, re, cookielib, os, xattr
from Cocoa import NSWorkspace, NSImage
PAGE_URL = 'https://username.stackstorage.com/s/6hjYxxxxKnp6x'
#!/bin/sh
# Script that creates two installer packages with the same destination app
# but different CFBundleIdentifiers.
# These trigger in macOS installer the creation of a .localized version
mkdir -p /tmp/test/Applications/Test.app/Contents
/usr/libexec/plistbuddy -c "Add :CFBundleIdentifier string macadmins.test.1" /tmp/test/Applications/Test.app/Contents/Info.plist
pkgbuild --root /tmp/test /tmp/test.1.pkg
/usr/libexec/plistbuddy -c "Set :CFBundleIdentifier string macadmins.test.2" /tmp/test/Applications/Test.app/Contents/Info.plist
@bochoven
bochoven / users.py
Created June 3, 2017 05:37
macOS: Get all local users and calculate the size of the homedirectory
#!/usr/bin/python
# Get all local users and calculate the size of the homedirectory
import os, pwd, plistlib
system_accounts = ['root', 'daemon', 'nobody', 'Guest']
account_list = []
def get_size(start_path):
total_size = 0
<?php $this->view('partials/head', array('scripts' => array('clients/client_list.js'))); ?>
<?php //Initialize models needed for the table
new Machine_model;
new Reportdata_model;
new department_model;
?>
<div class="container">
@bochoven
bochoven / custom.js
Created August 6, 2015 08:33
Site info module for Munkireport javascript
/*!
* Custom javascript for munkireport
*
*/
$(document).on('appReady', function(e, lang) {
// Add Site info to listing
var listingDropdown = $('span[data-i18n="nav.main.listings"]').parent().next();
listingDropdown.append(
$('<li>')
@bochoven
bochoven / gist:4d27022a63c725c3a2b9
Created June 17, 2015 12:31
Mac OSX: gather info on local disks
#!/usr/bin/python
"""Mac OS X Disk/Volume script for munkireport.
https://github.com/munkireport/munkireport-php
Some ideas and functions are borrowed from gmacpyutil
https://github.com/google/macops
The script iterates over all partitions and returns a list
of Volumes with basic info (TotalSize, FreeSpace, MountPoint, VolumeName)
@bochoven
bochoven / Office Update 2011 14.4.8 NL
Created February 13, 2015 15:25
Office Update 2011 14.4.8 NL
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>jenkins</string>
<key>creation_date</key>
<date>2015-02-13T13:32:57Z</date>
@bochoven
bochoven / Office 2011 Update 14.4.8 EN
Last active December 15, 2016 07:33
Office 2011 Update 14.4.8 EN
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>jenkins</string>
<key>creation_date</key>
<date>2015-02-11T04:46:00Z</date>
@bochoven
bochoven / makehtaccess
Last active August 29, 2015 14:08
Create htaccess file from pkginfo files
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright 2009-2014 Arjen van Bochoven.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0