Skip to content

Instantly share code, notes, and snippets.

@erikng
erikng / ventura.sql
Last active July 29, 2023 19:24
Capable of running macOS Ventura FleetDM Policy
SELECT 1 FROM (
SELECT value from kolide_ioreg where c = 'IOPlatformExpertDevice' and d = 1 and r=1 and key = 'model'
UNION
SELECT value from kolide_ioreg where c = 'IOPlatformExpertDevice' and d = 1 and r=1 and key = 'board-id'
UNION
SELECT value from kolide_ioreg where c = 'IOPlatformExpertDevice' and d = 1 and r=1 and key = 'bridge-model'
) WHERE (value like 'iMac18,1'
or value like 'iMac18,2'
or value like 'iMac18,3'
or value like 'iMac19,1'
@erikng
erikng / showcase_template_new.html
Created March 11, 2021 15:25
new munki banner code
<script type="text/javascript">
var currentSlide = 0, playing = 1
function slides(){
return document.querySelectorAll('div.stage>img')
}
function showSlide(slideNumber){
theSlides = slides()
for (c=0; c<theSlides.length; c++) {
@erikng
erikng / OSLogTest.swift
Created February 15, 2021 22:26 — forked from steipete/OSLogTest.swift
Sample code to access OSLogStore on iOS and macOS.
let subsystem = "com.steipete.LoggingTest"
func getLogEntries() throws -> [OSLogEntryLog] {
// FB8269189: OSLogStore does not work iOS.
let logStore = try OSLogStore(scope: .currentProcessIdentifier)
let oneHourAgo = logStore.position(date: Date().addingTimeInterval(-3600))
#if os(macOS)
let allEntries = try logStore.getEntries(at: oneHourAgo)
#else
@erikng
erikng / missing-link.py
Created January 30, 2020 14:46 — forked from fish2000/missing-link.py
THE MISSING LINK
<?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>PayloadDisplayName</key>
<string>Privacy Preferences Policy Control</string>
<key>PayloadIdentifier</key>
@erikng
erikng / profile_details.py
Created August 30, 2019 20:19 — forked from pudquick/profile_details.py
locally checking profile signing information
#!/usr/bin/python
# So the first thing we need to do is get the mdmclient view of the profiles
import subprocess, objc
from Foundation import NSPropertyListSerialization, NSPropertyListMutableContainers, NSBundle
Security = NSBundle.bundleWithIdentifier_('com.apple.security')
S_functions = [
('SecCertificateCreateWithData', '@@@'),
('SecCertificateCopyValues', '@@^@o^@'),
@erikng
erikng / README.md
Created August 20, 2019 14:20 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@erikng
erikng / gist_dler.py
Last active June 12, 2019 11:01
gist_dler.py
#!/usr/bin/python
'''Downloads gists of a specified user on github. Useful if they are say...
joining a fruit company.'''
import json
import optparse
import os
import requests
require 'base64'
require 'plist'
module Chef::Provider::User::DsclMojaveUserExtensions
# new for 10.14+
def mac_osx_version_greater_than_10_13?
Gem::Version.new(node['platform_version']) > Gem::Version.new('10.13.99')
end
# updated for 10.14+
@erikng
erikng / loginwindow_events.py
Created December 5, 2018 17:13 — forked from pudquick/loginwindow_events.py
Send polite Logout / "really" Logout / Restart / Shutdown Apple Events to loginwindow via python and pyObjC
import struct, objc
from Foundation import NSBundle
from Cocoa import NSAppleEventDescriptor
def OSType(s):
# Convert 4 character code into 4 byte integer
return struct.unpack('>I', s)[0]
# Create an opaque pointer type to mask the raw AEDesc pointers we'll throw around
AEDescRef = objc.createOpaquePointerType('AEDescRef', '^{AEDesc=I^^{OpaqueAEDataStorageType}}')