- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
######## | |
# | |
# Ruby Oneliner FUN ! | |
# | |
# Cool, on http://science.howstuffworks.com/quote1463.htm | |
# there are 1982 quotes - lets get them and stuff them into a CSV file d(^^)p | |
# | |
# Dependencies: ruby, hpricot, open-uri, zsh (or whatever) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redis' | |
module Nanite | |
class State | |
include Enumerable | |
# this class encapsulates the state of a nanite system using redis as the | |
# data store. here is the schema, for each agent we store a number of items, | |
# for a nanite with the identity: nanite-foobar we store the following things: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Setting up chef..." | |
sudo apt-get -y update | |
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert | |
cd /tmp | |
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz | |
tar zxf rubygems-1.3.4.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
respond_to :html, :xml, :json | |
# GET /users | |
# GET /users.xml | |
def index | |
@users = User.all | |
respond_with(@users) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In response to all the responses to: | |
http://twitter.com/rtomayko/status/1155906157 | |
You should never do this in a source file included with your library, | |
app, or tests: | |
require 'rubygems' | |
The system I use to manage my $LOAD_PATH is not your library/app/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Example: | |
# $: git log --numstat -w --summary --date=iso | this.rb | |
# <timestamp> <added> <deleted> | |
# | |
require "time" | |
DATE = /^Date:(.*)/ | |
DIFF = /^(\d+)\s+(\d+)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Usage: | |
# cd /path/to/rails_app | |
# wget "http://is.gd/sIkX" | |
# bash parolkar_stat.sh | |
# cat stat.txt | |
# | |
echo "Data for parolkar =================" > stat.txt | |
cat /proc/cpuinfo >> stat.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Patched mongrel for Garbage Collection | |
require 'mongrel' | |
unless Mongrel.const_defined?("UnixDispatchServer") | |
puts "Patched mongrel required!" | |
exit | |
end | |
Mongrel::UnixDispatchServer.preload_application do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |