Skip to content

Instantly share code, notes, and snippets.

View technicalpickles's full-sized avatar

Josh Nichols technicalpickles

View GitHub Profile
import logging
from datetime import timedelta
from requests.exceptions import ConnectionError as ConnectError, \
HTTPError, Timeout
from homeassistant.components.sensor import DOMAIN
from homeassistant.helpers import validate_config
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
require 'faraday'
require 'faraday_middleware'
module Icecast
class Admin < Faraday::Connection
class Error < RuntimeError
end
class AdminError < Error
end
@technicalpickles
technicalpickles / it.coffee
Created June 19, 2015 15:02
hubot script example with test
# Description:
# Get help from @yourorg/it for your information technology problems. Oh by the way.... Your Welcome.
#
# Commands:
# hubot it me <problem> - get help from @yourorg/it about your information technology <problem>
module.exports = (robot) ->
robot.respond /it(?: me)?(?: (.*))?/i, (msg) ->
problem = msg.match[1]
@technicalpickles
technicalpickles / inspector
Last active November 8, 2020 20:59
hubot with debugging
#!/bin/bash
set -e
for opt in $* ; do
case "$opt" in
--debug) hubot_debug="coffee --nodejs --debug";;
esac
done
@technicalpickles
technicalpickles / gist:a4581caa9378549dd59d
Created November 11, 2014 19:18
ruby retry example-
def flaky_code()
unless @flaky_code_works
@flaky_code_works = true
raise 'wtf'
end
puts "works eventually lol"
end
@technicalpickles
technicalpickles / gist:396a55d2c7198cd7090b
Created September 18, 2014 20:08
Rails ENV based HTTP auth
class PostsController < ApplicationController
if ENV['HTTP_AUTH_USERNAME'].present? && ENV['HTTP_AUTH_PASSWORD'].present?
http_basic_authenticate_with name: ENV['HTTP_AUTH_USERNAME'], password: ENV['HTTP_AUTH_PASSWORD']
def index
render plain: "Everyone can see me!"
end
end
@technicalpickles
technicalpickles / error.coffee
Created June 20, 2014 21:39
Simple hubot error handling
module.exports = (robot) ->
robot.error (err, msg) ->
robot.logger.error "#{err}\n#{err.stack}"
if msg?
msg.reply "#{err}\n#{err.stack}"

Keybase proof

I hereby claim:

  • I am technicalpickles on github.
  • I am technicalpickles (https://keybase.io/technicalpickles) on keybase.
  • I have a public key whose fingerprint is 2075 7709 272C AD6B A3E0 1CA6 9B77 22C4 6AA1 A462

To claim this, I am signing this object:

@technicalpickles
technicalpickles / gist:7013017
Created October 16, 2013 19:04
Favorite hubot commands
Year Make Model Description Price
1997 Ford E350 ac, abs, moon 3000.00
1999 Chevy Venture "Extended Edition" 4900.00
1999 Chevy Venture "Extended Edition, Very Large" 5000.00
1996 Jeep Grand Cherokee MUST SELL! air, moon roof, loaded 4799.00