Skip to content

Instantly share code, notes, and snippets.

@mrkplt
mrkplt / gist:2715219
Created May 17, 2012 00:39
Rails App init with test framework
$ rails new <app_name> --skip-test-unit
$ cd <app_name>/
$ git init
$ git add .
$ git commit -m 'first commit'
$ git remote add origin <git repo>
$ git push -u origin master
$ mate .
/**
@mrkplt
mrkplt / unicorn_example.sh
Created June 21, 2012 23:15 — forked from tualatrix/unicorn_example.sh
An example of unicorn init script for Ubuntu
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
#!/bin/bash
###############################################
# To use:
# wget -O install-redis.sh https://gist.github.com/mrkplt/8137324/raw
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
echo "*****************************************"
@mrkplt
mrkplt / redis-server
Last active January 1, 2016 11:19 — forked from tessro/redis-server
#!/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
# extracted from http://www.thekua.com/atwork/2011/07/ruby-script-to-capture-http-traffic/
require 'webrick'
include WEBrick
class Simple < WEBrick::HTTPServlet::AbstractServlet
def do_POST(request, response)
puts "Body: " + request.body
puts "Header: " + request.raw_header.to_s
# http://www.brianstorti.com/implementing-a-priority-queue-in-ruby
class PriorityQueue
attr_reader :elements
def initialize
@elements = [nil]
end
def <<(element)
@elements << element