Skip to content

Instantly share code, notes, and snippets.

@pudquick
pudquick / Info.plist
Created October 29, 2019 03:57 — forked from steventroughtonsmith/Info.plist
[Catalyst] Registering for & responding to AppleScript events in a Mac Catalyst app
<key>NSAppleScriptEnabled</key>
<true/>
<key>OSAScriptingDefinition</key>
<string>ScriptableTasks.sdef</string>
@pudquick
pudquick / get_serial.py
Created September 5, 2018 23:48 — forked from pdarragh/get_serial.py
Short PyObjC script to get a Mac's serial number without calling `system_profiler`.
#!/usr/bin/python
# (Note that we must use system Python on a Mac.)
####
# Quick script to get the computer's serial number.
#
# Written for @john.e.lamb on the MacAdmins Slack team.
import objc
import CoreFoundation
from Crypto.Cipher import AES
from Crypto.Util import Counter
import struct
"""
typedef struct boot_dat_hdr
{
unsigned char ident[0x10];
unsigned char sha2_s2[0x20];
unsigned int s2_dst;
@pudquick
pudquick / msqq.rb
Created July 31, 2017 20:19 — forked from peterc/msqq.rb
Sys V message queues in Ruby on OS X (take one)
# Lightweight library to access the System V message queue functionality on Mac OS X (32 and 64 bit)
# Still quite scrappy and needs to be packaged up properly but.. it works!
require 'fiddle'
class MsgQ
LIBC = DL.dlopen('libc.dylib')
IPC_CREAT = 001000
IPC_EXCL = 002000
@pudquick
pudquick / main.m
Created June 28, 2017 01:55 — forked from steventroughtonsmith/main.m
Load Mach-O executable at runtime and execute its entry point
void callEntryPointOfImage(char *path, int argc, char **argv)
{
void *handle;
int (*binary_main)(int binary_argc, char **binary_argv);
char *error;
int err = 0;
printf("Loading %s…\n", path);
handle = dlopen (path, RTLD_LAZY);
@pudquick
pudquick / Installation.md
Created April 21, 2017 19:32 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@pudquick
pudquick / google_chrome_update_checker.py
Last active August 11, 2024 12:06 — forked from bruienne/google_chrome_update_checker.py
Basic concept for querying for Google Chrome updates based on current Chrome version/OS/arch
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '10.12'
@pudquick
pudquick / flag_to_string.rb
Created September 5, 2016 18:23 — forked from djberg96/flag_to_string.rb
Trying to stringify filesystem flags
require 'ffi'
class Filesystem
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function(:strerror, [:int], :string)
attach_function(:getmntinfo64, [:pointer, :int], :int)
class Statfs < FFI::Struct
@pudquick
pudquick / Get-SSLThumbprint.ps1
Created May 22, 2016 15:07 — forked from lamw/Get-SSLThumbprint.ps1
Powershell snippet to help extract the SSL Thumbprint (SHA1) of a remote system
Function Get-SSLThumbprint {
param(
[Parameter(
Position=0,
Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)
]
[Alias('FullName')]
[String]$URL
Quick Instructions for Compiling under OS X
1. Install gcc from Homebrew and set the env variables + aliases:
export CC=/usr/local/bin/gcc-5
export CXX=/usr/local/bin/g++-5
export CPP=/usr/local/bin/cpp-5
export LD=/usr/local/bin/gcc-5
alias c++=/usr/local/bin/c++-5
alias g++=/usr/local/bin/g++-5