Skip to content

Instantly share code, notes, and snippets.

View natewalck's full-sized avatar

Nate Walck natewalck

View GitHub Profile
@natewalck
natewalck / quarantine_demo.py
Created February 24, 2023 00:02 — forked from gregneagle/quarantine_demo.py
Using Apple's quarantine API from PyObjC
#!/usr/local/munki/munki-python
'''Demo only. Needs more robust error checking and handling'''
import os
from Foundation import NSURL, NSURLQuarantinePropertiesKey
def getQuarantineAttribute(pathname):
'''Returns a dict contaning quarantine info for pathname or None'''
@natewalck
natewalck / boot.sh
Created June 10, 2021 17:44 — forked from Jip-Hop/boot.sh
Using Docker on TrueNAS SCALE (no Kubernetes)
#!/usr/bin/env bash
# Using Docker on TrueNAS SCALE (no Kubernetes)
#
# Don't setup Apps via the TrueNAS Web GUI (don't choose a pool for Apps when asked)
# Make a dedicated docker dataset on one of your data pools
# Store this script somewhere else on your pool (not in the Docker dataset)
# Make a daeomon.json file in the same directory with the following contents:
# {"data-root": "/mnt/path/to/desired/docker/dataset/", "exec-opts": ["native.cgroupdriver=cgroupfs"]}
# Then schedule this script to start via System Settings -> Advanced -> Init/Shutdown Scripts -> Add:
@natewalck
natewalck / ducky.md
Created June 24, 2020 12:20 — forked from schmich/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

from time import strftime,gmtime,time
import urllib2
import hmac
import hashlib
import base64
import string
def publishAmazonSnsMsg(Subject,TopicArn,Message,AWSAccessKeyId,privatekey):
#http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/
amzsnshost = 'sns.us-east-1.amazonaws.com'
#!/usr/bin/python
# https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWorkspace_Class/Reference/Reference.html#//apple_ref/doc/uid/20000391-BCIEBDGB
# https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html
# https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSScreen_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSScreen
from AppKit import NSWorkspace, NSScreen
from AppKit import NSWorkspaceDesktopImageScalingKey
from AppKit import NSImageScaleProportionallyUpOrDown
from AppKit import NSWorkspaceDesktopImageAllowClippingKey
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
# 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
H
/^def macosx_sdk_root(/a
.
/cflags =/i
sdkroot = os.environ.get('SDKROOT')
if sdkroot is not None:
return sdkroot
.
/# Check the additional directories$/a
.
H
/^#include/a
#include <stdlib.h>
.
/^get_history_item(/a
.
/^#ifdef *__APPLE__/c
/*
* Recent versions of libedit have corrected the off-by-one history indexes
* (though the Apple version emulates a true offset rather than using the
H
g/-Wl,-search_paths_first/d
g/ -lSystemStubs -arch_only [^"]*/s///
g/-current_version $(VERSION)/s//-current_version $(PYTHON_CURRENT_VERSION)/
g/-O3/s//-Os/g
/^OTHER_LIBTOOL_OPT$/i
EXTRA_CFLAGS
LIBTOOL
.
/# Calculate the right deployment target for this build\./i