This file contains hidden or 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
These links aren't always easy to find. | |
http://developer.apple.com/library/mac/#documentation/Networking/Reference/SCNetworkConfiguration/Reference/reference.html | |
http://developer.apple.com/library/mac/#documentation/Networking/Reference/SCPreferences/Reference/reference.html | |
nigelk$ python | |
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Watch current directory (recursively) for file changes, and execute | |
# a command when a file or directory is created, modified or deleted. | |
# | |
# Written by: Senko Rasic <[email protected]> | |
# | |
# Requires Linux, bash and inotifywait (from inotify-tools package). | |
# | |
# To avoid executing the command multiple times when a sequence of |
This file contains hidden or 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
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Watch current directory (recursively) for file changes, and execute | |
# a command when a file or directory is created, modified or deleted. | |
# | |
# Written by: Senko Rasic <[email protected]> | |
# | |
# Requires Linux, bash and inotifywait (from inotify-tools package). | |
# | |
# To avoid executing the command multiple times when a sequence of |
This file contains hidden or 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
Renew Puppet CA cert. | |
Not the perfect idea, but should alleviate the need to resign every cert. | |
What you need from existing puppet ssl directory: | |
ca/ca_crt.pem | |
ca/ca_key.pem | |
Create an openssl.cnf: | |
[ca] |
This file contains hidden or 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
""" | |
First attempt at bringing security into play with the .pem files. | |
Only the security tool is used, no additional tools (openssl, etc.). | |
This code does the following: | |
- Creates the specified keychain if it doesn't exist | |
- Unlocks it with the specified password | |
- Configures it to not lock | |
- Adds it to the keychain search paths if it's not present already (necessary for 10.9) | |
- Import the client.pem cert / identity |
This file contains hidden or 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 CoreFoundation import CFPreferencesCopyAppValue, CFPreferencesSetAppValue, CFPropertyListCreateDeepCopy, kCFPropertyListMutableContainersAndLeaves, CFPreferencesAppSynchronize | |
folder_to_add = u'/Abosulte/Path/To/Folder' | |
desktop_settings = CFPreferencesCopyAppValue('DSKDesktopPrefPane', 'com.apple.systempreferences') or dict() | |
mutable_desktop_settings = CFPropertyListCreateDeepCopy(None, desktop_settings, kCFPropertyListMutableContainersAndLeaves) | |
folder_paths = mutable_desktop_settings.get('UserFolderPaths', list()) |
This file contains hidden or 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 hidden or 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 os.path, base64 | |
from ctypes import CDLL, Structure, POINTER, byref, addressof, create_string_buffer, c_int, c_uint, c_ubyte, c_void_p, c_size_t | |
from CoreFoundation import kCFStringEncodingUTF8 | |
# Wheee! | |
Security = CDLL('/System/Library/Frameworks/Security.Framework/Versions/Current/Security') | |
# I don't use the pyObjC CoreFoundation import because it attempts to bridge between CF, NS, and python. | |
# When you try to mix it with Security.Foundation (pure C / CF), you get nasty results. | |
# So I directly import CoreFoundation to work with CFTypes to keep it pure of NS/python bridges. | |
CFoundation = CDLL('/System/Library/Frameworks/CoreFoundation.Framework/Versions/Current/CoreFoundation') |
This file contains hidden or 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
# Skip to the end to see what this can do. | |
# | |
# http://s.sudre.free.fr/Stuff/Ivanhoe/FLAT.html | |
# Flat packages are xar files with a particular structure | |
# We're looking for the PackageInfo file within the xar file | |
import urllib2, ctypes, zlib | |
import xml.etree.ElementTree as ET | |
class SimpleObj(object): |
OlderNewer