Mystery Weapon Attacks Continuing, Even on U.S. Soil
gq.com46 pointsby jfhufl16 comments
ruby -e 'x = "a\n25\n" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
yes
Good to know. $ ruby -e 'x = "25" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
yes
$ ruby -e 'x = "25\n" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
yes
$ ruby -e 'x = "a25\n" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
no
Also, you'd want to use something that parameterizes the query with '?' (I use the Sequel gem) instead of just stuffing it into a sql string. https://en.wikipedia.org/wiki/Number_form
https://www.discovermagazine.com/health/the-rare-humans-who-see-time-and-have-amazing-memories % cat /tmp/sh
var=variables
x=$(
cat <<EOT
This string has 'single' and "double" quotes and can interpolate '$var'
EOT
)
echo $x
% bash /tmp/sh
This string has 'single' and "double" quotes and can interpolate 'variables' command | ruby -e 'ARGF.each { |line| #do stuff with line }' (long pipeline that generates lots of output) | xclip
Or even just xclip < /some/file
Now paste where necessary. cat /etc/passwd | grep root | awk -F: '{print $3}'
ruby -e 'puts File.read("/etc/passwd").lines.select { |line| line.match(/root/) }.first.split(":")[2]'
A little more verbose, but the idea is the same. https://en.wikipedia.org/wiki/Organlegging
Lovely. % echo 'one\ntwo\nthree' | sed -e 's,$, four,'
one four
two four
three four