Skip to content

Instantly share code, notes, and snippets.

@findchris
findchris / instantiation.rb
Created June 30, 2018 00:03
Class vs struct vs hash vs openstruct instantiation performance
require 'benchmark'
require 'ostruct'
REP = 1000000
User = Struct.new(:name, :age)
class Obj
def initialize(name, age)
@name = name
@findchris
findchris / output.json
Created November 3, 2017 20:42
hawkeye labels
{
"LabelDetections": [
{
"Timestamp": 0,
"Label": {
"Confidence": 53.007102966308594,
"Name": "Fire"
}
},
{
{
"body": {
"meta": {
"status_code": 200,
"status": "OK",
"message": "",
"more_info": {
}
},
@findchris
findchris / space.js
Created March 3, 2017 07:17
Handle POST /spaces/:id/events
diff --git a/node_modules/robin-js-sdk/lib/api/modules/spaces.js b/node_modules/robin-js-sdk/lib/api/modules/spaces.js
index c2cac7a..96d9886 100644
--- a/node_modules/robin-js-sdk/lib/api/modules/spaces.js
+++ b/node_modules/robin-js-sdk/lib/api/modules/spaces.js
@@ -54,6 +54,28 @@ module.exports = {
},
/**
+ * Space Events
+ * @type {Object}
@findchris
findchris / policy.json
Last active March 1, 2017 22:38
serveless policy
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudformation:DescribeStackResources",
"cloudformation:CreateStack",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResource",
"cloudformation:UpdateStack",
@findchris
findchris / gist:f8299dc6236e9809a55885bb1ba3bd2d
Last active January 25, 2017 01:53
git-lfs bundle install explosion
git-lfs/1.2.1 (GitHub; darwin amd64; go 1.6.2)
git version 2.4.0
$ git-lfs smudge -- data/na_04_01.db
Error downloading object: data/na_04_01.db (6860f0ae56723ec96e00788106665d1bc2144dc7039ff8985e2b6dd2ecce01e8)
Post /Users/chris/.rvm/gems/ruby-2.1.2@project1/cache/bundler/git/common-650d7e8e490064278ba9d9ed434853f518126933.git/info/lfs/objects/batch: unsupported protocol scheme ""
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
/private/tmp/git-lfs-20160606-7147-y1iynq/git-lfs-1.2.1/src/github.com/github/git-lfs/lfs/errors.go:566 +0x80
@findchris
findchris / sample.rb
Last active January 10, 2017 19:54
Broken access to memory-mapped file in Ruby
Initialized with: NetAcuityMemMap.new('data', 4)
[7] pry(#<NetAcuityMemMap>)> @default_response = response_head_array[0].chomp
=> "$:\xCC\xE1\xBB\r\xC3r\x04r n}\xFF\x92OA7\xBCn\x88\xC0\xA5\x1D\x14\x14\xED\x8D\xD4}[\x1F_\x81\x85\x03\x1F\x10\x01\xE0i\x01\x01\x9DC63\xDB\xBD\xB3&\xB0\t:\xA2\x10\x04\xCA\xC9\e0#\xD4H\xEC_\r\x9C\x9C\xB6\x8D\xAF\xA7\xFA)\xF2Tg\x84Bo\xB1\x97\xDBC\xF4n\x06\x14\xC2\x96n\x8A\x91\xDF\xF2\xDCJ\xF6]\xF6t\x1C\xFB\xD3\x03{\xF9\x06\xB6Q\xA9*-[\xC6\x9B\x10\x12r\xBA-MB\x9DL\x81V\xFB\xD2\x19\x85\xE4\x05\xD0%\xEEE\x96j\xD3<\xEE\x10\xE1\xC6\xCE\xCF\xBD\x1A\xA0('\xC6v\x98K~\xC2\e\x87&\xBE|6\xA5\"D\xC0k:\x89FJ{\x01\x8F[\xFA\x90u7\x14:\x90i\xB4\x8F\xC9\xE8-\xCB)i'~\r\xC7\xD8\xDD\xC6\x10\xCF\e\xB3\x8B\xCE\x05\xE1\xC6\xCE\xCF\xBD\x1A\xA0(\x17\xDE\xD1\x86GA\x9B\x04\x9B\xA1\xAE\xE8\x9E\xFB\xEEW\xF3\xA2\x1D\x91\x90\"\x97Y\xE1\xC6\xCE\xCF\xBD\x1A\xA0(4\xA3<\x8B\xAA*\x9AD\x0F\xF6\xE6\xCC'L\x8Cy\xF8\x97hu\xEC\xFD\x8C\xFB\x02D\xC78w\x928\xECv\x83\"\xFB\x98\xA1\xD9\x9Fd\xE3\xC4#\x01\xA7\xED\xF1\x88\xEA\xD3r>Rz
@findchris
findchris / 11-7-13 hash_key counts
Last active December 27, 2015 03:19
hash_key counts
'2427:4::2013-11-05' => 1
'2280:4::2013-11-05' => 2
'2638:4::2013-11-06' => 2
'1422:1:257:2013-11-06' => 2
'2660:4::2013-11-07' => 2
'2332:4::2013-11-05' => 2
'2623:4::2013-11-05' => 2
'1344:4::2013-11-05' => 2
'2624:4::2013-11-05' => 2
'2486:4::2013-11-05' => 2
@findchris
findchris / gist:6347630
Created August 26, 2013 22:53
JiWire redirect URL source
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link href="http://local.jiwire.com/jwindr.jiwire.com/current/css/a4a/selectablemedia/110/style.css" rel="stylesheet" type="text/css" />
<script src="http://local.jiwire.com/jwindr.jiwire.com/current/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<style>
.finish_hide { position:absolute;z-index:5000;top:190px;width:100%;height:220px; margin:0 auto; visibility:hidden;}
@findchris
findchris / gist:6346961
Created August 26, 2013 21:37
Today's pingdom server IPs
> wget --quiet -O- https://www.pingdom.com/rss/probe_servers.xml | perl -nle 'print $1 if /IP: (([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5]));/'
95.141.32.46
95.211.217.68
91.109.115.41
83.170.113.210
188.138.118.144
174.34.224.167
72.46.140.106
76.72.172.208
184.75.210.226