This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SystemConfiguration | |
prefs = SystemConfiguration.SCPreferencesCreate(None, "SystemConfiguration", None) | |
print SystemConfiguration.SCPreferencesGetValue(prefs, "System")["System"]["ComputerName"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# main config | |
libdir = /usr/share/mcollective/plugins | |
logfile = /var/log/mcollective.log | |
daemonize = 1 | |
keeplogs = 1 | |
max_log_size = 10240 | |
loglevel = debug | |
identity = my_laptop | |
registerinterval = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra/base' | |
require 'webrick' | |
#require 'webrick/https' | |
#require 'openssl' | |
require 'resolv' | |
require 'json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://httpstat.us - for test error codes | |
# http://uri-labs.com/macosx_headers/NSURLConnection_h/Protocols/NSURLConnectionDelegate/index.html | |
# Notes: | |
# - Errors are only thrown when the connection: | |
# - Is interrupted before the headers can complete | |
# - SSL couldn't happen correctly | |
# - The connection never happens | |
# - A delegate.response always has a NSHTTPURLResponse key for HTTP/HTTPS | |
# For a file:// transfer, it's NSURLResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>Label</key> | |
<string>com.grahamgilbert.crypt.launcher</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/crypt/Crypt.app/Contents/MacOS/Crypt</string> | |
</array> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''Uses Cocoa classes via PyObjC to set a random desktop picture on all screens. | |
Tested on Mountain Lion and Mavericks. | |
See: | |
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWorkspace_Class/Reference/Reference.html | |
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import CDLL, sizeof, memset, c_uint32, create_string_buffer | |
MAXPATHLEN = 1024 | |
PROC_PIDPATHINFO_MAXSIZE = MAXPATHLEN*4 | |
PROC_ALL_PIDS = 1 | |
libc = CDLL('libc.dylib') | |
def get_pids(): | |
number_of_pids = libc.proc_listpids(PROC_ALL_PIDS, 0, None, 0) | |
pid_list = (c_uint32 * (number_of_pids * 2))() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This was all run from user space | |
# I haven't tested it with root | |
# ... but it didn't prompt for any permissions under userspace ^_^ | |
# Tested on 10.11.5 | |
import objc | |
from Foundation import NSBundle | |
EAP8021X_bundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/EAP8021X.framework') | |
Security_bundle = NSBundle.bundleWithIdentifier_('com.apple.security') |
OlderNewer