Skip to content

Instantly share code, notes, and snippets.

View delano's full-sized avatar
👋
Let's talk about building teams

Delano delano

👋
Let's talk about building teams
View GitHub Profile
@delano
delano / docker-compose.yml
Created December 2, 2022 07:23 — forked from drzero42/docker-compose.yml
Postgres logical replication breakage
version: "3"
services:
master:
image: postgres:11
environment:
POSTGRES_PASSWORD: abc123
command: -c config_file=/etc/postgresql/postgresql.conf
volumes:
- ./postgresql.conf:/etc/postgresql/postgresql.conf
@delano
delano / README
Last active October 26, 2022 23:26 — forked from jdowning/ami-clean.sh
Script to clean up Ubuntu EC2 instance before packaging as an AMI
See: https://gist.githubusercontent.com/delano/4eee6bcfce0b6e3c83f1e98d9cd7af16
@delano
delano / cltools.sh
Created June 15, 2016 22:51 — forked from jellybeansoup/cltools.sh
Install Autoconf and Automake on OS X Mountain Lion
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
# Power law (log tail) distribution
# Copyright(C) 2010 Salvatore Sanfilippo
# this code is under the public domain
# min and max are both inclusive
# n is the distribution power: the higher, the more biased
def powerlaw(min,max,n)
max += 1
pl = ((max**(n+1) - min**(n+1))*rand() + min**(n+1))**(1.0/(n+1))
max-1-pl.to_i

A (Nicer) Redis Client for EventMachine

Redis is my favourite key/value store; it’s flexible, easy to set up and insanely fast. [EventMachine][] is a popular Ruby library for doing asynchronous I/O using an event loop. Bindings already [exist][em-redis] for accessing a Redis server using EM’s async-I/O (courtesy of Jonathan Broad), but unfortunately the resulting code has to use [Continuation-Passing Style][cps] via Ruby blocks. A very basic example of what that looks like follows:

require 'digest/sha1'
class String
def hash
Digest::SHA1.hexdigest self
end
def bit
unpack('B*').first
end
@delano
delano / .bashrc
Created July 8, 2009 21:37 — forked from defunkt/.bashrc
# $ tweet "your message"
#
# See: http://solutious.com/blog/2009/07/13/bash-twitter/
#
# Contributors
# * @defunkt for the initial version
# * @anildigital and @grundprinzip for curl-fu
# * @solutious for the SSL sexytime
# See: http://curl.netmirror.org/docs/caextract.html