Skip to content

Instantly share code, notes, and snippets.

View bbhoss's full-sized avatar
🎯
Focusing

Preston bbhoss

🎯
Focusing
View GitHub Profile
require 'rubygems'
require 'rack'
def application(env)
[200, {"Content-Type" => "text/html"}, ["Hello Rack!"]]
end
run method(:application)
@bbhoss
bbhoss / privdebug.pl
Created January 21, 2015 17:43
Debug privileges of a process on Solaris/Illumos. Rescued from Wayback Machine
#!/usr/bin/perl
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@bbhoss
bbhoss / sdc.py
Last active August 29, 2015 14:13
Joyent/SDC Ansible Module (WIP, not fully functional yet). I am not a Pythonista
#!/usr/bin/env python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@bbhoss
bbhoss / fizzbuzz.fs
Created October 13, 2014 04:22
FizzBuzz in F#
// DivisibleBy Active Pattern special syntax for defining named patterns that can partition data
let (|DivisibleBy|_|) divisor i =
if i % divisor = 0 then Some () else None
// Use the pattern, easy.
for i in 1..100 do
match i with
| DivisibleBy 3 & DivisibleBy 5 -> printfn "FizzBuzz"
| DivisibleBy 3 -> printfn "Fizz"
| DivisibleBy 5 -> printfn "Buzz"
| _ -> printfn "%d" i
@bbhoss
bbhoss / mirthconnect.service
Created August 21, 2014 19:21
Mirth systemd descriptor for CentOS/RHEL 7. Just extract the mirthconnect tarball to /opt/mirthconnect, create a system user for mirth, chown accordingly, and install/enable this config file.
[Unit]
Description=Mirth Connect Interface Engine
After=network.target
[Service]
Type=forking
User=mirth
Group=mirth
ExecStart=/opt/mirthconnect/mcservice start

Keybase proof

I hereby claim:

  • I am bbhoss on github.
  • I am bbhoss (https://keybase.io/bbhoss) on keybase.
  • I have a public key whose fingerprint is 4D8E F428 F96F A521 7A7D EF5B 01E6 E54A A5A8 67AB

To claim this, I am signing this object:

@bbhoss
bbhoss / autopoker.js
Last active January 1, 2016 06:59
Automatically poke your friends back!
var autoPokerIndex = null;
var autoPoke = function() {
// LOL, do you even DOM bro?
document.evaluate('//*[text()="Poke Back"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE).snapshotItem(0).click();
}
var startAutoPoker = function() {
autoPokerIndex = setInterval(autoPoke, 2000);
}
@bbhoss
bbhoss / xcode_emulation.patch
Last active December 28, 2015 04:08
patch to xcode_emulation for node > v0.10.22
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
index f9cec33..4b3c035 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -285,8 +285,14 @@ class XcodeSettings(object):
if sdk_root.startswith('/'):
return sdk_root
if sdk_root not in XcodeSettings._sdk_path_cache:
- XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem(
- sdk_root, 'Path')
@bbhoss
bbhoss / xcode_emulation.patch
Last active December 28, 2015 04:09
patch to xcode_emulation for older (<v0.10.22) versions of node
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
index 806f92b..5256856 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -224,8 +224,7 @@ class XcodeSettings(object):
def _GetSdkVersionInfoItem(self, sdk, infoitem):
job = subprocess.Popen(['xcodebuild', '-version', '-sdk', sdk, infoitem],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
@bbhoss
bbhoss / sidekiq_indexing.rb
Created October 8, 2013 07:25
Very basic hook into Sunspot::Rails to force it to index it using an alternative method, in this case Sidekiq. I decided to do it this way instead of writing a new session proxy because in this case it's more of an application concern instead of something as low as a session proxy. Will probably cause some weird issues if you don't have your sol…
module SidekiqIndexing
module SearchableOverride
extend ActiveSupport::Concern
module InstanceOverrides
def solr_index
SunspotIndexer.perform_async(self.class.to_s, self.id)
end
end