« Back to channel list

#ruby - 25 January 2019

« Back 1 day Forward 1 day »
[00:03:11] _whitelogger: has joined #ruby
[00:04:18] Xiti: has joined #ruby
[00:21:08] Tempesta: has joined #ruby
[00:35:37] Azure: has joined #ruby
[00:38:18] AJA4351: has joined #ruby
[00:42:18] Azure|dc: has joined #ruby
[00:46:29] Azure: has joined #ruby
[01:00:24] tdy: has joined #ruby
[01:07:54] asphyxia: has joined #ruby
[01:12:55] chouhoulis: has joined #ruby
[01:19:07] al2o3-cr: &>> [(2**32) ** (2**32) % 20, (2**32).pow(2**32, 20)]
[01:19:10] rubydoc: # => [NaN, 16] (https://carc.in/#/r/633b)
[01:19:50] al2o3-cr: good to know.
[01:27:56] al2o3-cr: &>> (-1.arg / 180) * 360
[01:27:58] rubydoc: # => 6.283185307179586 (https://carc.in/#/r/633d)
[01:31:11] matchaw_: has joined #ruby
[01:55:38] laaron: has joined #ruby
[02:03:54] brandoncc: has joined #ruby
[02:06:41] donofrio_: has joined #ruby
[02:08:30] laaron: has joined #ruby
[02:57:12] cd: has joined #ruby
[02:59:14] donofrio_: has joined #ruby
[03:00:13] sonofentropy: has joined #ruby
[03:09:03] ansraliant: has joined #ruby
[03:18:15] sonofentropy: has joined #ruby
[03:19:56] chouhoulis: has joined #ruby
[03:23:18] bmurt: has joined #ruby
[03:40:51] arescorpio: has joined #ruby
[03:47:15] brandoncc: has joined #ruby
[04:00:36] arescorpio: has joined #ruby
[04:06:51] Creatornator: has joined #ruby
[04:10:21] braincrash: has joined #ruby
[04:11:06] tdy: has joined #ruby
[04:26:59] brandoncc: has joined #ruby
[04:27:42] duderonomy: has joined #ruby
[04:29:14] laaron: has joined #ruby
[04:33:10] Creatornator: has joined #ruby
[04:39:31] Ekho: has joined #ruby
[04:55:02] Creatornator: has joined #ruby
[04:59:46] cthulchu_: has joined #ruby
[05:06:53] Aqo: has joined #ruby
[05:14:13] Creatornator: has joined #ruby
[05:16:36] tdy: has joined #ruby
[05:31:10] esrse: has joined #ruby
[05:39:34] jmcgnh: has joined #ruby
[05:40:40] danguita: has joined #ruby
[06:14:12] johnny56: has joined #ruby
[06:19:53] Creatornator: has joined #ruby
[06:29:44] Creatornator: has joined #ruby
[06:48:13] dellavg_: has joined #ruby
[07:06:16] vonfry: has joined #ruby
[07:09:07] nowhere_man: has joined #ruby
[07:09:08] aupadhye: has joined #ruby
[07:16:52] clemens3: has joined #ruby
[07:31:24] vonfry1: has joined #ruby
[07:33:36] sauvin: has joined #ruby
[07:34:45] arup_r: has joined #ruby
[07:41:36] m27frogy: has joined #ruby
[07:43:22] sonofentropy: has joined #ruby
[07:53:13] dionysus69: has joined #ruby
[07:53:49] arup_r: has joined #ruby
[08:17:57] clemens3: has joined #ruby
[08:21:57] aufi_: has joined #ruby
[08:45:46] Leifr: has joined #ruby
[08:47:16] RiPuk: has joined #ruby
[08:49:07] arup_r: has joined #ruby
[08:51:41] szulak_: has joined #ruby
[09:04:55] raulp: has joined #ruby
[09:20:44] mikecmpbll: has joined #ruby
[09:28:14] WhereIsMySpoon: has joined #ruby
[09:28:38] blackmesa: has joined #ruby
[09:31:56] arup_r: has joined #ruby
[09:34:50] ellcs: has joined #ruby
[09:38:05] Guest16678: has joined #ruby
[09:40:18] GodFather: has joined #ruby
[09:43:39] m27frogy: has joined #ruby
[09:44:34] tuor: has joined #ruby
[09:45:08] WhereIsMySpoon: has left #ruby: ("http://quassel-irc.org - Chat comfortably. Anywhere.")
[09:45:33] Nicmavr: has joined #ruby
[09:48:35] gregf_: has joined #ruby
[10:08:19] blackmesa1: has joined #ruby
[10:15:48] tuor: hi, what does this line? `hostgroup_create = hostgroup_create ? 1 : 0`
[10:16:23] tuor: I know it is a variable assignment but the part with `? 1 : 0` is new to me...
[10:16:38] phaul: if hostgroup_create was truthty it evalueates to 1 otherwise 0
[10:16:54] phaul: it's called ternary expression
[10:17:13] phaul: https://syntaxdb.com/ref/ruby/ternary
[10:18:53] phaul: in that description they make the distinction that this returns a value (they might be imlying not like if-else) that's not really a difference in ruby. ternary is just a one liner if-else
[10:21:00] phaul: ..and it can be used to execute code, they are making the wrong points. ah, that site is rubish.
[10:21:41] phaul: https://alvinalexander.com/blog/post/ruby/examples-ruby-ternary-operator-true-false-syntax
[10:39:11] AJA4350: has joined #ruby
[10:50:31] ghormoon: has joined #ruby
[11:04:35] noboruma: has joined #ruby
[11:20:56] sonofentropy: has joined #ruby
[11:29:14] aufi_: has joined #ruby
[11:38:49] blackmesa1: has joined #ruby
[11:39:52] sticaz: has joined #ruby
[11:45:30] m27frogy: has joined #ruby
[11:46:42] blackmesa1: has joined #ruby
[12:02:47] AJA4350: has joined #ruby
[12:05:21] powerbit: has joined #ruby
[12:17:18] status402: has joined #ruby
[12:35:46] reber: has joined #ruby
[12:35:47] aufi_: has joined #ruby
[12:40:36] szulak_: has joined #ruby
[12:56:58] Guest16678: has joined #ruby
[13:04:06] Guest16678: has joined #ruby
[13:06:18] bmurt: has joined #ruby
[13:10:40] AJA4351: has joined #ruby
[13:19:46] nowhere_man: has joined #ruby
[13:27:42] mauro_oto: has joined #ruby
[13:28:54] lucasb: has joined #ruby
[13:34:42] ravenousmoose: has joined #ruby
[13:34:51] Guest16678: has joined #ruby
[13:42:03] Inline: has joined #ruby
[14:05:09] rippa: has joined #ruby
[14:17:39] xrexeon: has joined #ruby
[14:20:10] aufi_: has joined #ruby
[14:21:21] nowhereman: has joined #ruby
[14:23:34] TheBloke: has joined #ruby
[14:31:53] krawchyk: has joined #ruby
[14:42:45] jcarl43: has joined #ruby
[14:45:19] Rapture: has joined #ruby
[15:04:04] dinfuehr: has joined #ruby
[15:06:03] polishdub: has joined #ruby
[15:06:27] ravenousmoose: has joined #ruby
[15:10:32] thebetra1: has joined #ruby
[15:16:37] Emmanuel_Chanel: has joined #ruby
[15:21:31] orbyt_: has joined #ruby
[15:23:44] ravenousmoose[aw: has joined #ruby
[15:40:09] ravenousmoose: has joined #ruby
[15:40:28] AJA4350: has joined #ruby
[15:41:18] Sembei: has joined #ruby
[15:50:30] blackmesa1: has joined #ruby
[15:57:17] jcalla: has joined #ruby
[15:57:19] ravenousmoose[aw: has joined #ruby
[15:58:24] blackmesa1: has joined #ruby
[16:03:20] Mike11: has joined #ruby
[16:11:01] conta1: has joined #ruby
[16:12:36] blackmesa1: has joined #ruby
[16:15:01] AJA4351: has joined #ruby
[16:24:23] conta1: has joined #ruby
[16:31:43] davidw: has joined #ruby
[16:34:15] chouhoulis: has joined #ruby
[16:34:55] chouhoulis: has joined #ruby
[16:47:46] cthulchu_: has joined #ruby
[16:49:38] AJA4351: has joined #ruby
[16:51:30] ravenousmoose: has joined #ruby
[16:52:11] Renich: has joined #ruby
[16:54:02] blackmesa1: has joined #ruby
[17:05:04] brandoncc: has joined #ruby
[17:05:26] \void: has joined #ruby
[17:09:06] ravenousmoose[aw: has joined #ruby
[17:14:27] ivanskie: has joined #ruby
[17:15:00] conta1: has joined #ruby
[17:19:05] keanny479: has joined #ruby
[17:19:50] keanny479: i wish to backup a list of daemons for example ['cron', 'apmd'] into a file
[17:19:57] keanny479: so an array to file
[17:20:15] keanny479: but which type of file is best in this case ? JSON or YAML ?
[17:20:58] RougeR: has joined #ruby
[17:22:50] AJA4351: has joined #ruby
[17:22:57] leftylink: maybe a file w/ one element per line is good
[17:24:14] elomatreb: You have both choices available by default in Ruby, YAML can serialize complex types unlike JSON but fewer languages have YAML parsers in their standard library
[17:25:19] Renich: has joined #ruby
[17:29:34] Dbugger: has joined #ruby
[17:29:50] Renich: has joined #ruby
[17:30:37] tdy: has joined #ruby
[17:35:27] keanny479: so i could simply use a std file ?
[17:36:00] keanny479: in fact i need to backup an output command line to a file
[17:39:45] tankf33der: has joined #ruby
[17:41:01] ravenousmoose: has joined #ruby
[17:42:43] havenwood: keanny479: PStore and YAML::Store are both in the stdlib for serializing to disk transactionally.
[17:43:36] keanny479: havenwood: what do you advice me ?
[17:44:22] havenwood: keanny479: It depends. Tell us more! When you say backup a list of daemons, do you mean alway replacing the entire list at once? Is it a single process and single thread doing the replacing?
[17:45:50] [Butch]: has joined #ruby
[17:46:40] keanny479: i just need to backup running daemons, i have a shell script for that named 'listd.sh'
[17:47:08] keanny479: output is just for example => cron\npostfix\nnginx\n
[17:47:33] keanny479: need to send an error if file (backup list) exists
[17:49:29] nowhere_man: has joined #ruby
[17:50:22] havenwood: keanny479: do you alway replacing the entire list of daemons at once from a single thread?
[17:50:56] keanny479: i need each time a new file, if a file already exist, raise
[17:51:24] keanny479: and regarding the reading, i will need to move the file to an array
[17:51:58] baweaver: `File.exist?`
[17:52:21] Guest16678: has joined #ruby
[17:58:01] ravenousmoose: has joined #ruby
[17:58:36] havenwood: keanny479: Unless there's more going on, you can just serialize then write to file, deserialize and read.
[17:58:55] havenwood: keanny479: or as leftylink suggested, just do a daemon per line.
[17:59:08] havenwood: keanny479: Here's an example of just reading and writing files: https://gist.github.com/havenwood/3a58a863b69a9b7c2327e21610899d4b
[18:03:17] keanny479: a demo of what i started to do : https://gist.github.com/wesley974/bf5dcf6ce0d09b8c2dfc141c9d07ea10
[18:03:20] blackmesa1: has joined #ruby
[18:08:19] mustmodify_: has joined #ruby
[18:08:49] mustmodify_: In the back of my brain, I remember reading about some kind of crazy syntax that would allow you to append data to the end of a Ruby file, which you could read as though it were a separate file or something...
[18:09:08] mustmodify_: though honestly that could have been in another language and I just got it confused. But does that ring any bells for anyone?
[18:09:50] rikkipitt: has joined #ruby
[18:10:05] AJA4350: has joined #ruby
[18:10:09] havenwood: mustmodify_: DATA __END__
[18:10:37] tdy: has joined #ruby
[18:10:49] mustmodify_: my brain DOES work sometimes. Nice. Thanks.
[18:10:54] havenwood: mustmodify_: de nada!
[18:13:39] patrickpv: has joined #ruby
[18:14:18] keanny479: thank you so much havenwood
[18:14:29] havenwood: keanny479: you're welcome!
[18:16:34] lytol_: has joined #ruby
[18:19:20] patrickpv: I'm trying to pass a binding to a wrapped proc. Here is the context: I'm running a sinatra app, so for example in get '/blah' { xxx }, the code in xxx gets contextual variables like request, etc. I created a self.api_endpoint(uri, perms, &block) that does some special perm processing, then creates and passes a sub-proc, like this: send(:get, uri) {|*args| somestuff(perms) ; block.call(*args) }. The problem is that there are some conte
[18:19:41] patrickpv: proc knows about sutch as request, but the block called by block.call doesn't know about them... is there a way to "pass" the binding of the wrapping proc to the subproc?
[18:22:35] Aqo: has joined #ruby
[18:25:38] havenwood: patrickpv: You can pass a proc that captures the context you want as a block: send(:get, uri, &proc_here)
[18:26:22] agent_white: has joined #ruby
[18:26:56] patrickpv: Yes that works but I'm doing some wrapping of the proc
[18:27:43] patrickpv: Doing some special permission processing, then actually running the block as normal
[18:28:00] patrickpv: If I pass it as-is I'm not doing that and wrapping it would be not useful, if that makes sense
[18:28:54] patrickpv: basically I'd like to do some kind of block.binding = current_binding, before calling it (except that's not a valid syntax)
[18:29:09] r29v: has joined #ruby
[18:34:43] mustmodify_: has left #ruby: ()
[18:38:05] AJA4351: has joined #ruby
[18:43:18] d^sh_: has joined #ruby
[18:46:29] ivanskie: hi, any of you use prometheus_exporter gem ?
[18:46:37] rikkipitt: has joined #ruby
[18:46:56] ivanskie: I dont understand how to configure it, how does it know where to send the metrics!?
[18:48:03] orbyt_: has joined #ruby
[18:54:24] patrickpv: it defaults to localhost as per https://github.com/discourse/prometheus_exporter/blob/master/lib/prometheus_exporter/client.rb#L53
[18:56:16] chouhoulis: has joined #ruby
[18:57:02] patrickpv: then you see in a bunch of the code: @client = client || PrometheusExporter::Client.default
[18:58:00] patrickpv: and self.start(client= nil, blah blah)
[18:58:48] patrickpv: so one might think that if you initialize stuff with server.start(client = PrometheusExporter::Client('some_other_host')) it could work
[18:59:00] patrickpv: rather than just .start()
[18:59:10] patrickpv: its undocumented though which indeed is strange
[19:00:29] patrickpv: You might have to dig a bit deeper in the code to figure it out exactly
[19:00:39] reber: has joined #ruby
[19:09:56] r29v: has joined #ruby
[19:11:28] AJA4351: has joined #ruby
[19:16:19] lxsameer: has joined #ruby
[19:22:37] rikkipitt: has joined #ruby
[19:29:04] rikkipitt: has joined #ruby
[19:30:48] rikkipitt: has joined #ruby
[19:33:29] gix: has joined #ruby
[19:34:35] rikkipitt: has joined #ruby
[19:45:13] jinie: has joined #ruby
[19:47:13] AJA4351: has joined #ruby
[19:58:15] mikecmpbll: has joined #ruby
[20:04:04] eckhardt: has joined #ruby
[20:16:20] AJA4351: has joined #ruby
[20:25:48] Nicmavr: has joined #ruby
[20:31:00] SirFunk: has joined #ruby
[20:34:18] hurricanehrndz: has joined #ruby
[20:39:28] AJA4351: has joined #ruby
[20:41:12] Fernando-Basso: has joined #ruby
[20:45:10] _whitelogger: has joined #ruby
[20:48:20] patrickpv: So I'm still trying to find how to pass a context to a block: https://dpaste.de/KMFx
[20:49:46] r29v: has joined #ruby
[20:50:46] orbyt_: has joined #ruby
[20:52:20] hurricanehrndz: has joined #ruby
[20:53:11] tdy: has joined #ruby
[20:54:34] tdy1: has joined #ruby
[21:09:06] sonofentropy: has joined #ruby
[21:13:17] ivanskie: has joined #ruby
[21:23:24] patrickpv: ok so the answer was instance_exec(*args, &block)
[21:23:56] am0123: has joined #ruby
[21:31:55] TheBloke: has joined #ruby
[21:33:31] AJA4350: has joined #ruby
[21:45:21] laaron: has joined #ruby
[21:46:52] laaron: has joined #ruby
[21:48:21] laaron: has joined #ruby
[21:49:35] laaron: has joined #ruby
[21:50:57] laaron: has joined #ruby
[21:52:03] RougeR: has joined #ruby
[21:52:41] laaron: has joined #ruby
[21:53:52] laaron: has joined #ruby
[21:55:22] laaron: has joined #ruby
[21:58:11] millerti: has joined #ruby
[22:00:17] shakes: has joined #ruby
[22:06:04] ivanskie: has joined #ruby
[22:08:45] AJA4351: has joined #ruby
[22:11:08] RougeR: has joined #ruby
[22:13:11] blackmesa1: has joined #ruby
[22:24:05] Ocampa: has joined #ruby
[22:44:05] AJA4351: has joined #ruby
[22:50:47] sonofentropy: has joined #ruby
[23:22:20] blackmesa1: has joined #ruby
[23:23:42] baweaver: Going over TracePoint tomorrow on stream - https://www.twitch.tv/events/l_h6rI0NTJC1QdVeigfdsQ
[23:25:51] elcuervo_: has joined #ruby
[23:33:11] elcontrastador: has joined #ruby
[23:36:36] blackmesa: has joined #ruby
[23:36:45] AJA4350: has joined #ruby
[23:42:22] m27frogy: has joined #ruby
[23:45:35] duderonomy: has joined #ruby
[23:46:13] funnel: has joined #ruby
[23:50:09] cnsvc: has joined #ruby
[23:53:26] AJA4351: has joined #ruby
[23:55:11] uplime: baweaver: do you normally stream your coding?
[23:55:42] baweaver: Eh, sometimes when I remember
[23:55:49] uplime: haha, fair enough