Skip to content

Instantly share code, notes, and snippets.

@erikng
erikng / clean_old_apple_updates.py
Created May 10, 2018 21:35 — forked from grahamgilbert/clean_old_apple_updates.py
Clean out old apple updates (older than 24 hours) because softwareupdate often refuses to install them
#!/usr/bin/python
"""
Removes cached apple updates that are older than 24 hours
"""
import datetime
import os
import shutil
import sys

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@erikng
erikng / 802.1x Fix.py
Created March 9, 2018 20:32 — forked from joshua-d-miller/802.1x Fix.py
When deploying an EAP-TLS profile for 802.1x Ethernet, this script will create a User Identity preference which will allow a logged in user to use any Ethernet interface that is connected to their machine.
#!/usr/bin/python
# pylint: disable=C0103, W0612, E1101, E0602, E0611
# pylint: disable=W0101, W0110, W0141
''''Fix 802.1x When Using Config Profiles and EAP-TLS'''
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script will determine the profile ID that was used when
# installing the 802.1x Ethernet Identity preference and make
# a copy of the keychain entry to be used as a user identity preference
# so that any Ethernet can be used when a user is logged in. As of 10.12.3
@erikng
erikng / 802.1x System Fix.py
Created March 9, 2018 20:31 — forked from joshua-d-miller/802.1x System Fix.py
This script will allow your 802.1x Configuration Profile to work on any other Ethernet interface at the System Level
#!/usr/bin/python
# pylint: disable=E0611, E1101, E0602
''''Fix 802.1x When Using Config Profiles and PEAP-MSCHAPV2 or EAP-TLS'''
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script will find the system profile that is attached to one ethernet
# interface from our configuration profile and then copy it to all other
# ethernet interfaces so that other ethernet interfaces can be used instead
# of just the FirstActiveEthernet at time of profile installation. This issue
# is still an issue as of 10.12.3
@erikng
erikng / sample_802.1x_loginwindow.mobileconfig
Created March 9, 2018 15:41 — forked from bruienne/sample_802.1x_loginwindow.mobileconfig
Skeleton mobileconfig plist that enables 802.1x login to Wifi network at OS X login window
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadCertificateFileName</key>
<string>my.org.cer</string>
<key>PayloadContent</key>
@erikng
erikng / seedutil.md
Created November 30, 2017 17:07 — forked from pookjw/seedutil.md
Enroll macOS Beta Seed without profile installation

seedutil

Enroll macOS Beta Seed without profile installation

Usage

$ sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil 
usage: seedutil enroll SEED_PROGRAM
    seedutil unenroll

seedutil current

@erikng
erikng / xcodemarkdown.sh
Created September 25, 2017 20:34 — forked from MagerValp/xcodemarkdown.sh
Convert markdown to html in a shell script using Xcode's CommonMark framework
#!/bin/bash
cat <<__MARKDOWN__ |
# Title ÅÄÖ
* list
__MARKDOWN__
/usr/bin/python <( cat <<__EOF__
#!/usr/bin/python
@erikng
erikng / make_firmwareupdater_pkg.sh
Created September 12, 2017 15:59
Make standalone "universal" FirmwareUpdater package for High Sierra
#!/bin/sh
# Based on investigations and work by Pepijn Bruienne
# Expects a single /Applications/Install macOS Sierra*.app on disk
# Adapted from https://gist.github.com/gregneagle/7c802aef636ac4295536f2e360921bb1
IDENTIFIER="com.foo.FirmwareUpdateStandalone"
VERSION=1.0
# find the Install macOS Sierra.app and mount the embedded InstallESD disk image
echo "Mounting Sierra ESD disk image..."
@erikng
erikng / xcode_get.py
Created February 1, 2017 22:23 — forked from pudquick/xcode_get.py
Stupid tricks: using stock macOS python subprocess with curl to download products from Apple's Developer Center
from subprocess import Popen, PIPE, STDOUT, check_output
from mimetools import Message
from StringIO import StringIO
from urlparse import urlparse, parse_qs
from urllib import quote, basejoin, urlencode
DEV_SITE = 'https://developer.apple.com'
AUTH_SITE = 'https://idmsa.apple.com'
AUTH_PATH = '/IDMSWebAuth/authenticate'
APPIDKEY_PATH = "/services-account/download?path=%s"
@erikng
erikng / convert.go
Created January 5, 2017 21:22 — forked from groob/convert.go
package main
import (
"fmt"
"image"
"image/draw"
"image/jpeg"
"image/png"
"io"
"log"