Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

# Sinatra minimalist RestMQ
# no COMET, just /q/ routes and queue logic
# the core of RestMQ is how it uses Redis' data types
require 'rubygems'
require 'sinatra'
require 'redis'
require 'json'
QUEUESET = 'QUEUESET' # queue index
@mbostock
mbostock / .block
Last active February 9, 2016 01:55
Cubehelix
license: gpl-3.0
@xymor
xymor / whitelist-ssl.sh
Last active September 28, 2016 01:19
Java whitelist ssl certificate
keytool -printcert -sslserver secure.fcontrol.com.br -rfc > fcontrol.pem
#alternative: openssl s_client -quiet -showcerts -connect secure.fcontrol.com.br:443 | sed -n '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > fcontrol.pem
keytool -import -trustcacerts -alias secure.fcontrol.com.br -file fcontrol.pem -keystore /home/raphaelm/projects/git-repos/ideais-kanlo/etc/kanlo2/vmfiles/etc/pki/java/cacerts
#list trusted certificates
keytool -list -keystore /home/raphaelm/projects/git-repos/ideais-kanlo/etc/kanlo2/vmfiles/etc/pki/java/cacerts
@hardillb
hardillb / wemo-light.js
Last active November 3, 2016 08:08
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-light.js" for instructions
var wemo = require('wemo-js');
var http = require('http');
var util = require('util');
var xml2js = require('xml2js');
var postbodyheader = [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">',
'<s:Body>'].join('\n');
@henrik-muehe
henrik-muehe / Dockerfile
Created August 5, 2013 11:47
Allows installing the ubuntu "fuse" package without creating any devices. Used to install packages on docker which require fuse but do not actively use it.
...
# Fake a fuse install
RUN apt-get install libfuse2
RUN cd /tmp ; apt-get download fuse
RUN cd /tmp ; dpkg-deb -x fuse_* .
RUN cd /tmp ; dpkg-deb -e fuse_*
RUN cd /tmp ; rm fuse_*.deb
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
RUN cd /tmp ; dpkg-deb -b . /fuse.deb
-- clock test
--
-- adjust mul/div
-- with e2/e3
--
-- change clock settings
-- from parameters menu
--
engine.name = 'PolyPerc'
@massie
massie / KryoRegistrator.scala
Created October 29, 2013 23:59
Here's an example of how to embed Avro objects into a Kryo stream. You only need to register each Avro Specific class in the KryoRegistrator using the AvroSerializer class below and you're ready to go.
/*
* Copyright (c) 2013. Regents of the University of California
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
module MockSnowflake
TWEPOCH = 1142974214000
WORKERIDBITS = 5
DATACENTERIDBITS = 5
MAXWORKERID = -1 ^ (-1 << WORKERIDBITS)
SEQUENCEBITS = 12
WORKERIDSHIFT = SEQUENCEBITS
DATACENTERIDSHIFT = SEQUENCEBITS + WORKERIDBITS
TIMESTAMPLEFTSHIFT = SEQUENCEBITS + WORKERIDBITS + DATACENTERIDBITS
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet