Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
"""
MDM status reporting tool. Requires macOS 10.13.4+ for command output compatibility.
"""
import subprocess
import os
import plistlib
import sys
cat /Applications/Slack.app/Contents/Resources/app.asar | grep --text -C 6 SLACK_NO_AUTO_UPDATES
const reasons: Array<string> = [];
if (getSetting<boolean>(store, 'isDevMode')) reasons.push('Developer build');
if (process.mas) reasons.push('Mac App Store build');
if (process.windowsStore) reasons.push('Windows Store build');
if (process.platform === 'linux') reasons.push('using Linux');
if (process.env.SLACK_NO_AUTO_UPDATES) reasons.push('updates disabled in environment');
const tempDirectory = process.env.TMPDIR || process.env.TEMP || '/tmp';
#!/usr/bin/python
import requests
import sys
import csv
import urllib
API_KEY = ""
ENDPOINT_URL = "https://api.uptimerobot.com/v2/newMonitor"
HEADERS = {
@rickheil
rickheil / test.json
Last active November 21, 2017 17:17
{
"to_number": "+1YOURPHONENUMBER",
"monitorURL": "https://rickheil.com",
"monitorFriendlyName": "Rick Heil Blog",
"alertDetails": "Keyword not found",
"alertType": "1"
}
{"to_number": "+1YOURPHONEHERE", "monitorURL": "*monitorURL*", "monitorFriendlyName": "*monitorFriendlyName*", "alertDetails": "*alertDetails*", "alertType": "*alertType*"}
test:
stage: test
tags:
- linux
- python
before_script:
- apt-get -qq update
- export DEBIAN_FRONTEND=noninteractive && apt-get -qqy install pylint python-pip virtualenv > /dev/null
script:
- source bin/activate
#!/usr/bin/python
"""This is a lambda function that accepts web hooks from UptimeRobot
and translates them into SMS messages. Useful when you don't want to
pay UptimeRobot's highway robbery SMS fees.
Twilio code liberally lifted from their blog post on Lambda."""
import os
import json
from twilio.rest import Client
<?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>Gatekeeper</key>
<string>enabled</string>
<key>SIP</key>
<string>enabled</string>
</dict>
</plist>
#!/usr/bin/python
"""Formats lpoptions output to PrinterGenerator input"""
import sys
import subprocess
def main():
subproc = subprocess.Popen(['lpoptions', '-p', sys.argv[1], '-l'], stdout=subprocess.PIPE)
out, err = subproc.communicate()
<?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>org.observium.agent</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>