<leftylink>
huh. you know. why have I been using product all this time and not repeated_permutation...???????????
<leftylink>
like I always did (d = [-1, 0, 1]).product(*([d] * (dimensions - 1)) or whatever
gdonald has quit [Read error: Connection reset by peer]
<leftylink>
well, I guess it's never really been necessary...
gdonald has joined #ruby
<tempate>
What exception can I catch to check if index is out of range in an array or key is not valid in a hashmap?
<leftylink>
there won't be an exception and it'll just be nil. to check if an index is range for an array, I compare against its length. if I want to check for key in hash, Hash#key?. if I want to use a default value if the thing is not there, then h[k] || 0
<leftylink>
or similar
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<tempate>
Hmmm
gdonald has quit [Read error: Connection reset by peer]
<leah2>
is there a tool to look at a gemfile and list gems that have not been updated in a long time?
braincrash has joined #ruby
naftilos76 has joined #ruby
gdonald has joined #ruby
<nakilon>
I guess this: bundle-outdated - List installed gems with newer versions available
<nakilon>
(without '-', that's a copypasta from man)
naftilos76 has quit [Ping timeout: 256 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<tempate>
And how can I fill a non-empty array with elements until it reaches a certain length?
gdonald has quit [Read error: Connection reset by peer]
<leftylink>
which is also able to take argument indicating which indices to fill
<leftylink>
and those indices are able to extend past the end of the existing array
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
queip has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
ignorand has quit [Disconnected by services]
<tempate>
Great, thankss
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<leftylink>
hmm, although sometimes I find it easier to understand if I just concat([element_to_add] * how_many_times_to_add_it)
gdonald has quit [Read error: Connection reset by peer]
<leftylink>
though the fill equivalent of that also seems pretty easy to understand
<leftylink>
given that you can speciay an appropriate start and length
<leftylink>
so maybe i should tart using fill for that instead
gdonald has joined #ruby
somazero has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has joined #ruby
dionysus69 has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
akem has quit [Ping timeout: 256 seconds]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
sixrc has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
phage has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
cgfbee has joined #ruby
va5c0 has joined #ruby
va5c0 has quit [Client Quit]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
sixrc has quit [Remote host closed the connection]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
chrisseaton_ has joined #ruby
TomyWork has joined #ruby
al2o3-cr has joined #ruby
<tempate>
Hmmm
<tempate>
Alright
ramfjord has joined #ruby
<tempate>
Will Marshal.load( Marshal.dump(a) ) make a deep-copy of an n-dimmensional array?
cliluw has quit [Ping timeout: 240 seconds]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<tempate>
Never mind, I found a better way to do what I wanted
ramfjord has quit [Ping timeout: 256 seconds]
gdonald has quit [Read error: Connection reset by peer]
naftilos76 has joined #ruby
gdonald has joined #ruby
chrisseaton_ is now known as chrisseaton
<leah2>
nakilon: i'm looking for upstream dead packages
va5c0 has joined #ruby
va5c0_ has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
va5c0 has quit [Ping timeout: 256 seconds]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
Swyper has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
<leah2>
i wrote something myself now
gdonald has joined #ruby
burgestrand has joined #ruby
va5c0_ has quit [Quit: WeeChat 3.0]
va5c0 has joined #ruby
va5c0 has quit [Client Quit]
va5c0 has joined #ruby
prion has joined #ruby
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phage has joined #ruby
Technodrome has joined #ruby
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gdonald has quit [Read error: Connection reset by peer]
phage has joined #ruby
gdonald has joined #ruby
dionysus69 has quit [Quit: dionysus69]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
dionysus69 has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
meinside has quit [Quit: Connection closed for inactivity]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
fanta1 has quit [Quit: fanta1]
gdonald has joined #ruby
BTRE has quit [Remote host closed the connection]
fanta1 has joined #ruby
GodFather has joined #ruby
GodFather_ has joined #ruby
BTRE has joined #ruby
GodFather_ has quit [Max SendQ exceeded]
GodFather has quit [Max SendQ exceeded]
GodFather_ has joined #ruby
GodFather has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
TCZ has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
Swyper has quit [Remote host closed the connection]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
gdonald has joined #ruby
burgestrand has quit [Quit: burgestrand]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
burgestrand has joined #ruby
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
Tuor has joined #ruby
gdonald has joined #ruby
<Tuor>
Hi, in my script I have 3 time consuming external programms which are called each a couple of times. Right now it's all serial and I'm thinking about running thome commands in parallel. The order is important and in general to many parallel commands would create so much IO wait that it wont be beneficial. This is my code: I created a little graph: https://gitlab.com/nod0n/backup-the-backup#graph
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<havenwood>
Tuor: Are you looking for feedback generally or suggestions on anything in particular?
gdonald has quit [Read error: Connection reset by peer]
<Tuor>
The yellow boxes are notes about what external programme is used. The order is important. First rsync, then qemu-img, then borg create, then borg prune. This for steps are the important ones which use a lot of time. rsync and qemu-img together are the preparation part. borg create is the actually backup part and borg prune is a cleanup part. Lets call them: pre, backup and post.
<Tuor>
this would now look like: pre1, backup1, post1, pre2, backup2, post2, ...
gdonald has joined #ruby
<Tuor>
I thought about starting pre2 as soon as backup1 has begun. So running it in parrall. There can only be one backup or post task at any time. It is not possible to run backup2 while post1 is running.
<Tuor>
So we could it even simplify: pre = [rsync, qemu-img], backup = [borg_create, borg_prune]
<havenwood>
Tuor: Sounds like a good job for Rake.
* Tuor
duckduckgos Rake. :)
gdonald has quit [Read error: Connection reset by peer]
<naftilos76>
Hi everyone, i think i am loosing my mind on this... Some weird is happening or i am just being ridiculously wrong!
<naftilos76>
ok guys - you are right - i did not pay attention to the fact that depending on the case "Adam12: Ruby uses references for some things, and values for others"
<havenwood>
Tuor: Normally you make Rake tasks that call your code using the external interface.
<havenwood>
Tuor: It may not work in your case, but I'd expect it would. Maybe something I don't have context on blocks. Also, I'm precoffee so basically useless. :P
<havenwood>
burgestrand: It's the popular thing to say that Ruby passes by value, the value being a reference?
<adam12>
Tuor: This shells out to cli tools right?
ChmEarl has joined #ruby
<burgestrand>
havenwood yeah… I'm pondering the implications of saying "ruby always passes by reference" in the name of making things easy to understand, tradeoff being correctness
<Tuor>
yes. But most of the time it calls external programms, without using the shell (to avoid problems with the shell doing magic stuff).
<adam12>
Tuor: Do you deal with the tools' output on stdout/stderr?
* burgestrand
shrugs
<Tuor>
most of the time not really, it is just debug output. There is a least one exception but this execption isn't part of the pre/backup stuff.
<adam12>
Tuor: So each process goes through pre, backup post. You are fine running pre when backup is running, but don't want to run backup when another backup is running due to IO contention?
Swyper has quit [Remote host closed the connection]
<Tuor>
adam12: I think yes. I don't exactly know what IO contention is, but basicaly backup operates on the same data and for that reason it is not possible to run it at the same time as other backup parts. pre has always to be done before backup because it prepares the data to be backed up.
<adam12>
Tuor: And you'd be fine running 2 pre's at the same time?
<Tuor>
adam12
<Tuor>
yes
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<adam12>
Tuor: Probably a dozen different ways to handle this, but I'd probably reach for SuckerPunch and 3 job "queues" (one for pre, backup, and post). Set the pre to have N workers (maybe match # cpu?), backup to have 1 worker (to make it sync), and post to have N workers (same as pre).
<adam12>
Tuor: Kick off the backup process by scheduling a job in Pre. Once it finishes, it queues the next job into Backup. When Backup finishes, it queues the next job into Post.
<adam12>
So basically queue up N backup jobs by creating N Pre jobs. They work in parallel by # of workers assigned to that job class. They then queue into Backup which works on one job at a time. When it finishes it drops them into Post, which works on the jobs up to N parallel.
<Tuor>
sounds like what I had in mind. Just that, post sadly can't be done at the same time as backup. So post has to be part of backup. There are only 2 tasks: 4x pre, 1x backup (inclusive post)
<Tuor>
start, pre1..4; as soon as one pre job is done, add the appropriate backup job to the que and start a new pre. But yes, this queing principle sounds like what would do the trick. I'll have to read some. :)
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
qbklinm8 has quit [Quit: Leaving.]
prion has quit [Ping timeout: 256 seconds]
Swyper has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
<adam12>
Tuor: Good luck!
<Tuor>
thank you!
dionysus69 has joined #ruby
<adam12>
Tuor: I've never seen Trilio Vault. Interesting.
gdonald has joined #ruby
TzilTzal has quit [Quit: Leaving.]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<Tuor>
Lets say it is nice, but lacks some features (keep one backup a week for N weeks, then keep a backup a month for N month and so on) and your NFS has to be disaster resistant or you need a backup/&estore solution when everything fails. This approach will fix both oth this problems for us. We will take the latest backup every week and "export" it to the external disk every week and then rotate disks: 4weekly disks, 2 montly disks, 3 quarterly disks, and one
<Tuor>
for each year for ever.
<Tuor>
This disks will be our disaster recovery and our long term backup.
cloud69 has joined #ruby
<Tuor>
If you see something in my code that requires more comments or you think you have good ideas on how I should improve my code let me know. ;)
gdonald has quit [Read error: Connection reset by peer]
<havenwood>
al2o3-cr: I'd swear I saw another reference, but not seeing it with a quick search.
<al2o3-cr>
havenwood: i wonder why?
<al2o3-cr>
reported of 2 months ago too.
<al2o3-cr>
*over
<al2o3-cr>
havenwood: did it work before ArithmeticSeq...
<havenwood>
al2o3-cr: Not on Range steps, I think. I think it was fixed at some point for Integer step. I haven't researched it.
<al2o3-cr>
havenwood: ah, ok. that definitely needs fixing imho.
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
blackmesa1 has joined #ruby
gdonald has joined #ruby
qbklinm81 has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
va5c0 has joined #ruby
lucasb has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
dfucci has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
aremaref has joined #ruby
cuerbot has quit [Ping timeout: 246 seconds]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<isene>
adam12: I tried to figure out how to implement a getch call with a time argument, but can't get that to work. Firstly, are we talking about the Curses getch? Because it takes no arguments...
gdonald has quit [Read error: Connection reset by peer]
<adam12>
isene: I just noticed it requires `io/console`.
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
oryman has joined #ruby
bsdbandit-01 has joined #ruby
gdonald has joined #ruby
oryman has quit [Client Quit]
gdonald has quit [Read error: Connection reset by peer]
akem has joined #ruby
akem has quit [Remote host closed the connection]
stdedos has joined #ruby
gdonald has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
Swyper has quit [Remote host closed the connection]
<isene>
adam12: Right
gdonald has quit [Read error: Connection reset by peer]
<nakilon>
what are the modern ruby sandboxing options available that limit the consumed resources?
<isene>
adam12: I don't see any docs on the time: or min: arguments... do you know where I can find that?
gdonald has joined #ruby
<adam12>
isene: Might have to look in the Ruby source, but I'm not really familiar.
<nakilon>
pretty sure docker run has such options but is it's a simple web app it would also need to have another process, a scheduler because I it's not a good thing to give web server rights to launch docker containers
<nakilon>
simple ability to run limited process directly from the same process that is listening to the web would be nice
<nakilon>
*but if it's
gdonald has quit [Read error: Connection reset by peer]
<havenwood>
nakilon: You can run mruby in the browser with wasm. Or if you really want it on the server, ask jhass. :P
<nakilon>
is he author of that website that runs the ruby code?
<havenwood>
nakilon: Folk used to use JRuby for sandboxes. You can look at TryRuby versions for a history of sandboxes throughout the ages.
<nakilon>
yeah I need it on server, the theoretical application is a website for competitive programming where the input is a code in a language I've implemented a "VM" for
gdonald has quit [Read error: Connection reset by peer]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gdonald has joined #ruby
<nakilon>
better use Kernel#select but yes it will take more code
gdonald has quit [Read error: Connection reset by peer]
bsdbandit-01 has joined #ruby
TomyLobo has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
TomyWork has quit [Remote host closed the connection]
Swyper has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
prion has quit [Ping timeout: 268 seconds]
gdonald has quit [Read error: Connection reset by peer]
<al2o3-cr>
isene: if you want the time kwarg to work you need to pass min: 0 also. STDIN.getch(min: 0, time: 3)
<isene>
So time is in seconds, what is min?
gdonald has joined #ruby
<al2o3-cr>
isene: minimum
gdonald has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
gdonald has joined #ruby
<isene>
Minimum time? How would that differ from time?
<al2o3-cr>
isene: minimum bytes to receive.
<isene>
Ah. Thanks 😊
ramfjord has joined #ruby
chrisseaton has quit [Quit: Connection closed for inactivity]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
teardown has joined #ruby
Rudd0 has quit [Remote host closed the connection]
stdedos has quit [Quit: Connection closed]
<al2o3-cr>
isene: sure, some of the IO methods can be pretty whacky to figure out without looking into the source.
bsdbandit-01 has joined #ruby
teardown_ has quit [Ping timeout: 240 seconds]
<isene>
This just made my day. With this I can intercept directory changes in RTFM. You guys are the best :-)
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
chrisseaton has joined #ruby
bsdbandit-01 has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
prion has joined #ruby
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
bsdbandit-01 has quit [Read error: Connection reset by peer]
akem has joined #ruby
<al2o3-cr>
isene: that example for one byte only, just so you know.
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<isene>
Yes, got that. I now have the non-blocking getch in place in RTFM so that any changes to the currently viewed diectory pops up without the user having to hit any key for the loop to capture the change: https://github.com/isene/RTFM
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Excess Flood]
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Excess Flood]
qbklinm8 has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Excess Flood]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
teardown has quit [Ping timeout: 240 seconds]
bsdbandit-01 has joined #ruby
weaksauce has joined #ruby
teardown has joined #ruby
ur5us has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
fandre1986 has joined #ruby
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
gdonald has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
gdonald has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
gdonald has quit [Read error: Connection reset by peer]
teardown_ has joined #ruby
gdonald has joined #ruby
teardown has quit [Ping timeout: 240 seconds]
fanta1 has quit [Remote host closed the connection]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<ian|>
for explicit block parameters, can there be only one and it must be the last parameter?
apoc has quit [Ping timeout: 240 seconds]
<leftylink>
right..., like I can't do foo(bar) { |...| ... } { |...| ... }
apoc has joined #ruby
<leftylink>
what was that one topic that people in this channel could not agree on at all? actually I guess there is no use in bringing it up, since then people will just continue to not agree on it. so I will have to make my own decision