These are some notes on infrastructure & deployment.
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 | |
# ddweb.sh - enable/disable DD-WRT web console access | |
# Darian Anthony Patrick <dap@darianpatrick.com> | |
# | |
# Control access to the web management console | |
# of devices using the DD-WRT firmware by | |
# enabling/disabling the HTTP & HTTPS access. | |
# | |
# Repository: http://gist.github.com/151750 |
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
after "deploy:setup", "thinking_sphinx:shared_sphinx_folder" | |
after 'deploy:finalize_update', 'thinking_sphinx:symlink_indexes' | |
after 'deploy:restart', 'thinking_sphinx:restart' | |
namespace :thinking_sphinx do | |
task :symlink_indexes, :roles => [:app] do | |
run "ln -nfs #{shared_path}/db/sphinx #{latest_release}/db/sphinx" | |
end | |
task :restart do | |
configure |
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
/* | |
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace | |
so it's better encapsulated. Now you can have multiple random number generators | |
and they won't stomp all over eachother's state. | |
If you want to use this as a substitute for Math.random(), use the random() | |
method like so: | |
var m = new MersenneTwister(); |
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
task :deploy => ['deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
task :migrations => [:push, :off, :migrate, :restart, :on, :tag] | |
task :rollback => [:off, :push_previous, :restart, :on] | |
task :push do | |
puts 'Deploying site to Heroku ...' | |
puts `git push heroku` | |
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 | |
# Source global definitions | |
[ -f /etc/bashrc ] && . /etc/bashrc | |
[ -f /etc/profile ] && . /etc/profile | |
export EDITOR=vim | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 |
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
# Put this in your ~/.gitconfig or ~/.config/git/config | |
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName> | |
[user] | |
name = Your Full Name | |
email = your@email.tld | |
[color] | |
# Enable colors in color-supporting terminals | |
ui = auto | |
[alias] | |
# List available aliases |
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 GameOfLife | |
attr_accessor :state, :height, :width, :rules | |
def initialize options={} | |
self.rules = options[:rules] || [ [0,0,0,1,0,0,0,0,0], [0,0,1,1,0,0,0,0,0] ] | |
self.height = options[:size] || options[:height] || 10 | |
self.width = options[:size] || options[:width] || 10 | |
self.state = options[:seed] || grid { rand(2) } |
OlderNewer