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
#!/usr/bin/env bash | |
set -e | |
set -o pipefail | |
BOLD="$(printf "\x1B[1m")" | |
CLEAR="$(printf "\x1B[0m")" | |
ruledir="$(mktemp -d /tmp/fw.XXXXXX)" |
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
namespace :rbenv do | |
namespace :vars do | |
desc "Display .rbenv-vars on all servers" | |
task :show do | |
on roles(:all) do |host| | |
execute "cat #{fetch(:deploy_to)}/.rbenv-vars" | |
end | |
end | |
desc "Add or update single .rbenv-vars setting (cap stage rbenv:vars:set[NAME,value])" |
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
$ irb | |
irb(main):001:0> require 'net/ping' | |
=> true | |
irb(main):002:0> p = Net::Ping::External.new('www.google.com; touch /tmp/hello') | |
=> #<Net::Ping::External:0x007fc95a949488 @host="www.google.com; touch /tmp/hello", @port=7, @timeout=5, @exception=nil, @warning=nil, @duration=nil> | |
irb(main):003:0> p.ping? | |
=> true | |
irb(main):004:0> ^D | |
$ ls -l /tmp/hello | |
-rw-r--r-- 1 josh wheel 0 Dec 6 14:57 /tmp/hello |
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
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
# documentation. | |
APP_DIRECTORY = "/srv/apps/example" | |
worker_processes 4 | |
working_directory "#{APP_DIRECTORY}/current" # available in 0.94.0+ | |
listen "#{APP_DIRECTORY}/shared/tmp/unicorn.sock", :backlog => 64 | |
timeout 30 |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Encode qw(encode decode); | |
use 5.10.0; | |
use DBI; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Encode; | |
while (<>) { | |
print "\n$_" if /^COPY/; |
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
$ be kitchen test all -p | |
-----> Starting Kitchen | |
-----> Cleaning up any prior instances of <default-ubuntu-1204> | |
-----> Cleaning up any prior instances of <default-sl-63> | |
-----> Destroying <default-ubuntu-1204> | |
-----> Destroying <default-sl-63> | |
Called 'load_file' without the :safe option -- defaulting to safe mode. | |
Finished destroying <default-sl-63> (0m0.00s). | |
-----> Testing <default-sl-63> | |
-----> Creating <default-sl-63> |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my @lines = `cat /proc/net/dev`; | |
my @rx_fields = qw(bytes packets errs drop fifo frame compressed multicast); | |
my @tx_fields = qw(bytes packets errs drop fifo frame compressed); | |
for my $line (@lines) { | |
next if $line !~ /:/; |
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
for i in {1..10}; do printf "%*sbutts\n" $i ""; done | |
butts | |
butts | |
butts | |
butts | |
butts | |
butts | |
butts | |
butts | |
butts |
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
my @a=$*IN.get.comb; | |
say [max] gather { take [*] @a[$_..$_+4] for ^(@a.elems-4) } |