midi - like json
on / off which note
gem install midilib
gem install midiator
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: redis-server | |
| # Required-Start: $syslog | |
| # Required-Stop: $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
| require "resque" | |
| require "resque/failure/multiple" | |
| require "resque/failure/redis" | |
| # Configure Resque connection from config/redis.yml. This file should look | |
| # something like: | |
| # development: localhost:6379 | |
| # test: localhost:6379:15 | |
| # production: localhost:6379 | |
| Resque.redis = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env] |
| deploy "/home/amsrv/app/Cornice" do | |
| repo "[email protected]:Aslan/TestApp.git" | |
| revision "HEAD" # or "HEAD" or "TAG_for_1.0" or (subversion) "1234" | |
| user "amsrv" | |
| group "amsrv" | |
| enable_submodules true | |
| migrate true | |
| migration_command "rake db:migrate --trace" | |
| symlink_before_migrate "config/database.yml" => "config/database.yml" | |
| environment "RAILS_ENV" => "production" |
| #!/bin/sh | |
| set -u | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| APP_ROOT=/home/deploy/public_html/rm/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| ENV=production |
| # This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
| # from the project root directory. | |
| ENV["RAILS_ENV"] ||= 'test' | |
| require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) | |
| require 'spec/autorun' | |
| require 'spec/rails' | |
| # Uncomment the next line to use webrat's matchers | |
| #require 'webrat/integrations/rspec-rails' | |
| # Config for Nginx to act as a front-end for Riak | |
| # The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc) | |
| # Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_) | |
| # Config is in /etc/nginx/sites-available/default or somewhere like that | |
| # Set up load-balancing to send requests to all nodes in the Riak cluster | |
| # Replace these IPs/ports with the locations of your Riak nodes | |
| upstream riak_hosts { | |
| server 127.0.0.1:8098; |
| #!/usr/bin/ruby | |
| # memcached munin plugin | |
| # requirements: memcached and the memcache gem (sudo gem install memcache) | |
| require 'rubygems' | |
| require 'memcache' | |
| HOST = ENV['HOST'].nil? ? '127.0.0.1' : ENV['HOST'] | |
| PORT = ENV['PORT'].nil? ? 11211 : ENV['PORT'] |
| require 'sinatra/base' | |
| require 'sinatra/middleware' | |
| class App < Sinatra::Base | |
| register Sinatra::Middleware | |
| rack do |env| | |
| env['cool.value'] = 42 | |
| status, header, body = yield env | |
| [status, header, body.map(&:downcase)] | |
| end |
| set :rails_env, :production | |
| set :unicorn_binary, "/usr/bin/unicorn" | |
| set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
| set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |