Hex-escape sensitive tcl/shell characters
printf $(printf "\x26\x3b\x60\x27\x22\x7c\x2a\x3f\x7e\x3c\x3e\x5e\x28\x29\x5b\x5d\x7b\x7d\x24\x5c\n" | ./escape)
| #!/bin/bash | |
| # Not quite as fast as ifs, but pretty good! BASH specific. | |
| path=":/a b/c:::x/y z:/a:/b:/c:/d:/e:/f:/g:/h:/i:/j" | |
| IFS=: read -a arr <<<"$path" | |
| printf "%s\n" "${arr[@]}" |
| #!/usr/bin/env ruby | |
| # | |
| # terminal1> ruby logswitch.rb | |
| # terminal2> kill -s USR1 $(cat pid_file) | |
| # | |
| File.open("pid_file", "w") do |io| | |
| io.puts Process.pid | |
| end |
| #!/usr/bin/expect -f | |
| ############################################################################# | |
| # | |
| # Arguments passed on the command line end up as a list of escaped strings. | |
| # Hence you can eval them to get the literal values properly entered into | |
| # an expect command. | |
| # | |
| # ./expect_argv '---&;`'\''"|*?~<>^()[]{}$\---' | |
| # ---&;`'"|*?~<>^()[]{}$\--- | |
| # |
| #!/bin/bash | |
| # works | |
| cat > example <<SCRIPT | |
| #!/usr/bin/env expect -f | |
| spawn irb | |
| interact | |
| SCRIPT | |
| chmod +x example | |
| ./example |
| # path=${PATH// /_} | |
| # find ${path//:/ } -name 'comv-*' | | |
| printf "%s" "$PATH" | sed -e 's/:\{1,\}/\ | |
| /g' | while read pathdir | |
| do find "$pathdir" | |
| done |
Hex-escape sensitive tcl/shell characters
printf $(printf "\x26\x3b\x60\x27\x22\x7c\x2a\x3f\x7e\x3c\x3e\x5e\x28\x29\x5b\x5d\x7b\x7d\x24\x5c\n" | ./escape)
| require 'factory_girl' | |
| # Build does not go through initializer :( | |
| # class Receiver | |
| # attr_reader :calls | |
| # def initializer | |
| # @calls = [] | |
| # end | |
| # def a=(arg) | |
| # @calls << arg |
| #!/usr/bin/env ruby | |
| # Cucumber prints output with the step location, this collates those steps into a script. | |
| # It doesn't work fantastic, though -- it doesn't follow nested steps, for instance. | |
| # | |
| while line = gets | |
| next unless line =~ /(.*)\s+# (\/.*)$/ | |
| desc = $1.strip | |
| file, line = $2.strip.split(':', 2) |
| #!/bin/sh | |
| keychain=${1:~/Library/Keychains/login.keychain} | |
| security dump-keychain -d $keychain |
| # Determine the context of RSpec | |
| # | |
| # rspec context_spec.rb | |
| # | |
| # Example output: | |
| # | |
| # spec all each self | |
| # a +++++ 2245888820 4 (2245891880) | |
| # a. 2245888820 2245884460 (2245887200) |