Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / AWS.js
Last active January 31, 2020 03:00
Google Script for Excel and AWS instance pricing + Reserved Instances
/**=
* User: zircote
* Date: 16/10/2013
* Time: 08:59
*/
var SERVICE_HOST = 'http://aws.amazon.com'
var data_sources = {
"linux-od": {
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
@zircote
zircote / ansible_playbook.sh
Last active December 21, 2015 04:39
Single line creation of a default ansible playbook structure
mkdir -p {group_,host_}vars \
roles/{common,webtier}/{tasks,handlers,templates,files,vars} \
role/{monitoring,myapp} && \
touch {production,stage,development,testing,{site,webservers,dbservers}.yml}
@zircote
zircote / LICENSE
Created August 7, 2013 01:14 — forked from joerayme/LICENSE
Copyright (c) 2013 Couller Ltd. and Joseph Ray
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@zircote
zircote / ping.py
Created August 6, 2013 22:31
ping stats
import argparse
import ConfigParser
import subprocess
import shlex
import re
import time
'''Ping Class to monitor arbitrary ping times
'''
@zircote
zircote / redis-stats
Last active December 20, 2015 16:29
redis statsd collection
#!/usr/bin/env python
import redis
import statsd
import time
import argparse
import logging
import sys
import os
@zircote
zircote / munin-plugin-redis_
Last active May 21, 2020 02:51
Munin Plugin for redis requiring only `redis-cli`
#!/usr/bin/env bash
#
# Copyright 2013 Robert Allen
#
# 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
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
@zircote
zircote / test-before-observing.php
Created June 18, 2013 16:08
ProTip: Test the key exists before accessing the value in the switch.
<?php
switch (isset($headers['content-type']) && $headers['content-type']) {
case 'application/xml':
$format = 'XML';
break;
case 'application/json':
default:
$format = 'JSON';
}