Skip to content

Instantly share code, notes, and snippets.

@sheeley
sheeley / SessionsController.rb
Last active September 13, 2021 21:30
SAML Controller for Rails (used when POSTing data to IDP and decrypting on return)
class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token, only: :saml
def new
request = Onelogin::Saml::Authrequest.new
settings = saml_settings
request_doc = request.create_authentication_xml_doc(settings)
request_str = request_doc.to_s #.force_encoding("UTF-8")
logger.debug request_str
@sheeley
sheeley / setup.sh
Created January 28, 2014 05:11
Headless install Xcode command line tools, node, and homebrew.
#! /bin/bash
# install xcode clt
curl -o clt.dmg https://s3.amazonaws.com/OHSNAP/command_line_tools_os_x_mavericks_for_xcode__late_october_2013.dmg
hdiutil attach clt.dmg
sudo installer -pkg /Volumes/Command\ Line\ Developer\ Tools/Command\ Line\ Tools\ \(OS\ X\ 10.9\).pkg -target /
# install node
curl -o node.pkg http://nodejs.org/dist/v0.10.25/node-v0.10.25.pkg
sudo installer -pkg node.pkg -target /
@sheeley
sheeley / gist:10555470
Last active August 29, 2015 13:59
Sllurp
# Without duration, immediately ends.
INFO:sllurp:connecting...
INFO:tornado.access:starting tornado
INFO:sllurp:got READER_EVENT_NOTIFICATION
WARNING:sllurp:ADD_ROSPEC failed with status FieldError: LLRP [148] : //ROSpec/ROSpecID : ID already configured
INFO:sllurp:stopping politely
INFO:sllurp:reader finished inventory
# Without tx_power
INFO:sllurp:got READER_EVENT_NOTIFICATION
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<style type="text/css">
.container {
position: relative;
width: auto;
display: inline-block;
overflow: hidden;
}
#!/usr/bin/env python
# llrp_proto.py - LLRP protocol client support
#
# Copyright (C) 2009 Rodolfo Giometti <giometti@linux.it>
# Copyright (C) 2009 CAEN RFID <support.rfid@caen.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
class RFID(object):
def __init__(self):
self.initial_rospec_clear = False
def clear_rospec(self, proto):
if not self.initial_rospec_clear:
logger.info('rfid clearing rospec')
self.initial_rospec_clear = True
return proto.stopPolitely()
class FRWindowController {
// ...
// here we can log both output and command together
func runJavaScript(command: String){
webView?.evaluateJavaScript(command, completionHandler: { (output, error) -> Void in
// woo hoo
NSLog("\(command) has output \(output)")
})
}
@sheeley
sheeley / keybase.md
Created September 22, 2014 20:56
keybase.md

Keybase proof

I hereby claim:

  • I am sheeley on github.
  • I am sheeley (https://keybase.io/sheeley) on keybase.
  • I have a public key whose fingerprint is BCFE BFA3 6734 636E A808 B02F 9AC3 A5CB 5E6F 3E6E

To claim this, I am signing this object:

PARTITION_MAP = {
0: (40, 12, 4, 1),
1: (37, 11, 7, 2),
2: (34, 10, 10, 3),
3: (30, 9, 14, 4),
4: (27, 8, 17, 5),
5: (24, 7, 20, 6),
6: (20, 6, 24, 7)
}
@sheeley
sheeley / test.java
Created May 27, 2015 15:39
Curator + Kafka Unit Test
TestingServer ts = new TestingServer();
int port = TestUtils.choosePort();
Properties props = TestUtils.createBrokerConfig(0, port, false);
props.put("chroot", testChroot);
props.put("zookeeper.connect", connectString);
props.put("log.dir", KAFKA_TMP_DIR);
KafkaConfig config = new KafkaConfig(props);