This file contains hidden or 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
| bash -c ' | |
| <% if knife_config[:bootstrap_proxy] -%> | |
| ( | |
| cat <<'EOP' | |
| <%= "proxy = #{knife_config[:bootstrap_proxy]}" %> | |
| EOP | |
| ) > ~/.curlrc | |
| <% end -%> | |
| if [ ! -f /usr/bin/chef-client ]; then |
This file contains hidden or 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
| # ruby -rpp -e 'pp Encoding.list.map(&:name)' | |
| ["ASCII-8BIT", | |
| "UTF-8", | |
| "US-ASCII", | |
| "Big5", | |
| "Big5-HKSCS", | |
| "Big5-UAO", | |
| "CP949", | |
| "Emacs-Mule", | |
| "EUC-JP", |
This file contains hidden or 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 game(attackers = 3, defenders = 2) # returns [attacker, defender] loses | |
| attack = (1..attackers).map { rand(6) }.sort.reverse[0..1].reverse | |
| defense = (1..defenders).map { rand(6) }.sort | |
| max_wins = [attackers, defenders].min | |
| attack_wins = (1..max_wins).map { attack.pop > defense.pop }.select{ |x| x}.count | |
| [max_wins - attack_wins, attack_wins] | |
| end | |
| def full_game(armies = 30) | |
| attack = defense = armies | |
| while [attack-1, defense].min > 0 |
This file contains hidden or 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
| u = User.find_by_email("old@email.com") | |
| u.email = "new@email.com" | |
| def u.postpone_email_change?; false; end | |
| u.save |
This file contains hidden or 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
| # postinstall.sh for Ubuntu 12.04 base ami | |
| # Online at: https://gist.github.com/andruby/5389159 | |
| # Usage: config.vm.provision :shell, :inline => "curl 'https://gist.github.com/andruby/5389159/raw' | sudo sh" | |
| if hash chef-client 2>/dev/null; then | |
| echo "Chef is already installed" | |
| else | |
| echo "Chef is not available on the system" | |
| echo "Bootstrapping ruby & chef" |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <sparkleshare> | |
| <user> | |
| <name>Andrew</name> | |
| <email>andruby@example.com</email> | |
| </user> | |
| <notifications>True</notifications> | |
| <folder> | |
| [...] | |
| </folder> |
This file contains hidden or 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
| #include | |
| https://gist.github.com/andruby/5571940/raw/cloud-config | |
| https://gist.github.com/andruby/5571940/raw/remote.sh |
This file contains hidden or 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 | |
| export DISPLAY=:0 | |
| export GPU_MAX_ALLOC_PERCENT=100 | |
| export GPU_USE_SYNC_OBJECTS=1 | |
| export THREAD_CONCURRENCY=7680 | |
| export INTENSITY=12 | |
| export GPU_THREADS=2 | |
| export WORKSIZE=256 | |
| export LOOKUP_GAP=2 |
This file contains hidden or 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
| Prefix Verb URI Pattern Controller#Action | |
| new_user_session GET /users/sign_in(.:format) devise/sessions#new | |
| user_session POST /users/sign_in(.:format) devise/sessions#create | |
| destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy | |
| user_password POST /users/password(.:format) devise/passwords#create | |
| new_user_password GET /users/password/new(.:format) devise/passwords#new | |
| edit_user_password GET /users/password/edit(.:format) devise/passwords#edit | |
| PATCH /users/password(.:format) devise/passwords#update |