havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
<poro_> and the program breaks
<leftylink> then perhaps the approach to solving this problem must not involve putting that many integers into an array
<leftylink> some other tack is called for
<havenwood> poro_: That's a big number, so best to operate "lazily."
<havenwood> poro_: As an incremental improvement, I'd next swap out the while statement and instead enumerate an enumerator or range.
<havenwood> (2..600851475145) do |i|
<havenwood> 2.upto(600851475145) do |i|
<havenwood> poro_: Either of those ^ are nice. The former is a little "lighter weight" and the latter reads nicely to me.
<havenwood> poro_: With those ^, I'd think you'd push once before iterating, but the rest of the code could stay the same.
<havenwood> poro_: In any case, go for #each, #map, and friends frequently.
<havenwood> poro_: #map more than #each, #each more than while.
<poro_> yea Im gonna read up on those, Im thinking that even with my current code, if I were to wait for the array to fully populate then the program would also break because of how big it is
<poro_> so is best to solve the problem without having a huge array
<havenwood> poro_: Agreed.
braj has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
inradius has quit [Read error: Connection reset by peer]
wnd-trans has joined #ruby
wnd has quit [Quit: Disconnecting from stoned server.]
hsiktas[m] has quit [Ping timeout: 246 seconds]
robotmay has quit [Ping timeout: 272 seconds]
gueorgui has quit [Ping timeout: 272 seconds]
DarthGandalf has quit [Ping timeout: 265 seconds]
donofrio_ has quit [Remote host closed the connection]
DarthGandalf has joined #ruby
braj has quit []
donofrio_ has joined #ruby
gueorgui has joined #ruby
robotmay has joined #ruby
hsiktas[m] has joined #ruby
troulouliou_div2 has quit [Ping timeout: 272 seconds]
wnd-trans is now known as wnd
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Client Quit]
braj has joined #ruby
troulouliou_div2 has joined #ruby
fratis has joined #ruby
fratis has quit [Remote host closed the connection]
chalkmonster has quit [Quit: WeeChat 2.8]
DaRock has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
bruce_lee has quit [Ping timeout: 258 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
xco has joined #ruby
fratis has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
fratis has quit [Remote host closed the connection]
fratis has joined #ruby
butcher has joined #ruby
butcher has quit [Max SendQ exceeded]
butcher has joined #ruby
butcher has quit [Max SendQ exceeded]
butcher has joined #ruby
butcher has quit [Max SendQ exceeded]
fratis has quit [Ping timeout: 258 seconds]
butcher has joined #ruby
butcher has quit [Max SendQ exceeded]
butcher has joined #ruby
poro_ has quit [Ping timeout: 260 seconds]
xco has joined #ruby
ur5us has joined #ruby
jinmiaoluo has joined #ruby
ChmEarl has quit [Quit: Leaving]
bhaak has quit [Ping timeout: 258 seconds]
jetchisel has joined #ruby
prestorium has quit [Ping timeout: 265 seconds]
prestorium has joined #ruby
evdubs has quit [Quit: Leaving]
evdubs has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
ur5us has quit [Ping timeout: 260 seconds]
tau has quit [Ping timeout: 272 seconds]
fratis has joined #ruby
fratis has quit [Remote host closed the connection]
jinmiaoluo has quit [Ping timeout: 246 seconds]
prestorium has quit [Ping timeout: 256 seconds]
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
jinmiaoluo has joined #ruby
bsdbandit-01 has joined #ruby
prestorium has joined #ruby
jetchisel has quit [Ping timeout: 264 seconds]
cahoots_ has quit [Quit: leaving]
jetchisel has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
fratis has joined #ruby
fratis has quit [Remote host closed the connection]
prestorium has quit [Ping timeout: 272 seconds]
donofrio__ has joined #ruby
fratis has joined #ruby
donofrio_ has quit [Ping timeout: 265 seconds]
alexherbo2 has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
fratis has quit [Read error: Connection reset by peer]
troulouliou_div2 has joined #ruby
prestorium has joined #ruby
comet23 has joined #ruby
braj has quit []
jetchisel has quit [Ping timeout: 265 seconds]
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
troulouliou_div2 has quit [Quit: Leaving]
bsdbandit-01 has joined #ruby
jmcgnh has quit [Quit: ZNC 1.7.5 - https://znc.in]
jmcgnh has joined #ruby
BTRE has quit [Ping timeout: 256 seconds]
BTRE has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
prestorium has quit [Ping timeout: 272 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
prestorium has joined #ruby
jinmiaoluo has quit [Ping timeout: 272 seconds]
orbyt_ has joined #ruby
BTRE has quit [Ping timeout: 240 seconds]
BTRE has joined #ruby
bhaak has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jinmiaoluo has joined #ruby
jinmiaoluo has quit [Ping timeout: 256 seconds]
jinmiaoluo has joined #ruby
<phaul>
ldepandis has joined #ruby
conta has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
lesha has quit [Ping timeout: 256 seconds]
conta has quit [Remote host closed the connection]
conta has joined #ruby
imode has quit [Ping timeout: 258 seconds]
gix- has quit [Ping timeout: 246 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
schne1der has joined #ruby
aces1up has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<aces1up> so I have an array with different elements.. I want to create another array from original array, but replicate is so something like 5.times do |x| new_arr << orig_array[x]] end but if the orig array is smaller than the number of elements I want in new array old array should loop back around to beginning and start adding again to new array..
<aces1up> hope that makes sense.
<aces1up> any ideas?
<leftylink> great well
<leftylink> &ri Array#*
<leftylink> to have a general idea of what's available in Array and Enumerable will add many useful tools to one's toolbox
<aces1up> what enumerable method would I use to do this?
<leftylink> one who knows Enumerable would also observe that Enumerable#cycle is possible for this job, but it may have to be paired with an Enumerable#take depending on the circumstances
<leftylink> .... OH WHAT, TIL
<leftylink> Enumerable#cycle takes an integer argument????????????????????????
<leftylink> holy crap
<leftylink> I didn't know this
<leftylink> excuse me, got too emotional there
<aces1up> thanks will check it out
alexherbo2 has joined #ruby
<aces1up> i think cycle will work with a break after I get the number of elements i need.
bsdband64 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 265 seconds]
aces1up has quit [Remote host closed the connection]
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
evert has quit [Quit: ZNC - https://znc.in]
clemens3 has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Ping timeout: 240 seconds]
jinmiaoluo has quit [Ping timeout: 260 seconds]
jinmiaoluo has joined #ruby
tens0r has joined #ruby
conta has quit [Quit: conta]
tens0r has quit [Quit: tens0r]
evert has joined #ruby
jinmiaoluo has quit [Ping timeout: 246 seconds]
jinmiaol1 has joined #ruby
jinmiaol1 has quit [Ping timeout: 246 seconds]
jinmiaol1 has joined #ruby
comet23 has quit [Quit: Connection closed for inactivity]
jinmiaoluo has joined #ruby
jinmiaol1 has quit [Ping timeout: 272 seconds]
giorgian` has joined #ruby
giorgian has quit [Ping timeout: 260 seconds]
ellcs1 has joined #ruby
jinmiaoluo has quit [Ping timeout: 264 seconds]
jinmiaoluo has joined #ruby
sysh has joined #ruby
butcher has quit [Quit: Leaving]
ruby[bot] has joined #ruby
conta has joined #ruby
cloaked1 has quit [Ping timeout: 260 seconds]
cloaked1 has joined #ruby
cloaked1 has quit [Changing host]
cloaked1 has joined #ruby
jinmiaoluo has quit [Quit: WeeChat 2.8]
conta1 has joined #ruby
conta has quit [Ping timeout: 264 seconds]
conta1 is now known as conta
evert has quit [Remote host closed the connection]
evert has joined #ruby
cnsvc_ has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
akem_ is now known as akem
duderonomy has joined #ruby
conta has quit [Quit: conta]
drincruz has joined #ruby
ghormoon has quit [Quit: ZNC - http://znc.in]
ghormoon has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
cnsvc_ has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
cnsvc_ has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
chalkmonster has joined #ruby
fratis has joined #ruby
r3m is now known as Pascal
Pascal is now known as r3m
hiroaki has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
TCZ has joined #ruby
lesha has joined #ruby
xylophone has joined #ruby
TCZ has quit [Client Quit]
bsdbandit-01 has joined #ruby
bsdband64 has quit [Ping timeout: 272 seconds]
conta has joined #ruby
TCZ has joined #ruby
TCZ has quit [Quit: Leaving]
TCZ has joined #ruby
znz_jp has quit [Remote host closed the connection]
TCZ is now known as DoomSlayer2020
znz_jp has joined #ruby
drincruz has joined #ruby
poro has joined #ruby
miskatonic has joined #ruby
<nemesit|znc> anyone know how to catch (undefined method `class_name' for nil:NilClass) when calling .klass on a reflection from reflect_on_all_associations
<nemesit|znc> ?
<nemesit|znc> I tried almost everything but it seems the error doesn't care about begin rescue or anything
burningserenity has joined #ruby
<sagax> hi all!
<sagax> Enumerator can some events? like as .when_enum_reach_end do {something}
<sagax> ?
<pwnd_nsfw`> sagax, just.... run code right after you've finishe dlooping?
<sagax> i don't know when it finished
<pwnd_nsfw`> It does though
<pwnd_nsfw`> loop {}
<pwnd_nsfw`> some_code_after
<sagax> can't, because i send enumerator from IO.popen (IO.popen(cmd).each) as http response body
<sagax> and i must close IO when enumerator reach eof
<pwnd_nsfw`> Does it close at the end of it's block?
<pwnd_nsfw`> If a block is given, Ruby will run the command as a child connected to Ruby with a pipe. Ruby's end of the pipe will be passed as a parameter to the block. At the end of block, Ruby closes the pipe and sets $?. In this case IO.popen returns the value of the block.
<pwnd_nsfw`> There's even an eof method
poro_ has joined #ruby
<adam12> Anybody seen any projects that co-locate test files beside source files and _not_ inside (spec|test)? Only one I can think of is Que but I'm sure there are others out there.
poro has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #ruby
Besnik_b has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
<nemesit|znc> nobody an idea?
<nemesit|znc> why does begin rescue not work?
troulouliou_div2 has joined #ruby
conta has quit [Remote host closed the connection]
ChmEarl has joined #ruby
fratis has quit [Remote host closed the connection]
apotheon is now known as ElderMalaclypse
DaRock has quit [Ping timeout: 272 seconds]
fratis has joined #ruby
prestorium has quit [Remote host closed the connection]
prestorium has joined #ruby
prestorium has quit [Read error: Connection reset by peer]
prestorium has joined #ruby
miskatonic has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
Mawile has quit [Read error: Connection reset by peer]
rippa has joined #ruby
Mawile has joined #ruby
stdedos has joined #ruby
charon77 has joined #ruby
<adam12> nemesit|znc: Are you passing an argument to rescue?
<ElderMalaclypse> Taken out of context, that's a weird question.
conta has joined #ruby
ElderMalaclypse is now known as LaoMalaclypse
<adam12> nemesit|znc: NoMethodError inherits from NameError which inherits from StandardError. A naked rescue should be fine. If it's not, then can you show your begin/rescue block and the full backtrace, in a Github Gist.
<adam12> &>> begin; nil.bar; rescue; "rescued"; end
<rubydoc> # => "rescued" (https://carc.in/#/r/95vu)
<nemesit|znc> I thought I could just use klass and then .primary_key to get the info I need from the association reflection
<nemesit|znc> AvailGroupEntity.reflect_on_all_associations[3].klass
<nemesit|znc> but for broken associations I get lots of weird errors
burningserenity has quit [Remote host closed the connection]
charon77 has quit [Quit: WeeChat 2.8]
<nemesit|znc> and begin rescue around it doesn't help
burningserenity has joined #ruby
charon77 has joined #ruby
<adam12> nemesit|znc: Put a backtrace in a gist so we can see.
charon77 has quit [Client Quit]
<nemesit|znc> if I would get a backtrace I'd see too ;-p I get two lines at most
<nemesit|znc> or undefined klass for nil
troulouliou_div2 has quit [Ping timeout: 246 seconds]
DoomSlayer2020 has quit [Quit: Leaving]
<adam12> nemesit|znc: And the code you're using?
<adam12> nemesit|znc: Not much to go on here. You should be able to rescue NoMethodError without issue.
burningserenity has quit [Quit: Leaving.]
conta has quit [Quit: conta]
troulouliou_div2 has joined #ruby
<nemesit|znc> found association_primary_key which seems to work way better for this anyway
envex has joined #ruby
howdoi has joined #ruby
lesha has quit [Ping timeout: 265 seconds]
fratis has quit []
zapata has quit [Read error: Connection reset by peer]
xylophone has quit [Ping timeout: 246 seconds]
zapata has joined #ruby
xylophone has joined #ruby
orbyt_ has joined #ruby
ellcs1 has joined #ruby
Emmanuel_ChanelW has joined #ruby
vqrs has quit [Ping timeout: 272 seconds]
vqrs has joined #ruby
gix has joined #ruby
wogi has joined #ruby
burningserenity has joined #ruby
burningserenity has quit [Client Quit]
AndreYuhai has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has quit [Ping timeout: 264 seconds]
wogi has quit [Quit: Leaving]
cnsvc_ has joined #ruby
<AndreYuhai> Hey there, I am using Google Cloud Vision API. I've already set GOOGLE_APPLICATION_CREDENTIALS environment variable to my private key file path. When I try to do text detection from within irb everything works fine but when I try the same thing in RubyMine I get this: https://dpaste.org/bqjr#L9 couldn't load credentials runtime error.
<AndreYuhai> Don't know why it works in irb but not in RubyMine.
<havenwood> AndreYuhai: Does it work if you launch RubyMine from the terminal?
<AndreYuhai> havenwood, let me check
lesha has joined #ruby
ho0po3 has joined #ruby
<AndreYuhai> havenwood, yes, it works when I launch it from the terminal.
<havenwood> AndreYuhai: I suspect a requisite environment variable set in your terminal dotfiles is not set in RubyMine.
<havenwood> AndreYuhai: Or launch RubyMine from the terminal. ;)
<AndreYuhai> havenwood, is there any chance I could find that? :D
<havenwood> AndreYuhai: Use the scientific method with quick iterations to test your hypotheses.
<havenwood> AndreYuhai: Can you make it break when launched from the terminal by unsetting environment variables?
<AndreYuhai> havenwood, you mean unset all of them?
<havenwood> AndreYuhai: For example, `unset RUBY_HOME` then launch RubyMine from the terminal and test if it works.
<havenwood> AndreYuhai: To see the list of possible culprits: printenv
<AndreYuhai> havenwood, oh sure I can do that. Do I need to restart my terminal or something after I unset a variable?
<havenwood> printenv | cut -d"=" -f1
<havenwood> AndreYuhai: Nope
<havenwood> AndreYuhai: Once unset, it's unset.
<havenwood> AndreYuhai: See, for example: export FOO=bar; unset FOO
<havenwood> It's no longer exported.
<havenwood> You can likewise unset a function with: unset -f
<havenwood> Or an alias with: unalias
<havenwood> It's important to know how to tear things down.
<LaoMalaclypse> "unset" depends on your shell
<havenwood> LaoMalaclypse: Good point, as it's typically a shell builtin.
<AndreYuhai> alright, I just 80 environment variables when I did printenv. Gotta start from somewhere hahaha.
<havenwood> I'm speaking only for bash and zsh.
<havenwood> LaoMalaclypse: Is it not POSIX though?
<LaoMalaclypse> Consider csh.
<LaoMalaclypse> I don't recall whether csh has unset.
<LaoMalaclypse> There are some weird shells floating around out there, too.
<havenwood> LaoMalaclypse: It does.
<havenwood> LaoMalaclypse: (Since I think it's POSIX.)
<LaoMalaclypse> It's not, strictly, as far as I'm aware, but maybe I'm mistaken.
<LaoMalaclypse> Of course, to the extent it's not strictly POSIX-compliant, it's probably not much worse than Bash.
<leah2> wtf
<leah2> csh has nothing to do with posix sh
<LaoMalaclypse> Hell, I seem to recall even dash had a POSIX issue or two.
<LaoMalaclypse> I think to be POSIX compliant it might need the ksh-style assignment syntax.
<LaoMalaclypse> csh differs in that regard
<havenwood> LaoMalaclypse: ksh has unset as well, just adds a -n flag
<havenwood> -fv is standard
<havenwood> with -v as default
<LaoMalaclypse> I seem to recall that POSIX sh was derived from ksh by eliminating much of ksh, such that strict Bourne isn't compliant but strct ksh should be. Nobody uses strict ksh any longer, though, as far as I'm aware.
<havenwood> unset isn't universally portable but it's widely supported and there is no better way I could possibly suggest. ¯\_(ツ)_/¯
<LaoMalaclypse> Maybe someone has a vintage AT&T ksh runnnig in production.
<LaoMalaclypse> havenwood: true
lesha has quit [Ping timeout: 246 seconds]
<LaoMalaclypse> Something like "FOO=" in some shells might be equivalent to "FOO=''" instead of equivalent to "unset FOO".
sauvin has quit [Read error: Connection reset by peer]
<LaoMalaclypse> I guess all I meant by questioning it is "Hey, AndreYuhai -- are you using Bash or Zsh, or something else?"
<LaoMalaclypse> most likely Bash or Zsh, though
<AndreYuhai> LaoMalaclypse, yes it's bash :)
<LaoMalaclypse> I'm sorry.
LaoMalaclypse is now known as apotheon
<havenwood> LaoMalaclypse: Fish and Nu don't support `uset`.
<apotheon> Aha!
<apotheon> Fish. That's the one.
<havenwood> It looks like zsh, bash, csh, ksh, dash, sh, and so on do.
<apotheon> I loathe Fish.
<apotheon> I suppose you could get the equivalent of unset by using the browser config interface for Fish, or something equally insane.
<apotheon> What's this "Nu" of which you speak?
<leah2> pretty sure csh uses unsetenv
<apotheon> Is it as bad as Fish?
<apotheon> leah2: Oh, yeah, I knew there was something screwy.
<apotheon> (with csh unset)
<leah2> fish uses set -e variable
<leah2> very smart choice >.>
<apotheon> . . . so csh unset should work for "regular" variables, but not environment variables.
<apotheon> leah2: seems fishy to me
<apotheon> That whole shell stinks.
Emmanuel_ChanelW has quit [Quit: Leaving]
<apotheon> I had a boss who unironically preferred Fish until I got laid off in 2016.
<apotheon> I'd rather use scsh or Ypsilon as my shell.
Emmanuel_ChanelW has joined #ruby
aspiers has quit [Ping timeout: 272 seconds]
<havenwood> apotheon: I just dabbled in Fish long enough to fix the chruby-fish tool for Fish users. https://github.com/JeanMertz/chruby-fish/commit/e2b7661b3ab0a37fc7ae250ef293e282df6ab271
<apotheon> exciting
<havenwood> Then I fled back to zsh.
<apotheon> good plan
<havenwood> Nu looks fun but I just can't be bothered yet.
stdedos has quit [Quit: Connection closed]
<havenwood> Things Yehuda works on tend to be nice.
<apotheon> hmm
<apotheon> The Nu features "beautiful tables", "fun with data", and "structured data" seem like they should've been pipeline utilities.
renich has joined #ruby
orbyt_ has joined #ruby
BananaDisco has joined #ruby
<apotheon> It might be nifty, though, I suppose.
<phaul> anybody remembers what that shell thing was that tried to be more interactive like output of ls became clickable entries that get you in the directory etc. I think it was in ruby. But I can't remember the name..
fuDwitc has quit []
<phaul> At the time I thought it was interesting, but I guess the project died
<adam12> Anybody seen any projects that co-locate test files beside source files and _not_ inside (spec|test)? Only one I can think of is Que but I'm sure there are others out there.
renich_ has joined #ruby
envex has quit []
renich has quit [Ping timeout: 256 seconds]
ruby-lang715 has joined #ruby
renich_ is now known as renich
<ruby-lang715> i need a datetime obj to print the weekday in german ... @dt.strftime('%a')
fuDwitc has joined #ruby
<ruby-lang715> how can i set the locale ( in plain ruby)
lucasb has joined #ruby
ldepandis has quit [Ping timeout: 256 seconds]
fuDwitc has quit [Quit: suckah....]
fuDwitc has joined #ruby
fuDwitc has quit [Client Quit]
fuDwitc has joined #ruby
<jhass> phaul: I totally remember what you mean, but no name :D
cd has quit [Quit: cd]
vondruch_ has joined #ruby
<jhass> phaul: ha, found it https://xiki.org/
<jhass> looks like it got a different focus now though
cnsvc_ has quit [Ping timeout: 240 seconds]
vondruch has quit [Ping timeout: 265 seconds]
vondruch_ is now known as vondruch
envex has joined #ruby
imode has joined #ruby
<phaul> yeah, that was it
<jhass> I think my problem with this kind of stuff is that it's too unspecific, too general. I don't have any "problem -> xiki" association, like I have for example "count lines -> wc -l", search something -> "grep, ag, find" etc
<jhass> so I end up never using it thus never learning it
lesha has joined #ruby
fuDwitc_ has joined #ruby
renich has quit [Remote host closed the connection]
<phaul> same here. This new nu shell reminded me of this, but it could be totally different. I spend very little time at the shell anyways, 99% of my time is in the editor.
renich has joined #ruby
fuDwitc has quit [Ping timeout: 256 seconds]
<jhass> which might make the new editor focus of xiki to actually be a smart move
Xiti has quit [Ping timeout: 246 seconds]
sysh has quit [Remote host closed the connection]
Emmanuel_ChanelW has quit [Quit: Leaving]
fuDwitc_ has quit [Remote host closed the connection]
fuDwitc has joined #ruby
shansen has quit [Remote host closed the connection]
shansen has joined #ruby
fuDwitc_ has joined #ruby
fuDwitc_ has quit [Remote host closed the connection]
fuDwitc has quit [Ping timeout: 240 seconds]
fuDwitc_ has joined #ruby
Xiti has joined #ruby
TCZ has joined #ruby
fuDwitc_ has quit [Ping timeout: 256 seconds]
alexherbo2 has quit [Ping timeout: 256 seconds]
xco has joined #ruby
<xco> trying to scrape content using Ruby, the content is behind an Authy authentication, what will be the best way to validate credentials to go past the 2fa?
<xco> in other words, how can i programatically get an auth 2fa code that i can use with 'mechanize' gem to bypass 2fa? :)
<jhass> 2fa is a general term, there's many implementations such as E-Mail, Telephony, TOTP, U2F, WebAuthn
pwnd_nsfw` has quit [Quit: Leaving]
pwnd_nsfw has joined #ruby
<xco> jhass yeah right. thought i mentioned it's an OTP code from Authy
<jhass> OTP is again general and there's more than one implementation. I guess TOTP. The algorithm is public, I'm sure you can find a ruby implementation
<xco> jhass thank you. i understand they are implementations. problem i'm trying to overcome here is for a given web app, i have tokens for it on my Authy app, which is on my mobile phone. is there a way to programmatically get the tokens (codes) on my phone that i can pass to Mechanize to by pass the 2fa part of the web app?
<jhass> TOTP's only input is a key, extract it from your phone (or the QR code before scanning it into your phone if the service doesn't give you a textual version), use it as input to a ruby implementation
<xco> jhass there's no qr code. in the web app i just entered my gmail and got the entry in my auth mobile app, plus even if there were a qr code the token changes periodically
<jhass> so it's not TOTP but a propriarity implementation?
<jhass> if my guess it's TOTP was wrong, of course that doesn't apply
<jhass> I guess you may reverse engineer the API the mobile is using
<xco> jhass if my understand is correct Authy is a TOTP mobile app
ellcs1 has quit [Ping timeout: 260 seconds]
<xco> in that case, yes
<jhass> as you described it's not
<jhass> TOTP is a specifc implementation of OTP style 2FA: https://tools.ietf.org/html/rfc6238
ruby-lang715 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<xco> jhass to be honest i don't know the implementation details here but this is what i'm taking about https://authy.com/
ruby-lang715 has joined #ruby
<xco> i have it as a mobile app. which provides codes for me to login to some webapp. i'm looking for ways to authenticate a ruby script to bypass the level to scrape content
fuDwitc has joined #ruby
fuDwitc has quit [Ping timeout: 246 seconds]
nopc0de has joined #ruby
fuDwitc has joined #ruby
schne1der has quit [Ping timeout: 246 seconds]
ur5us has joined #ruby
fuDwitc has quit [Ping timeout: 264 seconds]
ldepandis has joined #ruby
TCZ is now known as DoomSlayer2020
cliluw has quit [Ping timeout: 264 seconds]
<jhass> phaul: mmh, xiki made me remember https://github.com/JoshCheek/seeing_is_believing
<jhass> xco: nobody's gonna reverse engineer that for you, sorry :)
ruby[bot] has quit [Ping timeout: 272 seconds]
<havenwood> jhass: Yes, xiki! I couldn't remember that for the life of me.
<jhass> havenwood: heh we figured that one out hours ago :D
<havenwood> haha
<jhass> seeing_is_believing had me get a rubygems.org dump to search with SQL queries...
* havenwood reads backlog
<jhass> which actually made me find spam along the way xD
<xco> jhass yup thanks anyway... got some idea from havenwood
troulouliou_div2 has quit [Quit: Leaving]
siery has joined #ruby
cliluw has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zapata has quit [Ping timeout: 260 seconds]
zapata has joined #ruby
jinie has joined #ruby
jenrzzz has joined #ruby
<AndreYuhai> havenwood, The problem is still with the GOOGLE_APPLICATION_CREDENTIALS environment variable. Because when I set it manually in RubyMine from Run Configurations, it works fine.
<AndreYuhai> I don't know why RubyMine does not see that
orbyt_ has joined #ruby
rikkipitt has joined #ruby
DoomSlayer2020 has quit [Quit: Leaving]
AndreYuhai has quit [Quit: Leaving]
chalkmonster has quit [Quit: WeeChat 2.8]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troulouliou_dev has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
rikkipitt has quit [Quit: Leaving...]
<siery> Good day, is there is a way to overwrite a method with yield inside? Given following example, when attempting to define a block with `M.define_a!` you get `LocalJumpError (no block given (yield))`
pwnd_nsfw has quit [Read error: Connection reset by peer]
troulouliou_dev has quit [Quit: Leaving]
reyfi9e has joined #ruby
envex has quit []
<siery> I guess I should say `super define_a` on the begining of `define_a!` definition. But that does not change much.
gitter1234 has joined #ruby
ruby-lang715 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<gitter1234> Hi, I'm trying to import some coronavirus data into my Rails app from an external JSON: https://gist.github.com/anon987654321/8b758c731bfbff09bbbba0d431dc0c03 - but what's with the `TypeError: no implicit conversion of Symbol into Integer`?
DaRock has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xco> is there a way to fill in credentials with htaccess authentication?
<xco> i would use mechanize... but the popup can't be inspected in the console for me to know which id/classes to access the username/password fields
gavlee has quit [Ping timeout: 260 seconds]
gavlee_ has joined #ruby
tau has joined #ruby
tau has joined #ruby
tau has quit [Changing host]
pwnd_nsfw has joined #ruby
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
gavlee_ is now known as gavlee
cnsvc_ has joined #ruby
orbyt_ has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
drincruz has quit [Ping timeout: 246 seconds]
<al2o3-cr> xco: Mechanize#auth ?
<xco> al2o3-cr tried that. fixed this another way
<al2o3-cr> oh, right. cool!
<al2o3-cr> xco: what you login into, a router or something?
xco has quit [Ping timeout: 246 seconds]
mheld has joined #ruby