<V1s1ble>
converting that to just a hash with web1 and vpn pointing to those lists
<V1s1ble>
Like I'm using a map to generate that first line. In Scala I know I can use flatMap or map + flatten, but flatten in Ruby doesn't seem to have the same effect
jtd has quit [Remote host closed the connection]
mim1k has joined #ruby
jtd has joined #ruby
d^sh_ has quit [Ping timeout: 248 seconds]
mvensky has quit [Quit: mvensky]
<V1s1ble>
oh nevermind .. Ruby does have a flat_map
gix- has joined #ruby
gix has quit [Disconnected by services]
<al2o3-cr>
V1s1ble: use Enumerable#inject
mim1k has quit [Ping timeout: 248 seconds]
whippythellama has joined #ruby
mniip has quit [Ping timeout: 600 seconds]
<V1s1ble>
al2o3-cr, ah..so inject is like reduce where you hand it an empty {} as the accumulator?
<ljarvis>
the bottleneck is the http request anyway, so it's probably not faster, just nicer looking
<ar1a>
maybe so, i would think the regex is slower than .include?
<ar1a>
appreciate it, im still learning ruby :)
<ljarvis>
actually the regexp is probably faster, but that doesn't mean it's better :)
jenrzzz has quit [Ping timeout: 248 seconds]
<ar1a>
fair enough. it's a chat bot anyways, it doesn't have to be idiomatic :p
jenrzzz has joined #ruby
Beams has joined #ruby
<ljarvis>
cool, but yeah, include? would be faster, but File.extname will slow it down. So I imagine if you benchmarked, "foo.jpg" =~ /.jpg/ would be slower than SUFFIXES.include?(".jpg") but much faster than SUFFIXES.include?(File.extname("foo.jpg"))
<elomatreb>
Also, your regex isn't anchored, it would accept .jpg.exe just fine
<ar1a>
oooh true
<ljarvis>
yep, you want a \z
alem0lars has joined #ruby
alem0lars has quit [Excess Flood]
<herwin>
and \. instead of .
<herwin>
and probably require something before the dot
<ljarvis>
yep, and then throw the regexp away and use File.extname
<herwin>
exactly my idea ;)
<ar1a>
\z?
<ljarvis>
yep
<ar1a>
don't you mean $?
<ljarvis>
nope
<elomatreb>
^ and $ match lines, \A and \z match the entire string
<elomatreb>
(In Ruby)
<ljarvis>
^ so using $ would match "foo.jpg\nomg hax"
mim1k has quit [Read error: Connection reset by peer]
jak_ has quit [Remote host closed the connection]
jak_ has joined #ruby
dasher00 has quit [Ping timeout: 248 seconds]
nofxx has quit [Ping timeout: 240 seconds]
dasher00 has joined #ruby
hplar has quit [Ping timeout: 268 seconds]
doublemalt_ has quit [Ping timeout: 258 seconds]
nofxx has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
mim1k has joined #ruby
antgel has quit [Ping timeout: 255 seconds]
cschneid has quit [Ping timeout: 246 seconds]
CrazyEddy has joined #ruby
sekmo has joined #ruby
cschneid has joined #ruby
s1kx has quit [Ping timeout: 260 seconds]
InfinityFye has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
theod has joined #ruby
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
antgel has joined #ruby
eizua has quit [Quit: Leaving]
charliesome has joined #ruby
patarr has joined #ruby
charliesome has quit [Ping timeout: 255 seconds]
pandaant has quit [Remote host closed the connection]
patarr has quit [Ping timeout: 248 seconds]
sekmo has quit [Read error: Connection reset by peer]
vondruch has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
doublemalt_ has joined #ruby
charliesome has joined #ruby
charliesome has quit [Client Quit]
charliesome has joined #ruby
charliesome has quit [Client Quit]
nicesignal has quit [Ping timeout: 276 seconds]
nicesignal has joined #ruby
psychicist__ has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
nicesignal has quit [Ping timeout: 240 seconds]
cschneid has quit [Ping timeout: 255 seconds]
mim1k_ is now known as mim1k
cschneid has joined #ruby
TheBloke has joined #ruby
im0nde has joined #ruby
zapata has joined #ruby
jenrzzz has joined #ruby
<rapha>
jesus christ, not only debian, now also ruby. what is it with those pesky spammers.
jenrzzz has quit [Ping timeout: 248 seconds]
Pumukel has quit [Remote host closed the connection]
quobo has joined #ruby
oskurot has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
xall has quit [Ping timeout: 268 seconds]
bkxd has joined #ruby
bkxd_ has joined #ruby
mim1k has quit [Ping timeout: 258 seconds]
nadir has quit [Quit: Connection closed for inactivity]
romankapitonov has joined #ruby
jak_ has quit [Remote host closed the connection]
jak_ has joined #ruby
workmad3 has joined #ruby
pandaant has joined #ruby
bkxd_ has quit [Ping timeout: 260 seconds]
bkxd has quit [Ping timeout: 260 seconds]
oskurot has quit [Quit: Leaving]
bkxd has joined #ruby
bkxd_ has joined #ruby
abhi56rai has joined #ruby
kke_ has quit [Changing host]
kke_ has joined #ruby
ChilledOut has joined #ruby
<ar1a>
rapha: huh?
xall has joined #ruby
<ar1a>
also what an OG name
<ChilledOut>
Hi Team..I am new to Ruby and reading this book "Learn to Program"...I am trying to understand an exercise "Integer to Roman number Converter" can someone please help me how to write this?
<ar1a>
shane hendrixson must hate you :P
harfangk has quit [Remote host closed the connection]
<ledestin>
ChilledOut the answer is 42
<ChilledOut>
ledestin how buddy..I am trying to understand the Ruby code .Wait let me post what I have found so far
<ChilledOut>
can someone explain me the logic in the def method
mim1k has joined #ruby
<canton7>
ChilledOut, which bit specifically do you have trouble with?
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
petruff has quit [Quit: WeeChat 1.9]
vifino has joined #ruby
jak_ has quit [Remote host closed the connection]
jak_ has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
<ChilledOut>
canton7 the romanize method bit mate.Thank you
<adaedra>
What part of it?
<canton7>
ChilledOut, it calls a bunch of methods. Which method don't you understand?
DaveTabo_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
belmoussaoui_ has joined #ruby
mwlang has joined #ruby
alex`` has quit [Quit: WeeChat 1.8]
<ChilledOut>
@adaedra & @canton7 = The "def romanize (num)" part ..not understanding whats happening inside that and how its able to produce Roman numbers given an Integer
alex`` has joined #ruby
<canton7>
ChilledOut, go through it line by line. Make sure you understand what each line does
<adaedra>
What did you understand of it so far?
bkxd_ has quit [Ping timeout: 268 seconds]
bkxd has quit [Ping timeout: 268 seconds]
<ChilledOut>
ROMAN_NUMS.map do |ltr, val| takes one array at a time and assigns ltr="M" and val=1000
DaveTaboola has joined #ruby
sepp2k has joined #ruby
cgfbee has quit [Remote host closed the connection]
truenito has joined #ruby
truenito has quit [Remote host closed the connection]
truenito has joined #ruby
<ChilledOut>
we passed a parameter num ,say 24.. now amt,num=24.divmod(1000) ..so amt=0 and num=24
<ChilledOut>
ltr*amt="M" * 0 =0
<adaedra>
Sure?
<ChilledOut>
not sure
<canton7>
just check what "M" * 0 is
<adaedra>
well try it in a irb, what does "M" * 0 gives you
<ChilledOut>
its nil?
chmuri has quit [Ping timeout: 240 seconds]
<ChilledOut>
like I don't get an Output
<canton7>
irb gives me "" as the output
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Ping timeout: 255 seconds]
<ChilledOut>
yup in IRB ""
<canton7>
right. What does irb show you for nil?
<canton7>
type 'nil' in irb, see what the output is
<ChilledOut>
nil itself
<canton7>
right, so irb shows 'nil' for a nil value
<canton7>
what do you think "" could be?
uZiel has quit [Ping timeout: 248 seconds]
cgfbee has joined #ruby
<ChilledOut>
"" could be empty string
<canton7>
cool. Test that theory: "".class
<ChilledOut>
haha...string ..
<canton7>
great, so "M" * 0 gives you an empty string
truenito has quit [Ping timeout: 248 seconds]
<canton7>
(what does "M" * 5 give you?)
<ChilledOut>
wow.makes sense now
<ChilledOut>
MMMMM
<ChilledOut>
string multiplication
<adaedra>
Still have problems with this method?
<ChilledOut>
canton7 and adaedra thanks guys...I will try and understand now with each iteration and get back
<adaedra>
👍
<adaedra>
Don't hesitate to test things in irb, it's here for that
<ChilledOut>
Copy that Sir!
Sembei has quit [Ping timeout: 240 seconds]
elsevero has joined #ruby
catphish has joined #ruby
chmurifree has joined #ruby
jyaworski has joined #ruby
petruff has joined #ruby
jak has joined #ruby
jak_ has quit [Read error: Connection reset by peer]
anisha has quit [Read error: Connection reset by peer]
anisha has joined #ruby
jyaworski has quit [Client Quit]
KevinMGranger has quit [Ping timeout: 240 seconds]
voltai[m] has quit [Ping timeout: 240 seconds]
el_ocho[m] has quit [Ping timeout: 255 seconds]
M107262[m] has quit [Ping timeout: 255 seconds]
aidalgol has quit [Ping timeout: 255 seconds]
Giphy[m] has quit [Ping timeout: 255 seconds]
aviraldg has quit [Ping timeout: 246 seconds]
dman[m] has quit [Ping timeout: 255 seconds]
jyaworski has joined #ruby
testnick[m] has quit [Ping timeout: 276 seconds]
johnson[m] has quit [Ping timeout: 276 seconds]
heftig has quit [Ping timeout: 258 seconds]
jonjits[m] has quit [Ping timeout: 264 seconds]
velu_aon[m] has quit [Ping timeout: 276 seconds]
kp666[m] has quit [Ping timeout: 255 seconds]
torarne has quit [Ping timeout: 255 seconds]
turt2live has quit [Ping timeout: 255 seconds]
Tagami[m] has quit [Ping timeout: 255 seconds]
intermo[m] has quit [Ping timeout: 258 seconds]
workmad3 has joined #ruby
kryptoz has joined #ruby
Sembei has joined #ruby
ddddddd has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 246 seconds]
GodFather_ has joined #ruby
oleo has joined #ruby
GodFather_ has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
chouhoulis has joined #ruby
jameser has joined #ruby
Tagami[m] has joined #ruby
chouhoulis has quit [Ping timeout: 246 seconds]
anisha has quit [Quit: This computer has gone to sleep]
mr_foto has quit []
GodFather_ has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
jak_ has joined #ruby
jak has quit [Read error: Connection reset by peer]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tagami[m] has quit [Remote host closed the connection]
JustTheDoctor has quit [Quit: Connection closed for inactivity]
jameser has joined #ruby
ujjain has quit [Ping timeout: 240 seconds]
err_ok has quit [Ping timeout: 260 seconds]
err_ok has joined #ruby
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
Tagami[m] has joined #ruby
bkxd has joined #ruby
bkxd_ has joined #ruby
workmad3 has quit [Ping timeout: 276 seconds]
mim1k has joined #ruby
oscurochu has joined #ruby
bkxd_ has quit [Ping timeout: 248 seconds]
bkxd has quit [Ping timeout: 248 seconds]
<oscurochu>
how do i get apache to execute my ruby files? i dont know where to locate my apache module for passenger. i installed it using "gem install passenger"
ta_ has quit [Remote host closed the connection]
<dminuoso>
oscurochu: passenger has grown out of style largely.
<catphish>
i believe passenger has a CLI tool that guides you through the process
tau has joined #ruby
<catphish>
but there are more popular rack servers, i'd way most people run a separate server and proxy to it, no reason *not* to use passenger though
<dminuoso>
oscurochu: Unless you really need that apache, it's probably easiest if you just use a plain and simple sinatra application.
<dminuoso>
(or ramaze if you're into that)
<dminuoso>
It avoid that big fat http server with that awkward custom compiled passenger plugin.
bweston92_ has joined #ruby
DLSteve has joined #ruby
<oscurochu>
i dont need apache i suppose, its just the only web server ive ever known.
cam27 has joined #ruby
<catphish>
oscurochu: consider puma + nginx, there are many other options though, and good tutorials
im0nde has quit [Quit: im0nde]
<dminuoso>
oscurochu: In the modern age, you usually avoid apache/nginx (and only use them for things like TLS termination, SNI, proxying) and directly use some rack application.
<catphish>
i'm assuming your app is rack compatible and you're not trying to do something unusual
<dminuoso>
oscurochu: rack like through sinatra, ramaze. puma is not exactly best suited, since it has a slightly different purpose
<oscurochu>
i have a spreadsheet that i use and it would just very useful to me to turn it into an application
<dminuoso>
(puma itself is rather used to run rack applications)
<oscurochu>
i want to possibly sell it or give it away as a web or mobile app. im really not sure where to start, so i think developing web apps with ruby is a good start, until im ready to go mobile
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
torarne has joined #ruby
johnson[m] has joined #ruby
aidalgol has joined #ruby
jonjits[m] has joined #ruby
aviraldg has joined #ruby
turt2live has joined #ruby
KevinMGranger has joined #ruby
dman[m] has joined #ruby
Giphy[m] has joined #ruby
M107262[m] has joined #ruby
intermo[m] has joined #ruby
kp666[m] has joined #ruby
voltai[m] has joined #ruby
heftig has joined #ruby
testnick[m] has joined #ruby
velu_aon[m] has joined #ruby
el_ocho[m] has joined #ruby
<oscurochu>
i eventually will need to create graphs and just perform mostly mathmetical calculations with the help of a user interface that can be accessed from multiple devices.
jameser has joined #ruby
<oscurochu>
storing the data that will be analyzed into a mysql database
<oscurochu>
sounds pretty simple, right?
<catphish>
that's what we do here :)
<catphish>
UI + math + database
jameser has quit [Ping timeout: 248 seconds]
afisher has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
jameser has joined #ruby
jphase has joined #ruby
jameser has quit [Ping timeout: 258 seconds]
Harzilein has quit [Ping timeout: 240 seconds]
chmurifree is now known as chmuri
<chmuri>
Hi there what is best ide for start in ruby?
<adaedra>
none
<adaedra>
just use a basic text editor, vim, emacs, atom, sublime text, visual studio code, notepad++, whatever
TheBloke has quit [Ping timeout: 240 seconds]
minimalism has joined #ruby
tvw has quit [Remote host closed the connection]
<dminuoso>
adaedra: but in that list there is one best, and the other ones are just for inferior developers.
Sembei has quit [Ping timeout: 240 seconds]
<dminuoso>
But at least you listed them in order of importance.
<dminuoso>
:D
<adaedra>
ssssh
<adaedra>
just use what you're used to
S007 has joined #ruby
ShekharReddy has joined #ruby
ar1a has left #ruby ["WeeChat 1.9"]
conta has quit [Quit: conta]
aupadhye has quit [Ping timeout: 260 seconds]
elsevero has quit [Quit: elsevero]
ascarter has joined #ruby
ferr has quit [Quit: WeeChat 1.8]
ascarter has quit [Ping timeout: 240 seconds]
abhi56ra1 has joined #ruby
abhi56rai has quit [Ping timeout: 258 seconds]
swills has joined #ruby
hightower2 has quit [Ping timeout: 255 seconds]
theod has quit [Quit: Lost terminal]
jphase has quit [Remote host closed the connection]
alex`` has quit [Quit: WeeChat 1.8]
alex`` has joined #ruby
aufi has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
mim1k has quit [Ping timeout: 246 seconds]
<leah2>
is there a trick to match a union of regexp, and see which one matched?
<leah2>
matching the match again could fail due to anchors etc
<apeiros>
put them into capturing groups
<apeiros>
either numbered or named
<leah2>
then i cant use numbered matches in the regexp...
mim1k has joined #ruby
<apeiros>
?
<leah2>
they dont mix afaiu
<apeiros>
too little information
<leah2>
> /(?<foo>ba(r)\1)/
<leah2>
> /(?<foo>ba(r)\1)/
<leah2>
>> /(?<foo>ba(r)\1)/
<ruby[bot]>
leah2: # => /tmp/execpad-87e5cc3fc1e0/source-87e5cc3fc1e0:2: numbered backref/call is not allowed. (use name): / ...check link for more (https://eval.in/827401)
<leah2>
the input regexp can contain backreferences
<apeiros>
ah, yes, you need to stick to one choice.
<leah2>
(whyyy)
<elomatreb>
You can have named backreferences, \k IIRC?
<apeiros>
oh well, if you have uncontrollable input, this problem will be hard
<apeiros>
that is, uncontrollable regex as input
<leah2>
the posix ere subset is good enough
mikecmpbll has joined #ruby
<leah2>
i'll match them one by one and use the leftmost matching...
<apeiros>
and "uncontrollable regex input" is relevant context btw., which you should not have left out when asking.
<leah2>
yeah, sorry
Sembei has joined #ruby
PaulCapestany has quit [Quit: .]
PaulCapestany has joined #ruby
__Yiota has joined #ruby
JustTheDoctor has joined #ruby
InfinityFye has quit [Ping timeout: 248 seconds]
skweek has quit [Ping timeout: 260 seconds]
uZiel has joined #ruby
oscurochu has quit [Quit: Leaving.]
kvant has joined #ruby
kvant has left #ruby [#ruby]
oscurochu has joined #ruby
abhi56ra1 has quit [Quit: WeeChat 1.9]
nanoz has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
abhi56rai has joined #ruby
ltem has joined #ruby
jak_ has quit [Remote host closed the connection]
mlehrer has joined #ruby
jak_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
LukyCZ has joined #ruby
<LukyCZ>
Is there a way to get Ruboto working on Nougat ?
kobain has joined #ruby
kies has quit [Ping timeout: 248 seconds]
elsevero has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
mathys has quit [Quit: Leaving]
catphish has left #ruby ["Leaving"]
baweaver is now known as baweaver_away
conta1 has joined #ruby
workmad3 has joined #ruby
BSaboia has joined #ruby
ascarter has joined #ruby
chouhoulis has joined #ruby
abhi56rai has quit [Ping timeout: 240 seconds]
ascarter has quit [Ping timeout: 260 seconds]
cadillac_ has quit [Ping timeout: 260 seconds]
cadillac_ has joined #ruby
chouhoulis has quit [Remote host closed the connection]
catphish has joined #ruby
oscurochu has quit [Quit: Leaving.]
dionysus69 has quit [Ping timeout: 240 seconds]
<catphish>
i have an event driven application and i need to do DNS lookups, i'm struggling to find an off the shelf way to do this, right now DNS lookups are hanging my app
TheBloke has joined #ruby
nanoz has quit [Quit: <3]
spastorino has joined #ruby
GodFather_ has quit [Read error: Connection reset by peer]
GodFather_ has joined #ruby
<catphish>
all the solutions are associated with existing frameworks, i'm sure i can put something together
mwlang has quit [Quit: mwlang]
mwlang has joined #ruby
ledestin has joined #ruby
perniciouscaffei has joined #ruby
tau has quit [Remote host closed the connection]
tau has joined #ruby
jak has joined #ruby
jak_ has quit [Ping timeout: 255 seconds]
chouhoulis has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
theRealGent has joined #ruby
<theRealGent>
Hello. Does anyone know why writing to an array with FFI and then reading it returns different results for the first element? https://pastebin.com/vXPKdp3e
mark_66 has quit [Remote host closed the connection]
kryptoz has quit [Remote host closed the connection]
ascarter has joined #ruby
hutch34 has quit [Ping timeout: 255 seconds]
muelleme_ has joined #ruby
rgiscard has quit [Quit: Gone fishing]
elsevero has quit [Quit: elsevero]
alex`` has quit [Quit: WeeChat 1.8]
ascarter has quit [Ping timeout: 240 seconds]
Beams has quit [Quit: .]
solocshaw has joined #ruby
kies has joined #ruby
doublemalt_ has quit [Ping timeout: 248 seconds]
Rodya_ has quit [Remote host closed the connection]
__g_k__1_w_m__s_ has joined #ruby
kies has quit [Ping timeout: 240 seconds]
__g_k__1_w_m__s_ has left #ruby [#ruby]
Rodya_ has joined #ruby
arup_r has quit [Remote host closed the connection]
chouhoulis has quit [Ping timeout: 260 seconds]
ta_ has joined #ruby
sylario has joined #ruby
__g_k__1_w_m__s_ has joined #ruby
__g_k__1_w_m__s_ has quit [K-Lined]
ketan has quit [Remote host closed the connection]
ketan has joined #ruby
chouhoulis has joined #ruby
belmoussaoui_ has quit [Ping timeout: 258 seconds]
ta_ has quit [Ping timeout: 248 seconds]
t-recx has joined #ruby
Rodya_ has quit [Remote host closed the connection]
nowhere_man has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
andikr has quit [Remote host closed the connection]
duderonomy has joined #ruby
julian has quit [Ping timeout: 276 seconds]
CrazyEddy has quit [Remote host closed the connection]
ddddddd has quit [Ping timeout: 255 seconds]
Cohedrin_ has joined #ruby
jak has quit [Remote host closed the connection]
jak has joined #ruby
gothicsouth has joined #ruby
uZiel has quit [Remote host closed the connection]
alamar has joined #ruby
alamar is now known as Guest37281
dionysus69 has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShekharReddy has quit [Quit: Connection closed for inactivity]
vuoto has quit [Quit: Lost terminal]
ketan has quit [Ping timeout: 268 seconds]
mathys has joined #ruby
uZiel has joined #ruby
pankaj has joined #ruby
<pankaj>
t-chat
romankapitonov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AckZ has left #ruby [#ruby]
LukyCZ has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
t-recx has quit [Read error: Connection reset by peer]
t-recx has joined #ruby
petruff1 has joined #ruby
xzhao has quit [Remote host closed the connection]
Joufflu has quit [Read error: Connection reset by peer]
petruff has quit [Ping timeout: 246 seconds]
xzhao has joined #ruby
Joufflu has joined #ruby
SeepingN has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
antgel has quit [Ping timeout: 255 seconds]
uZiel has quit [Remote host closed the connection]
SeepingN has quit [Client Quit]
mathys has quit [Quit: Leaving]
cam27 has joined #ruby
jaruga has quit [Quit: jaruga]
__Yiota has joined #ruby
GodFather_ has quit [Ping timeout: 260 seconds]
uZiel has joined #ruby
oscurochu has joined #ruby
sagax has joined #ruby
oscurochu has quit [Client Quit]
petruff1 has quit [Quit: WeeChat 1.9]
ta_ has joined #ruby
shinnya has quit [Ping timeout: 240 seconds]
theRealGent has quit [Ping timeout: 246 seconds]
muelleme_ has quit [Ping timeout: 240 seconds]
solocshaw has quit [Ping timeout: 258 seconds]
muelleme_ has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
blackwind_123 has joined #ruby
pankaj has quit [Ping timeout: 240 seconds]
pankaj has joined #ruby
nOwz has quit [Quit: WeeChat 1.7]
raul782 has joined #ruby
jenrzzz has joined #ruby
romankapitonov has joined #ruby
uZiel_ has joined #ruby
dionysus69 has quit [Remote host closed the connection]
xMopxShell has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
belmoussaoui has joined #ruby
ChilledOut has quit [Ping timeout: 260 seconds]
romankapitonov has quit [Read error: Connection reset by peer]
npgm has joined #ruby
snowda has joined #ruby
ascarter has joined #ruby
<snowda>
does ruby provides any string escape when accessing bash? I mean variable = "ABC", so puts `echo "#{variable}"`
romankapitonov has joined #ruby
<snowda>
is it possible to inject a rm -rf /?
kobain has quit [Ping timeout: 255 seconds]
nofxx has quit [Remote host closed the connection]
guardian has quit [Remote host closed the connection]
ascarter has quit [Ping timeout: 260 seconds]
<jordanm>
snowda: yes, if "variable" is built using external data, but you are not executing it in your example
andrzejku has joined #ruby
xMopxShell has quit [Ping timeout: 240 seconds]
pankaj has quit [Ping timeout: 260 seconds]
elsevero has joined #ruby
<jordanm>
you can also use popen to execute external commands without a shell
uZiel_ has quit [Quit: leaving]
<havenwood>
snowda: Your example will print: rm -rf /
<havenwood>
oh
<havenwood>
snowda: You can use Shellwords.escape
sepp2k has quit [Ping timeout: 268 seconds]
<havenwood>
snowda: If your payload was "`rm -rf /`" or "$(rm -rf /)" it'd be a problem
<havenwood>
snowda: But it's a problem that Shellwords.escape fixes.
<manveru>
snowda: use system instead
<jordanm>
I am pretty sure system() still uses a shell
<havenwood>
jordanm: It can, or not.
<jordanm>
IO.popen does not
<jordanm>
ah, right I see the no-shell syntax in the docs
<manveru>
popen i'd use if i care about the output
<jordanm>
bit odd since the libc function system() you would expect it uses is always shell
<manveru>
but system is perfectly safe for stuff you don't :)
<manveru>
(just make sure you pass as separate arguments, not a long string)
raul782 has quit [Remote host closed the connection]
jenrzzz has joined #ruby
<snowda>
thank you all
pankaj has joined #ruby
<snowda>
I'll go with shellwords
theRealGent has joined #ruby
meshsmith has quit [Remote host closed the connection]
oscurochu has joined #ruby
antgel has joined #ruby
oscurochu has quit [Client Quit]
podlech has joined #ruby
guardian has joined #ruby
podlech has quit [Quit: WeeChat 1.7.1]
podlech has joined #ruby
Joufflu has quit [Ping timeout: 248 seconds]
jak has quit [Remote host closed the connection]
jak has joined #ruby
oscurochu has joined #ruby
ketan has joined #ruby
alex`` has joined #ruby
xrlk has joined #ruby
naprimer3 has joined #ruby
naprimer2 has quit [Ping timeout: 248 seconds]
ketan has quit [Ping timeout: 268 seconds]
snowda has quit [Quit: Page closed]
Ka has quit [Quit: ZNC 1.7.x-git-775-96c92ef8 - https://znc.in]
N0ATN has joined #ruby
antgel has quit [Ping timeout: 260 seconds]
nahra has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
podlech has quit [Ping timeout: 248 seconds]
mtkd has quit [Ping timeout: 255 seconds]
mtkd has joined #ruby
lxsameer has quit [Quit: WeeChat 1.7]
freeman42 has joined #ruby
nahra has quit [Remote host closed the connection]
<freeman42>
is there a function that takes another function from string to string and pipes input/output through it?
kobain has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
SCHAPiE has quit [Read error: Connection reset by peer]
nahra has joined #ruby
knight33 has joined #ruby
sepp2k has joined #ruby
<Papierkorb>
freeman42: What are you trying to do?
<Papierkorb>
freeman42: And, what have you tried yet?
theRealGent has quit [Ping timeout: 258 seconds]
montanonic has joined #ruby
<freeman42>
trying to find a Ruby standard function that does the following: "The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device."
<freeman42>
what I tried? google-ing for it :p
SCHAPiE has joined #ruby
<Papierkorb>
What do you need? Really, the moment you read the string from anywhere, it's a string you can do things with you like, and then later print out again. Nothing special needed.
<adam12>
IO.copy_stream maybe? but it would be nice to know what your doing, and if this is homework.
<Papierkorb>
It sure sounds like homework :)
<freeman42>
it is not homework, but here it sure smells like... attitude, bad attitude
kculpic has joined #ruby
<adam12>
freeman42: Let's not forget you came here. We didn't seek you out.
<freeman42>
I asked a very clear question, and people are asking "is it homework" and "what are you trying to accomplish", I just said what I am trying to accomplish
<freeman42>
adam12, that is not excuse for being rude to newcomers
<adam12>
freeman42: If you can't handle a) people wanting to suggest the best solution for you and b) people not wanting to give away homework answers, but rather help you come up with the solution
<adam12>
I think you'll need to change your tune.
<freeman42>
adam12, this is not a "think through it type of question", it was a simple, is there a function that does that question? yes or no
<Papierkorb>
freeman42: It would be rude to give bad suggestions. Your question is not really clear, and thus required clarifications from our end.
<adam12>
freeman42: I gave you the method you wanted. Enjoy.
<freeman42>
Papierkorb, what was unclear about this? "The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device."
muelleme_ has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
<freeman42>
adam12, might be mistaken, but IO.copy_stream does not seem to take a string to string function as argument
umaaji has joined #ruby
dcunit3d has quit [Ping timeout: 260 seconds]
umaaji has quit [Client Quit]
shinnya has joined #ruby
dasher00 has quit [Ping timeout: 258 seconds]
konsolebox has quit [Ping timeout: 248 seconds]
ddddddd has joined #ruby
patteh has quit [Remote host closed the connection]
<zenspider>
freeman42: try not to be a dick. people here are trying to help... but we won't help you cheat on homework and we WILL ask questions for context.
skweek has quit [Ping timeout: 258 seconds]
jak has quit [Remote host closed the connection]
<zenspider>
looks like that's a haskell function and is awkward at best in ruby
InfinityFye has joined #ruby
biox has quit [Quit: brb servers are ded]
<freeman42>
what do you mean by: `awkward at best in ruby`? either it exists or not in base libraries
<zenspider>
freeman42: intentional or not, you are coming off as a complete jackass
<zenspider>
strike 2
knight33 has joined #ruby
<zenspider>
could it occur to you that OO and lazy functional are completely different beasts and that some ideas don't translate cleanly?
biox has joined #ruby
<zenspider>
"string to string function" doesn't really translate in ruby. Ruby is OO. So it'd be a "nothing to string" method in the first place (the receiver of the message is the "input" string)
<bougyman>
there are plenty of high-order FP type methods and methodologies possible in ruby
<bougyman>
I just don't think he's expressing his need well.
<bougyman>
what the fuck do you want this method to do?
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bougyman>
^
<zenspider>
but map doen't take a function... the function isn't string->string... etc... but this whole "just give me a yes/no" attitude needs to stop now
nadir has quit [Quit: Connection closed for inactivity]
sepp2k has quit [Read error: Connection reset by peer]
<zenspider>
which quotes haskell doco
<zenspider>
I don't know haskell's type signatures enough... but "-> IO ()" says outputs an IO to me, but the doco says "the resulting string is output on the standard output device"
<zenspider>
that seems wrong? maybe it is the '()' part?
<bougyman>
that should need a monad, shouldn't it?