Skip to content

Instantly share code, notes, and snippets.

View dalehamel's full-sized avatar

Dale Hamel dalehamel

View GitHub Profile
@dalehamel
dalehamel / gist:88f041647188af123511
Created January 5, 2015 20:40
Datadog Snapshot poll
checklength = (url) ->
robot.http(result['snapshot_url']).get() (err,res,body) ->
size = res['headers']['content-length']
checklength url unless size > 1000
if size > 1000
setTimeout ->
msg.send "Here's your graph for #{dash} #{graph}, #{msg.message.user.name}: #{result['snapshot_url']}"
, 3000
@dalehamel
dalehamel / gist:ce9bfe7c8a2f4addb03a
Last active August 29, 2015 14:13
Victorops coffeescript WIP
# Description:
# This script can be used to interact with VictorOps schedules, and page VictorOps teams
#
# Configuration:
# HUBOT_VICTOROPS_USER - The username of the hubot user in the VictorOps org
# HUBOT_VICTOROPS_PASS - The password of the hubot user in the VictorOps org
# HUBOT_VICTOROPS_REST - The API token to use
# Commands:
# hubot oncall - Lists the teams you can check (working)
@dalehamel
dalehamel / gist:629f41bdcb8c0627f985
Last active August 29, 2015 14:13
Hubot Datadog WIP
# Description:
# Query Datadog using Hubot.
#
# Configuration:
# HUBOT_DATADOG_APIKEY - Your Datadog API key
#  HUBOT_DATADOG_APPKEY - Your Datadog app Key
#
# Commands:
# opsbot (datadog|dd|dog|graph) [dashboard] [graph] - snapshot a specific graph from a dashboard that you've already told hubot about.
# opsbot (datadog|dd|dog) graphs - Show the available graphs
# Update glibc to your systems recommended patched version first
# As root, run this. If you're system is ok, you'll see nothing. Otherwise, this will tell you all infected processes.
for proc in $(ls /proc); do if [ -e /proc/$proc/maps ];then if [ -n "`cat /proc/$proc/maps | grep -i libc- | grep -i deleted`" ];then echo $proc; echo "CMDLINE"; cat /proc/$proc/cmdline; echo -e "CMDLINE\n"; cat /proc/$proc/maps | grep -i libc- | grep -i deleted; fi fi done
rasplex Version: 0.5.1
rasplex git: 55113f6ddae290c431fdf96171c28c1778fbe1ff
RasPlex:~ $ ls
lost+found
RasPlex:~ $ cd /flash/overlays/
RasPlex:/flash/overlays $ ls
README.TXT hifiberry-dac-overlay.dtb iqaudio-dac-overlay.dtb pcf2127-rtc-overlay.dtb w1-gpio-overlay.dtb
ds1307-rtc-overlay.dtb hifiberry-dacplus-overlay.dtb iqaudio-dacplus-overlay.dtb pcf8523-rtc-overlay.dtb w1-gpio-pullup-overlay.dtb
hifiberry-amp-overlay.dtb hifiberry-digi-overlay.dtb lirc-rpi-overlay.dtb pps-gpio-overlay.dtb
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCd9MR4lTtEreJqyXWjVRxxMzYMUxYTLr0PMDkY52BgiBVHL+JY8Pbx7hcEaSkd9wMlun6Jverq3QYXUk+1FOOBJwC/ATZloCav0sqn9/37QrMvBPcwHgH054abKZJ0ctkpBTUa7AS+IRtco30i7J7Irzr6jbRvZ2BO6Nh1TlhGBQ0y5IOEMBhWMq9sUXBNmsNxDSGaabEX83Dkgk4pkTtr4Sk0oUpWWI94E3zttYAP6e7gRhiOn6LeYiDfTvIRkN9c/scErs1W3Pa6WY0EWLR7TeVtSWVEo5QIYbJbXRJTOCWyoMc8u5f9c82kIPG+4Ufe9wLUd7t2kVUDh6v89Ord daleha@trololol
@dalehamel
dalehamel / gist:4b61ac93109b8bb14b99
Created February 27, 2015 03:27
Deluge curator script
#!/bin/bash
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
# Initialize our own variables:
unreg=0
error=0
max_ratio=0
target_tracker=""
days_ago=0
#!/usr/bin/env ruby
require 'aws-sdk'
require 'json'
$stdout.sync = true
conf = JSON.load(File.read(ENV['CONFIG']))['aws']
credentials = Aws::Credentials.new(conf['access_key_id'], conf['secret_access_key'])
@dalehamel
dalehamel / gist:8535ac5b5c1ec1833cd5
Created May 29, 2015 02:39
on demand price scraper
require 'net/http'
require 'json'
def getPrices(path)
uri = URI(path)
res = Net::HTTP.get_response(uri)
data = res.body.match(/.*callback\((.*)\);/).captures[0]
data = data.gsub(/(\w+):/,"\"\\1\":")
d = JSON.parse(data)
# Uncomment to enable HiFiBerry overlay
# NOTE: You must disable the lirc-rpi overlay (or change lirc GPIO pin) for HiFiBerry to work correctly
# dtoverlay=hifiberry-amp
# dtoverlay=hifiberry-dac
# dtoverlay=hifiberry-dacplus
# dtoverlay=hifiberry-digi