benzrf

Activity Graph

Page 1 of 70 | Next »

2018-08-16

[16:00:56] benzrf: has joined #ruby
[16:01:33] benzrf: is there a nice way to take an iterable whose items are iterables and get an iterable which "flattens" it
[16:05:42] benzrf: i know, but i was hoping there was already something in the stdlib :)
[16:06:42] benzrf: bougyman: e.g., ['a.txt', 'b.txt'].map {|fn| File.open(fn).each_line}.join would give an Enumerable which produces the lines of 'a.txt' and then the lines of 'b.txt'
[16:07:08] benzrf: i mean, you could read them all into arrays and then use Array#flatten, but that would be a bad idea
[16:11:51] benzrf: ccooke: https://benzrf.com/uploads/049c00fd5226cab3.png
[16:12:29] benzrf: you mean instead of map in my sample
[16:12:49] benzrf: oh, thatd probably work o:
[16:14:06] benzrf: ccooke: no dice :( https://benzrf.com/uploads/20df189a93567725.png
[16:21:42] benzrf: nah i couldve easily written it ;)
[16:21:47] benzrf: thanks tho
[16:21:54] benzrf: has left #ruby: ("WeeChat 2.2")

2017-11-01

[01:11:10] benzrf: oh my god
[01:11:23] benzrf: so i modified the mac thing to pass the data in all at once and it errored
[01:11:40] benzrf: i poked a bit and it seems that update was returning the full data encrypted
[01:11:47] benzrf: and it expected only 16 bytes out
[01:11:56] benzrf: so. i. called update once. and. truncated to the last 16 bytes.
[01:12:05] benzrf: presto. instantly 100MB/s and my fan doesnt turn on
[01:12:49] benzrf: but this is
[01:13:12] benzrf: this part isnt the check
[01:13:14] benzrf: it compares the result
[01:13:24] benzrf: so presumably this is producing the same result
[01:13:36] benzrf: here's my theory...
[01:13:48] benzrf: calling update all at once has to allocate a big string
[01:14:12] benzrf: so maybe in C, it's better to do the loop, because you have to loop over the data anyway, and that way you dont need to keep allocating
[01:14:22] benzrf: and then whoever wrote this decided the same thing was true here.
[01:15:30] benzrf: the function i altered was just the part that computed a mac
[01:16:45] benzrf: RickHull: https://gist.github.com/benzrf/cea67734c3ea4df0914ae1066f818680/revisions#diff-0abc4e14ebec1157f5747905ec22a461
[01:17:48] benzrf: via 19:29 <catphish> block = data + "\x0"*((16-data.bytesize%16)%16);
[01:18:03] benzrf: saved me the trouble of taking 20 seconds to figure out my fenceposts :>
[01:32:49] benzrf: RickHull: it works pretty well apart from that though o:
[01:58:05] benzrf: whyyy does ruby have global variables
[01:58:17] benzrf: WHYYYYYYYYYYYYY does ruby USE GLOBAL VARIABLES TO CONFIGURE DEFAULTS
[02:13:22] benzrf: i know because perl
[02:13:28] benzrf: but that's not an excuse
[02:13:50] benzrf: like. just because perl does it. matz still had to look at it and think "yes. that is a good idea. i will put this into my language"
[02:15:20] benzrf: sorry, not precisely "defaults", i mean like "defaults" in the sense of default behavior of things like #split in the absence of specific args
[02:15:59] benzrf: er, and my objection was less to the use of global variables as opposed to something else, and more the ability to do that at all
[02:16:23] benzrf: if you _really_ want that to be possible, at _least_ don't make it dynamically changable at runtime! good god
[20:52:07] benzrf: has left #ruby: ("WeeChat 1.9.1")

2017-10-31

[22:24:20] benzrf: has joined #ruby
[22:25:23] benzrf: has left #ruby: ("WeeChat 1.9.1")
[23:10:48] benzrf: has joined #ruby
[23:11:11] benzrf: im using the rmega gem to download a bunch of files from mega.co.nz, and it's working great, except for one thing
[23:11:26] benzrf: when i resume a download, it takes a ton of cpu and a pretty long time to verify the integrity of what's downloaded so far
[23:11:33] benzrf: i snooped around in the code a bit and i found this: https://gist.github.com/cea67734c3ea4df0914ae1066f818680
[23:11:44] benzrf: is it just me, or is this something that should be implemented in C and not ruby?
[23:12:46] benzrf: catphish: yeah, but it's looping _in ruby_ over _each 15-byte chunk_
[23:12:57] benzrf: is there much overhead in ruby<->c calls?
[23:14:21] benzrf: that said, it _is_ managing to chew through about 30M/s - i have no idea whether that's good or bad
[23:14:32] benzrf: still, it's making my fan turn on, and i feel like it shouldnt be
[23:14:40] benzrf: ok i figured :)
[23:14:51] benzrf: i just didnt want to sound presumptuous about how fast things should be
[23:15:21] benzrf: i wonder if it's still maintained and if i can PR something
[23:15:36] benzrf: last commit jun 12, hm
[23:15:58] benzrf: matthewd: it's dealing with non-text data so id imagine it's not chars
[23:17:49] benzrf: i dont know anything about any of this - i just poked around in the code til i found where it was doing integrity checks and then went "oh huh an awful lot of this is in ruby"
[23:18:19] benzrf: usually i do not expect heavy data crunching to be in ruby.
[23:18:43] benzrf: maybe the creator hasnt used it on anything bigger than a single 100MB file
[23:20:00] benzrf: im downloading multiple seasons of a tv show in 1080p
[23:20:14] benzrf: so ive been doing it incrementally
[23:20:20] benzrf: and it's been taking forever to finish checking and start actually downloading
[23:20:59] benzrf: i suppose i can turn off integrity check
[23:21:07] benzrf: but id prefer not to realize too late that one of the files got cut off
[23:22:39] benzrf: ACTION shrugs
[23:22:42] benzrf: i didnt write this :P
[23:23:05] benzrf: be back later

2016-06-03

[18:53:35] benzrf: has left #ruby: ("WeeChat 1.5")

2016-06-02

2016-06-01

[23:58:09] benzrf: these assholes give shitposting a bad name

2016-05-30

[00:34:30] benzrf: |meta: loooooooooooooooooooool

2016-05-29

[01:49:26] benzrf: jesus christ

2016-05-28

[05:34:50] benzrf: flov: floating point
[05:35:12] benzrf: >> 0.1 + 0.2
[16:26:34] benzrf: Gasher: in my experience, curses is named after the words that people say while using it
[16:27:06] benzrf: if i were you, i'd google for higher-level interfaces people have implemented on top of it for ruby

2016-05-26

[01:09:41] benzrf: Quit: bye
[01:10:46] benzrf: has joined #ruby
[01:23:36] benzrf: no one can help you, hunter9090. you are beyond help. truly your fate is a terrible one
[01:23:53] benzrf: but more seriously, i wouldnt be surprised - try hanging around
[22:48:48] benzrf: Synthead: how about doing a map, returning nil for items you want to remove, then using compact?
[22:49:49] benzrf: Synthead: hmm, what?
[22:49:53] benzrf: isn't #select just filter?
[22:50:18] benzrf: >> [1, 2, 3, 4, 5].select &:odd?
[22:51:31] benzrf: >> [1, 2, 3, 4].each {|x| break x.to_s if x.even?}
[22:51:54] benzrf: Synthead: why not just do your thing with the returned value, then?
[23:18:41] benzrf: Rakko: thor is good for that i think

2016-05-25

2016-05-24

[20:10:01] benzrf: hey, any TH buffs here?
[20:10:46] benzrf: is there a notation for $(something [| ...stuff here... |])?
[20:10:57] benzrf: like calling a lisp-style macro
[20:11:50] benzrf: oh christ
[20:11:53] benzrf: i meant #haskell lmao

2016-05-22

2016-05-19

[01:17:07] benzrf: hey dessm
[01:18:35] benzrf: questions are welcomed, btw =)
[01:19:06] benzrf: imperator: oh, i inferred that and was about to explain it
[01:19:11] benzrf: but without nice diagrams <.<

2016-05-18

[01:36:04] benzrf: hi serafin88
[01:43:30] benzrf: serafin88: hard question
[01:43:37] benzrf: serafin88: what's your prior programming experience?
[01:51:25] benzrf: serafin88: but what other languages have you used? none?
[02:02:16] benzrf: serafin88: i'm probably not the best person to tell you what to look at, then
[02:02:22] benzrf: you may want to come back some other time
[02:05:50] benzrf: no problem

2016-05-17

[13:57:17] benzrf: Dysp: what do you mean?
[13:58:08] benzrf: Dysp: do you have a C background?
[13:58:19] benzrf: oh, hold on
[13:58:24] benzrf: are you english as a second language, then?
[13:58:38] benzrf: sorry, just reacting to the word 'address' :p
[13:58:57] benzrf: its usage there struck me as either C-user or person-who-doesn't-natively-speak-english
[13:59:21] benzrf: not to say that it's not comprehensible - just a little bit unusual :)
[14:00:06] benzrf: when you return a value from a function, the only thing that happens is that the function call expression evaluates to that value
[14:00:52] benzrf: in ruby, 'value' is synonymous with 'object'
[14:00:59] benzrf: if you want to result in some object, just return that object
[14:02:04] benzrf: 'return several objects'?
[14:02:09] benzrf: you can only return one object
[14:02:16] benzrf: that returns an array
[14:02:24] benzrf: it's just shorthand for "return [x, y, z]"
[14:03:13] benzrf: so then if i say your_func(), that expression will evaluate to that array
[14:07:06] benzrf: Dysp: not necessarily
[14:07:31] benzrf: you can put any expression you want as a function argument
[14:07:43] benzrf: doesn't have to be a variable

2016-05-16

[17:27:14] benzrf: lucidity: screw ruby - just learn haskell
[17:41:16] benzrf: ytti: i think it's harder to learn haskell from scratch than python from scratch, if by learn you mean "come to understand the semantics of, in a way that allows you to really understand what code does, and design systems"
[17:41:30] benzrf: flip haskell and python
[17:41:54] benzrf: i think it's harder to learn haskell from scratch than python from scratch, if by learn you mean "gain the ability to make your computer do things that are useful"
[17:42:10] benzrf: "without necessarily 100% understanding the conceptual stuff behind what you're doing"

2016-05-15

[16:22:38] benzrf: Quit: bye
[16:23:52] benzrf: has joined #ruby

2016-05-13

[00:01:12] benzrf: cooldavid: im not familiar with this api & im busy

2016-05-09

[14:46:18] benzrf: jliberman: URI.join means, "if argument 2 were in an href on a page at argument 1, what would it go to"
[14:46:34] benzrf: it's not terribly well named

2016-05-06

[19:53:46] benzrf: shevy: pry
[22:12:32] benzrf: Ox0dea: lol
[22:15:30] benzrf: >> (Array.instance_methods & Hash.instance_methods - Enumerable.instance_methods).size
[22:15:38] benzrf: not too shabby o:

2016-05-05

[15:48:39] benzrf: smathy: abusing people for "wanting to be spoon fed" is srsly not constructive
[15:49:03] benzrf: it doesnt accomplish anything positive besides making you feel self righteous

2016-05-04

[23:59:38] benzrf: dudepare: yeah

2016-05-01

[20:06:28] benzrf: or, yknow, letsencrypt

2016-04-29

[12:44:09] benzrf: hi, IO.popen is stealing my stdin
[14:02:40] benzrf: catphish_: it seems to be hijacking it
[14:06:05] benzrf: catphish_: http://showterm.io/a93857d106f13e17424f8
[14:44:24] benzrf: ah, useful
[15:24:35] benzrf: kallisti5: use a constant
[15:25:03] benzrf: kallisti5: when you set "@uri =" in the module block, you're setting one of the *module*'s instance variables
[15:25:08] benzrf: so of course it won't be visible in the method
[15:25:32] benzrf: constants, however, are scoped semi-lexically
[15:25:42] benzrf: oh, you want users to be able to supply it
[15:25:54] benzrf: why not make your thing a class, and then the url is an instance variable?
[15:26:21] benzrf: (barring that, i *guess* you could do "class << self; attr_accessor :uri; end" in the module)
[15:27:15] benzrf: kallisti5: well, they do tend to
[15:27:23] benzrf: you can put the class in a module, if you want :)
[15:28:53] benzrf: kallisti5: well, here's a good rule of thumb
[15:29:24] benzrf: kallisti5: if you're making something a class, you should be able to coherently explain "what" an instance of the class is, and in what circumstances you would instantiate it
[15:30:15] benzrf: if you're really only defining the class for the features of classes that don't involve instances, you should be making a module
[15:30:58] benzrf: also, i think it's unusual to nest a class inside another class - normally you nest modules like directories, and then classes are leaves, like files
[15:31:04] benzrf: i might be wrong.
[15:31:14] benzrf: (er, modules can also be leaves)

2016-04-27

[00:07:13] benzrf: !troll benzrf
[00:07:22] benzrf: looks like it needs perms, graft

2016-04-26

[03:35:54] benzrf: Gaelan: u could do a fold
[03:36:04] benzrf: or use #mash, if you wanna import something from a gem
[03:36:54] benzrf: hash = {}; ppl.each {|p| (hash[p.state] ||= []) << p}
[03:47:06] benzrf: Gaelan: nice :)
[03:47:41] benzrf: Gaelan: hmm, not sure that's what you're looking for, though - the result hash will continue to default to []
[03:56:12] benzrf: Gaelan: yr impl doesnt work anyway :V
[03:58:35] benzrf: i think i have some kind of compulsive drive to add emoticons to my chats
[03:58:48] benzrf: and i guess i just kind of default to ambiguous/meaningless ones when i have nothing in particular to emote
[23:09:50] benzrf: ... why did it just unban """diggernick"""

2016-04-25

[00:00:08] benzrf: (py3, that is)
[12:33:51] benzrf: roelof: probably
[14:11:24] benzrf: Fernando-Basso: 'sie' is so ugly, why not just use 'they'?
[14:21:10] benzrf: Fernando-Basso: oh, well, it's not *offensive
[14:21:15] benzrf: *offensive*
[14:21:33] benzrf: Fernando-Basso: it's just that it sounds less natural than 'they', in my opinion

2016-04-24

[16:00:00] benzrf: list.min_by(&:abs) perhaps?
[21:20:26] benzrf: welcome to improper unicode support~
[21:20:39] benzrf: you'd think it'd be better what with ruby originating in japan
[23:59:44] benzrf: >>> 'ção'.upper()
[23:59:51] benzrf: cmon ruby, python is kickin your ass

2016-04-23

[02:36:56] benzrf: flashpoint9: first ofall, those are two different methods...
[02:37:11] benzrf: second of all, you want ivars, not local vars
[02:38:56] benzrf: flashpoint9: wait, are you expecting both versions of the method to run?
[02:39:04] benzrf: cause, that's not how classes work

2016-04-21

2016-04-19

[20:28:37] benzrf: jhass: works on MY end
[20:29:04] benzrf: it works if i paste into pry, but not if i paste into ruby -
[20:31:00] benzrf: is it fixed once you to_s or something?

2016-04-18

[18:06:39] benzrf: DotKite: i would assume that Array#permutation permutes the array ignoring the specific elements
[18:07:05] benzrf: so there's the identity permutation and the swap-first-two permutation
[18:07:22] benzrf: in this case they happen to produce the same result when applied, but that's not something the method cares about

2016-04-16

[01:52:11] benzrf: in_groups?
[01:53:43] benzrf: zacts: what's (%|:-)
[01:53:50] benzrf: i tried checking its type in ghci but it wasn't in scope :^(

2016-04-13

[00:14:03] benzrf: normal one :)
[00:14:17] benzrf: pass the ruby command a file path for the script you want to run
[00:14:24] benzrf: you'll probably need to install the isaac gem, though
[00:15:40] benzrf: you installed isaac?
[00:23:14] benzrf: SFPT: just pass the ruby command the path to the script
[20:47:20] benzrf: *.net *.split
[20:51:09] benzrf: has joined #ruby