Skip to content

Instantly share code, notes, and snippets.

# The multipart parser wants to push data to the output stream, and the fog
# uploader wants to pull data from the input stream, so we run the fog upload
# on a separate fiber and use this class to act as the intermediary stream
# between the two processes.
#
# This stream is not a complete implementation, it only handles the behavior we
# need right now.
require 'fiber'
diff --git a/src/main/html/index.html b/src/main/html/index.html
index 481b4cc..043c4b4 100644
--- a/src/main/html/index.html
+++ b/src/main/html/index.html
@@ -42,7 +42,7 @@
console.log("key: " + key);
if(key && key.trim() != "") {
console.log("added key " + key);
- window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
+ window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + key, "header"));^M
#!/usr/bin/node
var b = require('bonescript');
var fs = require('fs');
var util = require('util');
function TemperatureProbe(deviceName) {
this.deviceName = deviceName;
this.path = '/sys/bus/w1/devices/' + deviceName + '/w1_slave';
@codekitchen
codekitchen / streaming_rack_multipart_parser.diff
Last active April 15, 2017 01:16
diff of Rack::Multipart::Parser for streaming uploads
1c1
< require 'rack/utils'
---
> require 'streaming_upload'
3,4c3,18
< module Rack
< module Multipart
---
> class StreamingMultipartRequest < ActionDispatch::Request
> def parse_multipart(env)
@codekitchen
codekitchen / gist:8200786
Last active January 1, 2016 20:59
canvas non-ruby dependencies
imagemagick
libcurl4-gnutls-dev
libmysqlclient-dev
libpq-dev
libsqlite3-dev
libxml2-dev
libxmlsec1
libxmlsec1-dev
libxslt1-dev
nodejs
#!/usr/bin/env rdmd
import
std.algorithm,
std.file,
std.csv,
std.stdio,
std.typetuple,
std.typecons,
std.range,
{
"freighthop::languages": ["ruby"],
"freighthop::ruby_version": "2.0.0-p247",
"freighthop::database::flavors": ["postgres", "mysql"],
"freighthop::database::postgres::users": ["notorious"],
"freighthop::database::postgres::db_names": ["notorious_development","notorious_test"],
"freighthop::database::mysql::users": ["notorious@localhost"],
"freighthop::database::mysql::db_names": ["notorious_development","notorious_test"],
"freighthop::packages": [
"ffmpeg",
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.range;
void times(int count, void delegate() cb) {
for (int i = 0; i < count; ++i) {
cb();
}
class Field < Struct.new(:rows, :cols, :data)
def initialize(rows, cols)
super(rows, cols)
self.data = ([0] * (cols+2)) * (rows+2)
end
def [](x,y)
self.data[real_idx(x,y)]
end
@codekitchen
codekitchen / cassandra_key_to_token.rb
Created October 3, 2013 15:37
convert a key to cassandra token in the style of RandomPartitioner
require 'digest/md5'
digest = Digest::MD5.hexdigest(ARGV[0])
token = digest.to_i(16)
token = token - (1 << bits) if (token & (1 << (bits - 1))) != 0
puts token.abs