Skip to content

Instantly share code, notes, and snippets.

View squaremo's full-sized avatar
💭
how does computer

Michael Bridgen squaremo

💭
how does computer
  • London, formerly EU
View GitHub Profile
@squaremo
squaremo / ctl.sh
Last active August 29, 2015 13:56
Single-host clustering
NODE=rabbit$1
shift 1
rabbitmqctl -n "$NODE@$(hostname -s)" $*
@squaremo
squaremo / consumer.py
Created February 26, 2014 12:37
Topic publisher / consumer
import pika
import sys
import logging
logging.basicConfig(level=logging.CRITICAL)
params = pika.URLParameters('amqp://guest:guest@localhost:25671/%2F')
conn = pika.BlockingConnection(params)
ch = conn.channel()

Keybase proof

I hereby claim:

  • I am squaremo on github.
  • I am squaremo (https://keybase.io/squaremo) on keybase.
  • I have a public key whose fingerprint is BA8E EA68 BE80 97D9 BE8A E911 B105 5652 14C3 5205

To claim this, I am signing this object:

@squaremo
squaremo / stress.js
Created July 7, 2014 08:52
Testing RabbitMQ's ability to recover from a lot of channels and queues
// npm install amqplib
var rmq = require ('amqplib/callback_api');
TOTAL = process.argv[2] || 5000;
// three local cluster nodes
var nodes = [25671, 25672, 25673];
var connected = latch(nodes.length, go);
(defn hello-loop [inbox outbox control]
(go-loop []
(alt! ;; choice
inbox ([name] (do
(>! outbox (str "Hello" name)) ;; put
(recur))) ;; loop
control nil)))
(let [in (chan) ;; construct a channel
out (chan)
@squaremo
squaremo / main.go
Created October 5, 2017 22:13
docker reg experimentation
package main
import (
"io/ioutil"
"os"
"github.com/heroku/docker-registry-client/registry"
)
func bail(err error) {
HTTP/1.1 200 OK
Server: nginx/1.13.3
Date: Thu, 23 Nov 2017 15:54:10 GMT
Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
Content-Length: 14781
Connection: keep-alive
Docker-Content-Digest: sha256:43ebd38f6d8f4ba5659ac6cf34706d133b1e92924d2df36135d3c781d7f472f9
X-Frame-Options: DENY
Strict-Transport-Security: max-age=63072000; preload
var amqp = require('../channel_api')
var Promise = require('bluebird')
process.on('error', err => {
console.log('#338: process error', err)
})
process.on('uncaughtException', function (err) {
console.log('#338: process uncaught exception', err)
})
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
package main
import (
"bytes"
"context"
"fmt"
"io"
"os"
"os/exec"
"sync"