Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
| # Setting the prefix from C-b to C-a | |
| set -g prefix C-a | |
| # Free the original Ctrl-b prefix keybinding | |
| unbind C-b | |
| #setting the delay between prefix and command | |
| set -sg escape-time 1 | |
| # Ensure that we can send Ctrl-A to other apps | |
| bind C-a send-prefix | |
| # Set the base index for windows to 1 instead of 0 | |
| set -g base-index 1 |
| #!/bin/csh | |
| while (1) | |
| curl -silent -A "iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.7.4; en) AppleWebKit/533.20.25" 'http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=29526&mt=12' | grep -i "mountain lion" > /dev/null | |
| if ($? == 0) then | |
| echo "Available" | |
| say -v Vicki "MOUNTAIN LION MAY BE AVAILABLE. Go... go now and download it" | |
| else | |
| echo "Nada" | |
| endif | |
| sleep 600 |
| find . -name '*ipa' -exec metaipa.sh {} \; |
| #!/bin/bash | |
| # +----------------------------------------------------------------------+ | |
| # | | | |
| # | Mount the root file system / with the option noatime | | |
| # | | | |
| # | By Philipp Klaus <http://blog.philippklaus.de> | | |
| # | Tip found on <http://blogs.nullvision.com/?p=275> | | |
| # | | | |
| # +----------------------------------------------------------------------+ |
| bash -c ' | |
| <% if knife_config[:bootstrap_proxy] -%> | |
| ( | |
| cat <<'EOP' | |
| <%= "proxy = #{knife_config[:bootstrap_proxy]}" %> | |
| EOP | |
| ) > ~/.curlrc | |
| <% end -%> | |
| if [ ! -f /usr/bin/chef-client ]; then |
Some exercises from the Falsy Values workshops.
The good parts:
| # Make gems available | |
| require 'rubygems' rescue nil | |
| require 'irb' rescue nil | |
| require 'yaml' | |
| Bundler.require(:default, :console) if defined?(Bundler) | |
| alias q exit | |
| class Object | |
| def local_methods |
| # This works with steak 0.3.x and rspec 1.x | |
| # For steak --pre and rspec 2 see this fork: http://gist.github.com/448487 | |
| # Put this code in acceptance_helper.rb or better in a new file spec/acceptance/support/javascript.rb | |
| Spec::Runner.configure do |config| | |
| config.before(:each) do | |
| Capybara.current_driver = :selenium if options[:js] | |
| end |
| require 'digest/sha1' | |
| module EasyAuth | |
| # http://techspeak.plainlystated.com/2010/03/drop-dead-simple-authentication-for.html | |
| # To generate a hashed password (in irb): | |
| # require 'easy_auth' | |
| # EasyAuth.hash('my_password') # Put this in AUTHORIZED_USERS | |
| AUTHORIZED_USERS = { |
| set :application, "example.com" | |
| set :deploy_to, "/var/www/#{application}" | |
| role :app, "example.com" | |
| role :web, "example.com" | |
| role :db, "example.com", :primary => true | |
| set :scm, :git | |
| set :repository, "ssh://shay@example.com/git/example.com" | |
| set :branch, "origin/master" |