By far the best ToDo list I have ever used.
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 | |
mkdir -p ~/bin/ | |
curl -s -L https://gist.github.com/raw/4477190/pmrcp.rb > ~/bin/pmrcp | |
chmod +x ~/bin/pmrcp |
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 bash | |
# haproxyd | |
# Script to start|stop|restart haproxy from /etc/init.d/ | |
# By Phil Monroe. | |
HAPROXY_PATH=/usr/sbin | |
HAPROXY_DAEMON=$HAPROXY_PATH/haproxy | |
HAPROXY_CONFIG=/etc/haproxy/haproxy.cfg | |
test -x $HAPROXY_DAEMON || exit 0 |
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
--- cleanup | |
drop database test; | |
drop user piston; | |
drop user crankshaft; | |
drop user identified; | |
--- setup | |
create database test; | |
\c test |
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 'rufus/scheduler' | |
require 'redis' | |
require 'redis-lock' | |
if $0 == 'sidekiq' | |
$redis = Redis.new | |
def run_rake task | |
$redis.lock_for_update(task, 100, 0) do | |
puts "scheduling #{task}" |
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
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zprofile | |
echo 'eval "$(rbenv init -)"' >> ~/.zprofile | |
exec $SHELL -l | |
brew install readline openssl |
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
def query | |
@query ||= params[:query].to_s.tap do |q| | |
q.strip! | |
q.downcase! | |
q.gsub!(/[^a-z\s]/, '') | |
q.gsub!(/\s+/, ' ') | |
end | |
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
#!/bin/bash | |
bundle exec ruby -e <<RUBY | |
require 'rubygems/commands/uninstall_command' | |
require 'bundler/cli' | |
Gem.loaded_specs.select{|k,v| !v.extensions.empty?}.keys.map do |gem| | |
Gem::Commands::UninstallCommand.new | |
.handle_options ['-x', '-I', gem] | |
.execute rescue nil |
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 'yaml' | |
require 'terminal-table' | |
loop do | |
# Get Running Processes | |
rows = %w(pid client_addr state waiting query_start query) | |
stats = `psql identified_production -t -c 'select #{rows.join(', ')} from pg_stat_activity order by state DESC'` | |
stats = stats.split("\n") | |
stats.map! { |s| s.split('|').map(&:strip) } |
This is just a jotting of notes on how to embed Faye into a single Rails process. Makes it nice to do simple real time things without the need for a separate Faye server/process.
Also uses Faye Redis to work across load balanced Rails apps.
You also need to copy the compiled javascript into vendor/assets/javascripts
and include into application.js
manifest.
Ignore the numbers in the file names... just used to add order to the Gist.
This uses the faye/faye Github repo at edc5b42f6560d31eae61caf00f6765a90e1818d1
since I wanted to use with the Puma rack server and that is only available in the master branch (until Faye 1.0)