Skip to content

Instantly share code, notes, and snippets.

/**
Supports creation of a String from pieces
*/
public class StringBuilder {
private var stringValue: String
/**
Construct with initial String contents
:param: string Initial value; defaults to empty string
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
#!/usr/bin/env ruby
#
# Nagios plugin to monitor Redis sentinel
#
# Checks general connectivity to a Redis sentinel server and will go critical
# for any of the following conditions:
# * Inability to connect to the sentinel server
# * Sentinel reports it isn't monitoring any masters
# * Sentinel has entered TILT mode
#
@felipeg48
felipeg48 / sentinel
Last active August 29, 2015 14:17 — forked from mathieue/sentinel
#!/bin/bash
### BEGIN INIT INFO
# Provides: redis sentinel
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts redis sentinel
# Description: Starts redis sentinel using start-stop-daemon
### END INIT INFO
vagrant@ubuntu-12:/docker-pub/redis$ cat base/2.8.1/Dockerfile
FROM ubuntu:12.10
MAINTAINER James McKernan [email protected]
RUN apt-get update
RUN apt-get install -y build-essential
ADD redis-2.8.1.tar.gz redis-2.8.1.tar.gz
RUN tar xvfz redis-2.8.1.tar.gz
RUN cd redis-2.8.1 && make
RUN cd redis-2.8.1 && make install
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@felipeg48
felipeg48 / appify
Last active August 29, 2015 14:21 — forked from mathiasbynens/appify
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@felipeg48
felipeg48 / shell.swift
Last active August 29, 2015 14:21 — forked from wearhere/shell.swift
#!/usr/bin/xcrun swift -i -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
//
// shell.swift
//
// Shell scripting in Swift, using a proper hashbang and a custom subshell operator.
// To run: `chmod +x shell.swift && ./shell.swift`.
//
// If you edit this in Xcode, ignore the error on the hashbang line.
// To play around with this in a playground, comment out the hashbang line.
//
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@felipeg48
felipeg48 / HornetQClient.java
Last active August 26, 2015 16:42 — forked from monzou/HornetQClient.java
HornetQ : Embedded + JMS + Remote Example
package hornetq;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Topic;