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 / gist:56ce76d633223a7a634b
Created January 20, 2015 22:04
Page that generates 3 blank image sources
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>true[X]</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"beacon":"beacon-6.newrelic.com","errorBeacon":"bam.nr-data.net","licenseKey":"6781978f3f","applicationID":"1341938","transactionName":"dVdXRkVcCQhUQ0pWDFFZXldaVgsQQh4LVhU=","queueTime":0,"applicationTime":527,"agentToken":null,"agent":"js-agent.newrelic.com/nr-476.min.js","ttGuid":"58f2de1f05378d97"}</script>
<script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o?o:e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({QJf3ax:[fu
@findchris
findchris / all_crons.sh
Created November 25, 2014 19:41
List all cron jobs on a system
#!/bin/bash
# Credit to: http://serverfault.com/questions/135906/when-does-cron-daily-run
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
@findchris
findchris / gist:f2c95f18edc198375487
Created October 3, 2014 18:54
RTB process pre/post bridges
Pre-Bridges:
root 23061 26.9 5.6 558512 429120 ? Sl 03:29 223:20 exchange.rb -e prod -p 9000
root 23159 27.1 6.2 617852 476272 ? Sl 03:30 225:20 exchange.rb -e prod -p 9001
root 23233 25.8 6.3 615652 487016 ? Sl 03:30 214:04 exchange.rb -e prod -p 9002
root 23315 27.5 5.5 554480 425512 ? Rl 03:30 228:07 exchange.rb -e prod -p 9003
Post-Bridges:
root 19967 12.4 4.1 447460 319724 ? Rl Oct02 144:25 exchange.rb -e prod -p 9000
root 20017 12.0 4.5 473164 344452 ? Sl Oct02 139:48 exchange.rb -e prod -p 9001
root 20067 12.0 4.0 433524 308436 ? Sl Oct02 140:33 exchange.rb -e prod -p 9002