Skip to content

Instantly share code, notes, and snippets.

@JCallicoat
JCallicoat / leap-a-day.c
Created April 16, 2015 02:33
leap-a-day.c from redhat edited for ubuntu
/* Leap second stress test
* by: John Stultz (john.stultz@linaro.org)
* (C) Copyright IBM 2012
* (C) Copyright 2013, 2015 Linaro Limited
* Licensed under the GPLv2
*
* This test signals the kernel to insert a leap second
* every day at midnight GMT. This allows for stessing the
* kernel's leap-second behavior, as well as how well applications
* handle the leap-second discontinuity.
@JCallicoat
JCallicoat / rabbit_procs.sh
Created December 16, 2014 23:46
Show rabbitmq processes count
#!/bin/bash
CAT="/bin/cat"
HOSTNAME=$(/bin/hostname)
RABBITMQ_HOME="/var/lib/rabbitmq"
RABBITMQ_COOKIE_PATH="$RABBITMQ_HOME/.erlang.cookie"
RABBITMQ_COOKIE=$($CAT $RABBITMQ_COOKIE_PATH) || exit 1
ERLANG_ROOT="/usr/lib/erlang"
ERL_CALL="$ERLANG_ROOT/lib/erl_interface-3.7.15/bin/erl_call"
PROCS=$($ERL_CALL -c $RABBITMQ_COOKIE -sname rabbit@$HOSTNAME -a 'erlang system_info [process_count]')
echo "procs.$HOSTNAME $PROCS"
--- /usr/share/pyshared/quantum/service.py.orig 2013-11-25 17:49:53.121840504 -0500
+++ /usr/share/pyshared/quantum/service.py 2013-11-25 18:08:03.298024098 -0500
@@ -37,6 +37,9 @@
cfg.IntOpt('periodic_interval',
default=40,
help=_('Seconds between running periodic tasks')),
+ cfg.IntOpt('api_workers',
+ default=0,
+ help=_('Number of separate worker processes for service')),
cfg.IntOpt('periodic_fuzzy_delay',
@JCallicoat
JCallicoat / regex-golf.clj
Created January 7, 2014 09:25
Translation of the first part of Norvig's solution to xkcd 1313 to clojure
(use '[clojure.string :only [split, join]])
(use '[clojure.set :only [difference]])
(def winners
(let [w "washington adams jefferson jefferson madison madison monroe
monroe adams jackson jackson vanburen harrison polk taylor pierce buchanan
lincoln lincoln grant grant hayes garfield cleveland harrison cleveland mckinley
mckinley roosevelt taft wilson wilson harding coolidge hoover roosevelt
roosevelt roosevelt roosevelt truman eisenhower eisenhower kennedy johnson nixon
nixon carter reagan reagan bush clinton clinton bush bush obama obama"]
#!/usr/bin/env ruby
class ArrayWithHashes
def initialize(hashes)
@hashes = hashes
end
def find_by(selector)
@hashes.select do |h|
#!/usr/bin/env ruby
class ArrayWithHashes
def initialize(hashes)
@hashes = hashes
end
def find_by(selector)
hashes = []
@JCallicoat
JCallicoat / gist:4709916
Created February 4, 2013 21:35
Refried beans
#!/bin/bash
# REFRIED BEANS
# 'soft' rekick a rcps environment
echo "PURGING THE BEANS"
apt-get -y purge `dpkg -l | awk '/mysql/ {print $2}'`
apt-get -y purge `dpkg -l | awk '/keystone/ {print $2}'`
Images Talk
- Who are we?
Rackspace Private Cloud. We install and operate Openstack clusters, both locally in our datacenters, and remotely in customer datacenters.
<pending>Reference Alamo v3?</pending>
- What are we talking about?
@JCallicoat
JCallicoat / gist:3877163
Created October 12, 2012 03:41
Go thing
package main
import "net/http"
import "fmt"
func hello(w http.ResponseWriter, r *http.Request) {
contentType := w.Header().Get("Content-Type")
if contentType == "application/json" {
fmt.Fprintln(w, `{"Hello": "JSON"}`)
} else {
@JCallicoat
JCallicoat / gist:3855876
Created October 9, 2012 00:44
fabric + sh??? winning!
from sh import ls
from fabric.api import run, env
env.hosts = ['localhost', 'rightfootin.info']
def test():
print(ls('/')) # runs on every item in env.hosts