Skip to content

Instantly share code, notes, and snippets.

@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"
}
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
#!/usr/bin/python
# encoding: utf8
#
# Portions of code re-used from "makecatalogs" by Greg Neagle
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Yo may obtain a copy of hte License at
#
# https://www.apache.org/licenses/LICENSE-2.0
<?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()
@rickheil
rickheil / wmic-install
Created January 29, 2016 18:20
installing wmic for linux
#!/bin/bash
# compiles WMIC for linux
apt-get install autoconf
cd /usr/src
wget http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2
bzip2 -cd wmi-1.3.14.tar.bz2 | tar xf -
cd wmi-1.3.14/
<?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>
@rickheil
rickheil / a.rb
Created September 30, 2015 18:53
$ sudo ./createOSXinstallPkg --source=/Applications/Install\ OS\ X\ El\ Capitan.app
Password:
Examining and verifying source...
----------------------------------------------------------------
InstallESD.dmg: /Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg
OS Version: 10.11
OS Build: 15A284
----------------------------------------------------------------
Output path: /Users/rickheil/Development/createOSXinstallPkg/InstallOSX_10.11_15A284.pkg
Creating package wrapper...
$ autopkg run graylog-collector.download.recipe -vvvvv
Processing graylog-collector.download.recipe...
{'AUTOPKG_VERSION': u'0.5.1',
u'GIT_PATH': u'/Applications/Xcode.app/Contents/Developer/usr/bin/git',
u'MUNKI_REPO': u'/Volumes/munki_repo',
u'NAME': u'GraylogCollector',
'PARENT_RECIPES': [],
'RECIPE_CACHE_DIR': u'/Users/rickheil/Library/AutoPkg/Cache/com.github.rickheil.psautopkg.download.graylog-collector',
'RECIPE_DIR': '/Users/rickheil/Development/psautopkg/graylog collector',
'RECIPE_OVERRIDE_DIRS': ['~/Library/AutoPkg/RecipeOverrides'],