Skip to content

Instantly share code, notes, and snippets.

View flazz's full-sized avatar

Franco Lazzarino flazz

View GitHub Profile
@flazz
flazz / auth.lua
Created August 23, 2016 23:08 — forked from kyleondata/auth.lua
local count = 0
core.register_service("auth", "http", function (applet)
count = count + 1
-- Get X-Auth-Token --
local token = applet.headers['x-auth-token'][0]
local cmd = 'curl -H "X-Auth-Token:'..token..'"'
cmd = cmd..' -sL -w "%{http_code}\\n"'
cmd = cmd..' "https://staging.identity-internal.api.rackspacecloud.com/v2.0/tokens/'..token..'"'
cmd = cmd..' -o /dev/null'
@flazz
flazz / gist:1500686
Created December 20, 2011 07:45 — forked from sbellware/gist:1500079
Extend vs Include in Metaclass
require 'ruby-prof'
module M
def foo
puts "M#foo"
end
end
class C
end
@flazz
flazz / gist:239053
Created November 19, 2009 21:10 — forked from anonymous/gist:239024
% spec sp.rb ~
...nil
{"Content-Type"=>"text/html"}
.Fnil
{"Content-Type"=>"text/html"}
Fnil
{"Content-Type"=>"text/html"}
.
1)
@flazz
flazz / gist:239034
Created November 19, 2009 20:43 — forked from anonymous/gist:239024
it "returns 400 on POST if request is missing X-Package-Name header" do
post '/', "FOO", "Content-MD5" => "cccccccccccccccccccccccccccccccc"
last_response.status.should == 400
last_response.body.should == "Missing parameter: package_name"
end
# % spec sp.rb ~
# nil
# {"Content-Type"=>"text/html"}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
char server[20] = "wwwsearch.bing.com";
int result_count;
char query[20];
char command[100];
char buffer[10000];
md5 = Digest::MD5.new
md5 << File.read(filename)
puts [md5.hexdigest.scan(/../).pack("H2" * 16)].pack("m").chomp
@flazz
flazz / blog.rb
Created May 19, 2009 20:25 — forked from lenary/blog.rb
require 'sinatra'
class Blog < Sinatra::Default
get '/' do
..
end
end
if __FILE__ == $0
Blog.run!
end
require 'describe'
require 'fileutils'
require 'spec'
require 'sinatra/test'
require 'spec/interop/test'
set :environment, :test
describe 'Describe Service' do
include Sinatra::Test
@flazz
flazz / gist:78125
Created March 12, 2009 15:35 — forked from lydiam/gist:78122
<?xml version="1.0" encoding="ISO-8859-1"?><METS:mets xmlns:METS="http://www.loc.gov/METS/" xmlns:daitss="http://www.fcla.edu/dls/md/daitss/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:palmm="http://www.fcla.edu/dls/md/palmm/" xmlns:rightsmd="http://www.fcla.edu/dls/md/rightsmd/" xmlns:techmd="http://www.fcla.edu/dls/md/techmd/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" LABEL="May 2008 stats" OBJID="DT_DTL01_77643" TYPE="" xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/simpledc20021212.xsd http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd http://www.fcla.edu/dls/md/techmd/ http://www.fcla.edu/dls/md/techmd.xsd http://www.fcla.edu/dls/md/palmm/ http://www.fcla.edu/dls/md/palmm.xsd http://www.fcla.edu/dls/md/rightsmd/ htt