jfhufl
Joined 9 years ago
Karma
70
Submissions
24
Member since
Sep 20
Joined 9 years ago
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-...
http://www.cs.cmu.edu/afs/.cs.cmu.edu/help/content/unix_linu...
Consolidating everything you want into /usr/local (exclude packages you don't want). I used to use this at my old job before package managers were ubiquitous.
https://en.wikipedia.org/wiki/Number_form
https://www.discovermagazine.com/health/the-rare-humans-who-see-time-and-have-amazing-memoriesJust because there are attacks or ways around a particular defense doesn't mean it's worthless, that's why we have defense in depth.
% 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.