« Back to channel list

#ruby - 05 June 2019

« Back 1 day Forward 1 day »
[00:14:36] esp32_prog: has joined #ruby
[00:30:12] jenrzzz: has joined #ruby
[00:39:44] ricardo: has joined #ruby
[00:39:54] evdubs: has joined #ruby
[00:41:02] Harlin: has joined #ruby
[00:54:49] troulouliou_div2: has joined #ruby
[00:58:20] AJA4350: has joined #ruby
[01:04:54] dbz: has joined #ruby
[01:16:46] fphilipe: has joined #ruby
[01:18:30] haxx0r: how to encrypt a file with a public key (and somewhere else decrypt with privatekey)? i can't find it
[01:20:50] havenwood: haxx0r: Do you want to use a gem or do it with the stdlib?
[01:21:03] haxx0r: i don't mind a gem.
[01:21:18] haxx0r: i need to protect some fields in production, after we used the data to work with
[01:21:46] haxx0r: we also upload a screenshot with sensitive data for the user, but 3 days after we want also to decrypt it
[01:22:01] haxx0r: so in case lawenforcement shows up they get encrypted data
[01:23:13] havenwood: haxx0r: The JOSE gem has some good alg options: https://www.rubydoc.info/gems/jose/file/docs/EncryptionAlgorithms.md
[01:24:27] havenwood: haxx0r: Here's an example of a symmetric key wrap: https://gist.github.com/havenwood/e18de5fa23ec1c49e3feab493d579909
[01:25:10] haxx0r: i'm ready the docs right now
[01:33:23] haxx0r: i dont get it
[01:33:32] haxx0r: i dont know how to use it for a file
[01:33:40] haxx0r: maybe better we just delete the files :P
[01:36:21] havenwood: haxx0r: You can just put the bytes of the file in the payload, then encrypt them. You could Base64 them first, but you shouldn't have to.
[01:37:06] duderonomy: has joined #ruby
[01:39:17] brool: you just want to encrypt a file?
[01:39:33] haxx0r: ya, with my publickey
[01:39:43] brool: why not just use openssl on the command line
[01:39:52] haxx0r: good question
[01:41:05] haxx0r: openssl enc -aes-256-cbc -salt -in SECRET_FILE -out SECRET_FILE.enc -pass file:./key.bin
[01:41:08] haxx0r: that command?
[01:41:30] brool: go for it
[01:42:21] havenwood: haxx0r: https://github.com/havenwood/encrypt/blob/master/lib/encrypt.rb
[01:43:02] havenwood: haxx0r: here's a bit more advanced option: https://github.com/crypto-rb/rbnacl/wiki/Public-Key-Encryption
[01:45:13] haxx0r: echo "test" > test.txt
[01:45:19] haxx0r: openssl enc -aes-256-cbc -in test.txt -out test.txt -pass file:./public.pub
[01:45:35] haxx0r: this seems to work, no error
[01:45:48] haxx0r: but i go for decrypting it: openssl enc -d -aes-256-cbc -in test.txt -out test.ori.txt -pass file:./private.key
[01:46:02] haxx0r: it's throwing erro
[01:46:36] havenwood: haxx0r: You can use OpenSSL in Ruby. Are you doing this from Ruby or is the command line or other languages fine as well?
[01:46:41] codefriar: has joined #ruby
[01:46:54] haxx0r: lemme try from ruby. might be easier
[01:48:55] dbz: has joined #ruby
[01:49:46] havenwood: RbNaCl is pretty nice. https://github.com/crypto-rb/rbnacl/blob/master/README.md
[01:49:46] dbz: has joined #ruby
[01:52:40] tdy: has joined #ruby
[01:54:46] Eletious: has joined #ruby
[01:58:03] aferreira: has joined #ruby
[02:02:50] esp32_prog: has joined #ruby
[02:03:19] llua: has joined #ruby
[02:05:52] troulouliou_div2: has joined #ruby
[02:20:43] quarters: has joined #ruby
[02:20:58] thistledown: has joined #ruby
[02:21:46] mcspud: has joined #ruby
[02:22:47] mosh: has joined #ruby
[02:52:27] thistledown: has joined #ruby
[02:55:01] houhoulis: has joined #ruby
[03:03:07] cerulean: has joined #ruby
[03:10:09] braincrash: has joined #ruby
[03:12:28] jenrzzz: has joined #ruby
[03:17:21] fphilipe: has joined #ruby
[03:22:39] tdy: has joined #ruby
[03:23:16] jenrzzz: has joined #ruby
[03:42:29] Swyper: has joined #ruby
[03:51:06] esp32_prog: has joined #ruby
[03:55:09] Eletious: has joined #ruby
[04:09:56] galaxie: has joined #ruby
[04:12:21] Swyper: has joined #ruby
[04:24:54] thistledown: has joined #ruby
[04:34:08] kyrylo: has joined #ruby
[04:38:03] dbz: has joined #ruby
[04:39:36] pabs: has joined #ruby
[04:57:29] schne1der: has joined #ruby
[05:08:53] fphilipe: has joined #ruby
[05:12:12] tsrt^: has joined #ruby
[05:21:57] Qladstone: has joined #ruby
[05:24:09] Ai9zO5AP: has joined #ruby
[05:24:18] sauvin: has joined #ruby
[05:30:32] Swyper: has joined #ruby
[05:38:52] ur5us: has joined #ruby
[05:39:25] esp32_prog: has joined #ruby
[05:39:29] ur5us: has joined #ruby
[05:42:02] houhoulis: has joined #ruby
[05:44:03] haxx0r: has joined #ruby
[05:52:05] bga57: has joined #ruby
[05:56:01] Eletious: has joined #ruby
[06:05:44] duderonomy: has joined #ruby
[06:10:12] Emmanuel_Chanel: has joined #ruby
[06:21:56] jenrzzz: has joined #ruby
[06:24:19] reber: has joined #ruby
[06:32:22] andikr: has joined #ruby
[06:37:12] dbz: has joined #ruby
[06:42:47] hightower3: has joined #ruby
[06:45:14] fphilipe: has joined #ruby
[06:51:41] krandi: has joined #ruby
[07:03:22] dbz: has joined #ruby
[07:08:34] BTRE: has joined #ruby
[07:09:22] cerulean: has joined #ruby
[07:16:28] Emmanuel_Chanel_: has joined #ruby
[07:23:54] queip: has joined #ruby
[07:25:48] Emmanuel_Chanel: has joined #ruby
[07:27:39] esp32_prog: has joined #ruby
[07:29:46] rippa: has joined #ruby
[07:45:19] esp32_prog: has joined #ruby
[07:49:32] dbz: has joined #ruby
[07:51:30] iNs: has joined #ruby
[07:54:30] mikecmpbll: has joined #ruby
[07:55:19] vondruch: has joined #ruby
[07:56:34] jenrzzz: has joined #ruby
[07:58:36] staticx: has joined #ruby
[08:00:02] Jonopoly: has joined #ruby
[08:02:32] vondruch: has joined #ruby
[08:05:27] hrhsh: has joined #ruby
[08:05:44] deepredsky: has joined #ruby
[08:08:37] schne1der: has joined #ruby
[08:13:46] ur5us: has joined #ruby
[08:14:28] klarrimore_: has joined #ruby
[08:25:22] znz_jp: has joined #ruby
[08:33:07] Swyper: has joined #ruby
[08:36:34] PaddyF: has joined #ruby
[08:38:03] jefffrails35: has joined #ruby
[08:45:34] Eletious: has joined #ruby
[08:50:27] ur5us: has joined #ruby
[08:52:35] dbz: has joined #ruby
[08:52:39] klarrimore__: has joined #ruby
[08:57:01] clemens3: has joined #ruby
[08:59:53] queip: has joined #ruby
[09:00:41] sameerynho: has joined #ruby
[09:01:15] dhollin: has joined #ruby
[09:03:48] roblucas: has joined #ruby
[09:07:56] tdy: has joined #ruby
[09:14:35] deepreds1: has joined #ruby
[09:18:40] Furai: has joined #ruby
[09:19:29] jenrzzz: has joined #ruby
[09:19:36] iMadper: has joined #ruby
[09:34:23] AJA4350: has joined #ruby
[09:34:35] dbz: has joined #ruby
[09:35:11] rbanffy: has joined #ruby
[09:36:44] vondruch: has joined #ruby
[09:40:08] klarrimore__: has joined #ruby
[09:44:55] deepredsky: has joined #ruby
[09:50:42] klarrimore_: has joined #ruby
[09:51:19] Arahael: has joined #ruby
[10:01:21] Jonopoly: got 80% of website tested using ruby
[10:01:29] Jonopoly: website is java/react
[10:01:40] Jonopoly: trying to convince other devs its just quicker/lighter with ruby T_T
[10:02:05] Jonopoly: highly unlikely could java perform these tasks this small..
[10:13:18] jenrzzz: has joined #ruby
[10:16:39] dbz: has joined #ruby
[10:28:08] troulouliou_div2: has joined #ruby
[10:30:37] UncleCid__: has joined #ruby
[10:34:55] ams__: has joined #ruby
[10:36:28] jenrzzz: has joined #ruby
[10:46:44] Eletious: has joined #ruby
[10:54:55] AJA4350: has joined #ruby
[10:59:53] Swyper: has joined #ruby
[11:05:15] jenrzzz: has joined #ruby
[11:08:29] GodFather: has joined #ruby
[11:16:27] cerulean: has joined #ruby
[11:19:39] dbz: has joined #ruby
[11:20:10] esp32_prog: has joined #ruby
[11:43:52] Emmanuel_Chanel: has joined #ruby
[11:48:09] cow[moo]: has joined #ruby
[11:55:03] esp32_prog: has joined #ruby
[12:03:22] phaul: has joined #ruby
[12:06:38] stryek: has joined #ruby
[12:09:18] tdy: has joined #ruby
[12:10:01] kyrylo: has joined #ruby
[12:13:23] jenrzzz: has joined #ruby
[12:15:55] KrzaQ: I'm on Windows, and TCPSocket.new seems to take a bit over 1 second to create a socket, consistently
[12:16:01] KrzaQ: am I doing something wrong?
[12:19:42] Eletious: has joined #ruby
[12:19:51] KrzaQ: hm, it seems that when I change 'localhost' to '127.0.0.1' it drops dramatically, to ~15-20ms
[12:20:05] KrzaQ: possibly timer resolution
[12:30:36] KrzaQ: well, thanks for being good ducks :)
[12:30:42] KrzaQ: it works great now
[12:48:07] ricekrispie: has joined #ruby
[12:51:35] zodd: has joined #ruby
[13:04:46] dbz: has joined #ruby
[13:17:20] IGnorAND: anyone try http://jsonapi-rb.org/ has_many :comments data seems to yield no attributes for the comments.
[13:18:15] jcalla: has joined #ruby
[13:19:05] jenrzzz: has joined #ruby
[13:22:35] queip: has joined #ruby
[13:23:25] yasumi2136: has joined #ruby
[13:24:16] tdy: has joined #ruby
[13:35:38] vondruch: has left #ruby: ()
[13:35:47] clemens3: has joined #ruby
[13:36:38] vondruch: has joined #ruby
[13:38:49] Dbugger: has joined #ruby
[13:41:16] spiette: has joined #ruby
[13:43:32] vondruch: has joined #ruby
[13:47:12] tdy: has joined #ruby
[13:48:18] queip: has joined #ruby
[13:55:43] mkaito-: has joined #ruby
[13:56:11] mkaito: has joined #ruby
[13:57:38] alem0lars: has joined #ruby
[14:00:26] vondruch_: has joined #ruby
[14:00:34] Dysp: has joined #ruby
[14:01:19] jeremycw: has joined #ruby
[14:01:56] tdy: has joined #ruby
[14:04:25] queip: has joined #ruby
[14:04:25] Rapture: has joined #ruby
[14:09:00] dbz: has joined #ruby
[14:13:50] i9zO5AP: has joined #ruby
[14:23:05] jenrzzz: has joined #ruby
[14:25:30] iliaskarim: has joined #ruby
[14:31:55] octos: has joined #ruby
[14:34:49] queip: has joined #ruby
[14:36:17] zapata: has joined #ruby
[14:36:20] Nikhil_Singhal: Does anyone know how to implement pascal triangle?
[14:36:58] phaul: Nikhil_Singhal: what do you have so far?
[14:37:15] rsh_: has joined #ruby
[14:37:32] Nikhil_Singhal: I just how pascal triangle works
[14:37:45] Nikhil_Singhal: Im trying from like 4-5 hours count code it
[14:37:52] matheusmoreira: has joined #ruby
[14:38:17] phaul: can you construct row n+1 from row n? Then it's just a recursion
[14:38:43] Nikhil_Singhal: I didn't get you
[14:39:23] phaul: imagine you have pascal_triangle(n). can you append stuff to it to extend it to be pascal_triangle(n+1) ?
[14:39:53] Nikhil_Singhal: What im able to do so far is
[14:39:58] klarrimore: has joined #ruby
[14:40:07] Nikhil_Singhal: This thing only
[14:42:54] phaul: def pascal_triangle(n) ; if n == 1; then [[1]] else prev=pascal_trianlge(n-1); prev + (extend_last_row(prev[-1]); end
[14:43:25] phaul: where extend_last_row just constructs the new row from the last row of the already existing smaller triangle
[14:44:39] Nikhil_Singhal: Okay lemme try thank you
[14:45:34] alem0lars: has joined #ruby
[14:45:43] Inline: has joined #ruby
[14:53:40] Harlin: has joined #ruby
[14:54:15] happyhans: has joined #ruby
[15:06:42] lunarkitty7: has joined #ruby
[15:16:40] cthulchu_: has joined #ruby
[15:19:25] queip: has joined #ruby
[15:21:36] PaddyF: has left #ruby: ("bbl")
[15:21:43] grilix: has joined #ruby
[15:25:19] brool: has joined #ruby
[15:26:51] cerulean: has joined #ruby
[15:31:43] jenrzzz: has joined #ruby
[15:33:22] dbz: has joined #ruby
[15:41:25] Seance[m]: Hi, I'm hoping someone can ELI5 this line of code
[15:41:37] Seance[m]: if string[0] == string[-1]
[15:41:38] Seance[m]: palindrome(string[1..-2])
[15:41:47] Seance[m]: This is a small snippet from a recursive function
[15:42:31] Seance[m]: I'm not sure how the end condition of checking the palindrom is progressed by this piece of code
[15:42:50] Seance[m]: I see that string[0] and [-1] check for the equality of the first and last character
[15:43:05] Seance[m]: but how does the range passed as an argument progress?
[15:43:57] Seance[m]: does ruby check the relationship in the range and continue to loop through progressively?
[15:44:04] phaul: you are checking palindromeness on a string that is 2 chars shorter ( removed first and last ) so it progresses towards the empty string
[15:44:36] Seance[m]: so it knows the next check would be string[2..-3] etc.
[15:44:38] Seance[m]: ooooooooooooooooooooh
[15:44:39] Seance[m]: Thank you phaul!
[15:46:00] phaul: well it just keeps calling palindrome to decide if the next shorter string is palindrome. At some point it calls itself wit the empty string, which I assume handled in this function as well
[15:47:00] deathwishdave: has joined #ruby
[15:47:15] phaul: one has to be careful about the edge cases especially ending with 1 character string at the end.
[15:47:48] deathwishdave: In ruby, the following regexp [a-zA-Z]|(?<=')\s*(?=') matches "( 'one' , 'two','three' ,four, '')" correctly https://rubular.com/r/aCKyC6f4uXtQXd
[15:48:18] Seance[m]: Yeah, the empty string was handled in un snippeted parts, that was the only piece I didn't understand, and I didn't want to violate the code pasting length stuff
[15:48:47] deathwishdave: however, I am translating it to C++, which does not support look-around assertions:
[15:49:13] deathwishdave: is there an alternative regexp that does not use look-around assertions please?
[15:51:58] alem0lars: has joined #ruby
[15:55:16] havenwood: deathwishdave: We could give you lots of solutions in Ruby, but you want C++, right?
[15:55:43] havenwood: deathwishdave: One option is boost::regex, but a C++ channel would probably be a better place to ask.
[15:55:49] deathwishdave: yeah, asked here as regexp experts reside
[15:55:52] queip: has joined #ruby
[15:57:24] dar123: has joined #ruby
[15:58:21] al2o3-cr: has joined #ruby
[16:03:39] fphilipe: has joined #ruby
[16:04:16] octos: has joined #ruby
[16:04:44] orbyt_: has joined #ruby
[16:06:10] AJA4350: has joined #ruby
[16:12:10] xfbs: has joined #ruby
[16:18:33] schne1der: has joined #ruby
[16:20:06] queip: has joined #ruby
[16:23:02] Eletious: has joined #ruby
[16:23:45] iNs: has joined #ruby
[16:25:15] SeepingN: has joined #ruby
[16:30:58] esp32_prog: has joined #ruby
[16:32:19] Dbugger: has joined #ruby
[16:40:08] dbz: has joined #ruby
[16:41:09] dbz: has joined #ruby
[16:42:05] dbz: has joined #ruby
[16:43:40] tdy: has joined #ruby
[16:43:48] iliaskarim: has joined #ruby
[16:47:21] laaron: has joined #ruby
[16:56:28] jenrzzz: has joined #ruby
[16:57:14] queip: has joined #ruby
[17:10:44] nowhereman: has joined #ruby
[17:20:13] moei: has joined #ruby
[17:34:03] octos: has joined #ruby
[17:36:18] octos: has joined #ruby
[17:38:25] duderonomy: has joined #ruby
[17:43:37] cadeskywalker: has joined #ruby
[17:45:10] nowhere_man: has joined #ruby
[17:46:31] gix: has joined #ruby
[17:47:01] esp32_prog: has joined #ruby
[17:49:10] queip: has joined #ruby
[17:51:48] brendan-: has joined #ruby
[17:52:28] octos: has joined #ruby
[17:58:22] LtHummus: has joined #ruby
[18:04:04] fphilipe: has joined #ruby
[18:04:18] jenrzzz: has joined #ruby
[18:07:15] ravenous_: has joined #ruby
[18:09:44] Emmanuel_Chanel: has joined #ruby
[18:15:13] dar123: has joined #ruby
[18:16:13] octos: has joined #ruby
[18:17:03] leah2: has joined #ruby
[18:22:50] themsay: has joined #ruby
[18:35:13] rbanffy: has joined #ruby
[18:35:28] gix: has joined #ruby
[18:36:32] tdy: has joined #ruby
[18:40:18] zeamp: has joined #ruby
[18:43:41] klarrimore: has joined #ruby
[18:48:01] rafadc: has joined #ruby
[18:51:34] jasmin: has joined #ruby
[18:53:47] leah2: has joined #ruby
[18:59:54] Leopere: has joined #ruby
[19:03:26] sameerynho: has joined #ruby
[19:04:48] queip: has joined #ruby
[19:06:50] themsay: has joined #ruby
[19:12:30] hiroaki: has joined #ruby
[19:15:08] ghormoon: has joined #ruby
[19:19:46] ghormoon: has joined #ruby
[19:20:17] zeamp: has joined #ruby
[19:35:01] cerulean: has joined #ruby
[19:35:15] esp32_prog: has joined #ruby
[19:36:12] jasmin_: has joined #ruby
[19:39:28] miah: has joined #ruby
[19:51:00] gix: has joined #ruby
[20:01:32] brool: has joined #ruby
[20:04:23] fphilipe: has joined #ruby
[20:06:26] jenrzzz: has joined #ruby
[20:06:56] jasmin_: has joined #ruby
[20:09:51] jasmin__: has joined #ruby
[20:18:52] VSpike: Why is it that .to_json will correctly descend into a class's attributes but .to_xml will not? https://bpaste.net/show/b77b99f9bc49
[20:25:11] gix-: has joined #ruby
[20:25:31] octos: has joined #ruby
[20:30:42] havenwood: VSpike: They both attempt to, but #to_json was implemented and #to_xml was not on svc.
[20:32:43] havenwood: VSpike: svc.respond_to? :to_xml #=> false
[20:32:48] havenwood: VSpike: svc.respond_to? :to_json #=> true
[20:32:54] havenwood: VSpike: (I'm assuming.)
[20:36:59] catbusters: has joined #ruby
[20:37:34] jasmin: has joined #ruby
[20:39:00] havenwood: Sanity check with: svc.define_singleton_method(:to_xml) { attributes.to_xml }
[20:39:32] havenwood: If it then works, you know why.
[20:41:21] jasmin_: has joined #ruby
[20:47:55] AJA4350: has joined #ruby
[20:50:07] Seich: has joined #ruby
[20:51:26] ur5us: has joined #ruby
[20:59:25] Freshnuts: has joined #ruby
[21:00:35] hightower3: has joined #ruby
[21:02:11] laaron-: has joined #ruby
[21:02:25] cthu|: has joined #ruby
[21:03:16] ErhardtMundt: has joined #ruby
[21:03:29] jasmin_: has joined #ruby
[21:08:16] jasmin_: has joined #ruby
[21:11:19] jasmin: has joined #ruby
[21:12:52] orbyt_: has joined #ruby
[21:13:02] Swyper: has joined #ruby
[21:16:19] wallace_mu: has joined #ruby
[21:23:15] jasmin: has joined #ruby
[21:23:30] esp32_prog: has joined #ruby
[21:26:15] mikecmpbll: has joined #ruby
[21:30:16] jasmin_: has joined #ruby
[21:31:39] weteamsteve: has joined #ruby
[21:32:53] jenrzzz: has joined #ruby
[21:33:59] deathwishdave: has joined #ruby
[21:35:36] ricardo_: has joined #ruby
[21:39:17] GodFather: has joined #ruby
[21:45:41] themsay: has joined #ruby
[21:45:47] weteamsteve1: has joined #ruby
[21:46:52] fphilipe: has joined #ruby
[21:49:45] hightower2: has joined #ruby
[21:50:28] VSpike: havenwood: looks like you were spot on ... thanks!
[21:52:04] nomercy: has joined #ruby
[21:52:16] nomercy: hello guys
[21:52:43] nomercy: i have a problem with Net::FTP library, in tls mode
[21:53:39] nomercy: it incorrectly works, getting previous command response as current
[21:55:04] nomercy: for example when it passes "PROT P" command, output is from previous one, "200 Command PBSZ okay" :D
[21:55:43] nomercy: it's true for MRI 2.5.3p105
[21:57:50] nomercy: any suggestions how to deal with it?
[21:58:00] iNs: has joined #ruby
[21:58:16] queip: has joined #ruby
[21:59:17] nomercy: server itself is ok, i just checked it with ncat
[22:03:34] orbyt_: has joined #ruby
[22:05:13] mooe: has joined #ruby
[22:06:56] SeepingN: has joined #ruby
[22:07:15] wallace_mu: has joined #ruby
[22:20:27] ghormoon: has joined #ruby
[22:22:15] ghormoon: has joined #ruby
[22:26:39] vondruch_: has joined #ruby
[22:27:08] jeremycw: has joined #ruby
[22:37:26] SeepingN_: has joined #ruby
[22:48:50] salerace: has joined #ruby
[22:57:31] hiroaki: has joined #ruby
[23:05:38] dviola: has joined #ruby
[23:08:18] jeremycw: has joined #ruby
[23:11:45] esp32_prog: has joined #ruby
[23:13:42] rsh: has joined #ruby
[23:20:17] jenrzzz: has joined #ruby
[23:31:54] dar123: has joined #ruby
[23:39:27] cerulean: has joined #ruby
[23:47:30] fphilipe: has joined #ruby
[23:52:30] jeremycw: has joined #ruby
[23:58:28] jenrzzz: has joined #ruby