Skip to content

Instantly share code, notes, and snippets.

@tomekbielaszewski
tomekbielaszewski / main.go
Last active August 17, 2023 19:22
Example of RabbitMQ reconnect feature. Including recovering already registered consumers.
package main
import (
"fmt"
"log"
"time"
)
func main() {
queue := NewQueue("amqp://guest:guest@localhost:5672/", "hello")
@nuclearglow
nuclearglow / convert-arraybuffer.js
Created January 26, 2018 10:30
ArrayBuffer <-> JSON <-> ArrayBuffer
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));
// send around
// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer
@ytjohn
ytjohn / notes.md
Created November 16, 2016 20:31
quick notes on doing a kvm image from ubuntu cloud image
@ericelliott
ericelliott / .gitignore
Created November 15, 2016 19:51
Sample Node project .gitignore
node_modules
build
npm-debug.log
.env
.DS_Store
@vulpicastor
vulpicastor / cloud-init-ubuntu-trusty.md
Last active May 16, 2020 15:23
Configure a custom Ubuntu 14.04 Athena virtual machine with cloud-init

How to configure a custom Ubuntu 14.04 Athena dialup with cloud-init

Preparations

Install dependencies

apt-get install libvirt-bin virtinst cloud-img-utils
#!/bin/bash
echo "Starting the Cluster on Docker Swarm"
docker pull jayjohnson/rabbitclusternode
docker network create -d overlay testoverlay
swarmnodes="swarm1.internallevvel.com swarm2.internallevvel.com swarm3.internallevvel.com"
for node in $swarmnodes
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 18, 2024 13:59
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@ubermuda
ubermuda / nginx.conf
Created November 5, 2013 22:13
Proxy a unix socket HTTP server to a tcp port using nginx.
server {
listen 127.0.0.1:9000;
location / {
proxy_pass http://unix:/var/run/docker.sock:/;
}
}
@philchristensen
philchristensen / sqs.py
Created September 5, 2013 16:28
Minimal script for sending/reading from Amazon SQS using Boto/Python.
conf = {
"sqs-access-key": "",
"sqs-secret-key": "",
"sqs-queue-name": "",
"sqs-region": "us-east-1",
"sqs-path": "sqssend"
}
import boto.sqs
conn = boto.sqs.connect_to_region(
@adityamukho
adityamukho / User.js
Last active November 11, 2021 21:41
Passport authentication for Sails.js 0.9.x
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {