Skip to content

Instantly share code, notes, and snippets.

View technicalpickles's full-sized avatar

Josh Nichols technicalpickles

View GitHub Profile
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
@technicalpickles
technicalpickles / gist:4162161
Created November 28, 2012 15:57
unison-2.7.57 patch for ocaml 3.12.0 and later (see http://tech.groups.yahoo.com/group/unison-users/message/9348)
Common subdirectories: unison-2.27.57/lwt and unison-2.27.57-patched/lwt
Common subdirectories: unison-2.27.57/ubase and unison-2.27.57-patched/ubase
Common subdirectories: unison-2.27.57/uimac and unison-2.27.57-patched/uimac
Common subdirectories: unison-2.27.57/uimacnew and unison-2.27.57-patched/uimacnew
diff -u unison-2.27.57/update.mli unison-2.27.57-patched/update.mli
--- unison-2.27.57/update.mli 2007-04-01 23:03:20.000000000 -0400
+++ unison-2.27.57-patched/update.mli 2012-11-28 10:55:42.000000000 -0500
@@ -1,7 +1,7 @@
(* Unison file synchronizer: src/update.mli *)
(* Copyright 1999-2007 (see COPYING for details) *)