Skip to content

Instantly share code, notes, and snippets.

View chelming's full-sized avatar

Chris Helming chelming

View GitHub Profile
@pudquick
pudquick / ctypes_printers.py
Created July 7, 2016 00:30
Various PrintCore functions via ctypes on OS X
from ctypes import CDLL, Structure, POINTER, c_void_p, byref
from ctypes.util import find_library
import objc
PrintCore = CDLL('/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/PrintCore')
CFoundation = CDLL(find_library('CoreFoundation'))
class OpaqueType(Structure):
pass
@weswhet
weswhet / crypt-mech-check.plist
Created August 18, 2017 16:04
munki pkginfo for checking that the Crypt Mechanisms are in the Authorization Database.
<?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>autoremove</key>
<false/>
<key>blocking_applications</key>
<array/>
<key>catalogs</key>
<array>
#!/usr/bin/python
import os
import datetime
import subprocess
import json
import urllib
import urllib2
import shutil
import tarfile
@webstandardcss
webstandardcss / pedantically_commented_playbook.yml
Last active April 23, 2019 06:03 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options.
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@romainl
romainl / deprecation.md
Last active February 24, 2022 02:42
Idiomatic vimrc
@pudquick
pudquick / 8021x_inspect.py
Last active September 27, 2022 10:04
802.1x configuration / data collection on OS X using python and the PrivateFramework "EAP8021X.framework"
# 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')
@flips22
flips22 / _cbltomylar.py
Last active January 6, 2023 03:55
CBL to Mylar Script - Imports a CBL file, finds each unique series on comicvine, checks if you already have it in mylar and if not, adds the series to mylar via its api.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Installation:
1) Add this package as a python wrapper to search the comicvine api:
https://github.com/jessebraham/comicvine-search
I wasn't able to get this module to install so I copied it to the same folder as the .py file (or add to you env of course)
2) Replace [mylar api key] with your api key
3) Replace [mylar server address] with your server in the format: http://servername:port/ (make sure to include the slash at the end)
4) Replace [comicvine api key] with your api key
@superseb
superseb / cleanup.sh
Last active June 19, 2023 10:03
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
# OUTDATED: please refer to the link below for the latest version:
# https://github.com/rancherlabs/support-tools/blob/master/extended-rancher-2-cleanup/extended-cleanup-rancher2.sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active April 3, 2024 13:55
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@haircut
haircut / tcc-reset.py
Last active April 5, 2024 11:27
Completely reset TCC services database in macOS
#!/usr/bin/python
"""
Completely reset TCC services database in macOS
Note: Both the system and individual users have TCC databases; run the script as both
a user and as root to completely reset TCC decisions at all levels.
2018-08-15: Resetting the 'Location' service fails; unknown cause
2018-08-16: Confirmed the 'All' service does not really reset _all_
services, so individual calls to each service is necessary.