Skip to content

Instantly share code, notes, and snippets.

View AndrewWCarson's full-sized avatar
🐦

Andrew Worth Carson AndrewWCarson

🐦
View GitHub Profile
@pudquick
pudquick / bom.py
Last active November 18, 2021 15:55
Parsing of bom files in pure python
# Python routines for parsing bom files
#
# Examples so far:
#
# dump_bom(filename) - prints diagnostic structure information about bom file (including path list)
from ctypes import BigEndianStructure, c_char, c_uint8, c_uint16, c_uint32, sizeof, memmove, addressof
class BOMHeader(BigEndianStructure):
_pack_ = 1
@pudquick
pudquick / AppleJRE.py
Created April 9, 2015 05:40
Use Apple's PrivateFramework "JavaLaunching" functions to determine if the Apple JRE is installed (without triggering the dialog)
import sys
from ctypes import CDLL
JavaLaunching = CDLL('/System/Library/PrivateFrameworks/JavaLaunching.framework/JavaLaunching')
if (JavaLaunching.JLIsRuntimeInstalled() == 0):
print "Apple JRE is not installed."
sys.exit(1)
else:
print "Apple JRE is installed."
sys.exit(0)
@pudquick
pudquick / beamsync.py
Last active September 28, 2023 15:16
#!/usr/bin/python
import ctypes, ctypes.util
# Import CoreGraphics as a C library, so we can call some private functions
c_CoreGraphics = ctypes.CDLL(ctypes.util.find_library('CoreGraphics'))
def disable_beam_sync(doDisable):
if doDisable:
# Disabling beam sync:
# 1st: Enable Quartz debug
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active March 20, 2025 20:23
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@lv10
lv10 / gist:8547663
Created January 21, 2014 20:24
Fetch Paper Names and Page Sizes for a Printer - Obj-C/C
// ================================
// COPrinterPaperSizes.h
// ================================
#import <Foundation/Foundation.h>
#define PAPER_NAME @"paper_name"
#define PAPER_SIZE @"paper_size"
@interface COPrinterPaperSizes: NSObject
@mayoff
mayoff / gist:1138816
Last active December 8, 2023 22:00
AppleScript to make Google Chrome open/reload a URL
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *)
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false