jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <tenebrousedge> I can maybe do it as a really ugly `getter` block, I guess?
<FromGitter> <Blacksmoke16> got some example code
<FromGitter> <tenebrousedge> https://play.crystal-lang.org/#/r/a5tp
<FromGitter> <Blacksmoke16> ah
<FromGitter> <Blacksmoke16> try moving the method in with the constant
<FromGitter> <Blacksmoke16> because the const doesnt exist until a class inherits from it
<FromGitter> <tenebrousedge> undefined method `foobar` :( ⏎ https://play.crystal-lang.org/#/r/a5tq
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> `macro included` not `inherited`
<FromGitter> <tenebrousedge> oh derp
<FromGitter> <tenebrousedge> there we go
<FromGitter> <tenebrousedge> thanks muchly @Blacksmoke16
<FromGitter> <Blacksmoke16> πŸ‘
<hightower2> Hm if a C function returns a Pointer(UInt8) without length... is there any way to convert this to a slice other than manually providing max size, like Bytes.new str_thing, 1024 ?
<hightower2> Or maybe the same question from a different perspective -- I need any way to (efficiently) convert Pointer(UInt8) into an argument accepted by IO#write, similarly to how a slice is one of accepted types to it
<oprypin> hightower2, call `strlen` on it??
<hightower2> hmm... well, probably, yeah
<hightower2> thanks
<oprypin> writing to an io could be done more efficiently but actually by not that much https://github.com/crystal-lang/crystal/blob/3c48f311f98e95964d425abe23d2b353b7da07d1/src/io.cr#L1120
<oprypin> i was thinking like, either implement a fake io over a pointer, or copy this implementation and do something
<hightower2> ah yes we were mentioning this option the other day, re. joining slices
<oprypin> i jsut realize it's silly, there is just no way at all that anything would be more efficient than strlen
<hightower2> yeah...
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter> <watzon> Those moments when you spend hours working on a project only to realize that you already did most of the work in another project
<FromGitter> <Blacksmoke16> well done :p
<FromGitter> <watzon> That being said, if anyone wants native Crystal AES, CTR, CBC, IGE, or RSA https://github.com/watzon/crypto/
<FromGitter> <watzon> More to come hopefully
<FromGitter> <tenebrousedge> what project did you duplicate?
<FromGitter> <watzon> I had already done a lot of the work for RSA inside of this library, and today started working on a solo RSA library. Ended up doing a lot of the same work over again.
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 246 seconds]
hightower2 has quit [Ping timeout: 246 seconds]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
lunarkitty7 has joined #crystal-lang
avane has quit [Ping timeout: 240 seconds]
avane has joined #crystal-lang
bazaar has quit [Ping timeout: 256 seconds]
bazaar has joined #crystal-lang
HumanG33k has quit [Quit: Leaving]
_ht has joined #crystal-lang
f1reflyylmao is now known as f1refly
<FromGitter> <erdnaxeli:cervoi.se> oprypin, cool ! (the MSC)
<FromGitter> <bararchy> Hi Everyone, I'm pretty happy to announce that NeuraLegion has released it's free-for-devs plan, so if you want application security testing done on your Crystal apps, feel free to sign-up and use us to make the whole community more secured πŸŽ‰ ⏎ https://nexploit.app/signup
postmodern has quit [Quit: Leaving]
<FromGitter> <Daniel-Worrall> Do you have an info page of what it's all about?
<FromGitter> <erdnaxeli:cervoi.se> hi, is there a way to do profiling?
oddp has joined #crystal-lang
<FromGitter> <bararchy> @Daniel-Worrall -> https://www.youtube.com/watch?v=Ysx3EQdie1o
<FromGitter> <Daniel-Worrall> Ty
Xeago has quit [Ping timeout: 256 seconds]
Xeago has joined #crystal-lang
woodruffw has quit [Ping timeout: 246 seconds]
woodruffw has joined #crystal-lang
Xeago has quit [Ping timeout: 246 seconds]
woodruffw has quit [Ping timeout: 246 seconds]
woodruffw has joined #crystal-lang
Xeago has joined #crystal-lang
Xeago has quit [Ping timeout: 260 seconds]
Xeago has joined #crystal-lang
<o5r> Is there any library available for Crystal to write my own weird custom ssh server? would the libssh bindings allow that? They seem to be more client-oriented
<frojnd> I'm passing arguments to array and then make it a json: https://carc.in/#/r/a5v8 but I don't want empty values inside that json. Is there a way to remove empty values?
<FromGitter> <Blacksmoke16> set it to nil
<frojnd> In which step?
<FromGitter> <Blacksmoke16> https://carc.in/#/r/a5vc
<FromGitter> <Blacksmoke16> or manually define the to_json method to exclude blank values too
<FromGitter> <watzon> Man I could really use Int128 support in the parser
<frojnd> @BlackSmoke16 great, thank you
<FromGitter> <watzon> @o5r I don’t believe the current libssh bindings will help you much, but you can always add new bindings. Just reopen the lib definition, add the types and functions you need, and then wrap them in a more user friendly Crystal interface
<o5r> watzon: Thanks, I'll poke in that direction
<FromGitter> <watzon> No problem. Crystal has one of the better C ABIs that I've ever seen, so it shouldn't be too difficult
<o5r> Yeah, C is more of a problem for me. I've been woefully insulated from that universe. from what I can gather from the man pages, libssh2 seems to be much more about clients than about servers. If at all about servers.
<straight-shoota> libssh2 is client only
oddp has quit [Quit: quit]
_ht has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
<hightower2> Hey how do I resolve this type of issue? https://carc.in/#/r/a5wd
<straight-shoota> probably the best solution is to make the ivar nilable (`getter!` macro)
<straight-shoota> there are also ways to convince the compiler to accept it
<straight-shoota> for example using uninitialized
<hightower2> muy bien, thanks
<FromGitter> <leighmcculloch> Is https://crystal-lang-tools.github.io a recommend place to get extensions for Crystal?
<hightower2> search on https://shards.info
<FromGitter> <rukkiddo> when I try ⏎ curl -sSL https://dist.crystal-lang.org/apt/setup.sh | bash ⏎ I get ⏎ W: GPG error: https://dist.crystal-lang.org/apt crystal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY *** ⏎ E: The repository 'https://dist.crystal-lang.org/apt crystal InRelease' is not signed. ... [https://gitter.im
<FromGitter> ... /crystal-lang/crystal?at=5fe3d0cece40bd3cdbfbab13]
<FromGitter> <Blacksmoke16> could maybe try the manual steps in the install docs
<FromGitter> <rukkiddo> currently all I really have a bad experience with crystal and crystal based frameworks
<FromGitter> <rukkiddo> am I doing things wrong, or I have bad luck
<FromGitter> <rukkiddo> or maybe, just maybe things are not up to date these days
<FromGitter> <straight-shoota> @Blacksmoke16 the keyserver has been switched to keybase.io
<FromGitter> <straight-shoota> so that should really be working
<FromGitter> <Blacksmoke16> yea, dist script is using https://keybase.io/crystal/pgp_keys.asc
<FromGitter> <straight-shoota> But yeah, I get the same error
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <Blacksmoke16> i dont have any apt based OSs to try
<FromGitter> <Blacksmoke16> i dont suppose they key expired or something?
<FromGitter> <straight-shoota> mom, it was because gnupg2 was missing
<FromGitter> <straight-shoota> maybe that's the solution for you too @rukkiddo
<FromGitter> <straight-shoota> does ` curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -` work for you?
<raz> blacksmoke16: http://ix.io/2Jke/
<raz> i think the call()-signature is probably wrong?
<FromGitter> <Blacksmoke16> you're subscribed to the `Terminate` event but the call method is typed to the `Request` event
<FromGitter> <Blacksmoke16> where does `created_at` come from?
<raz> i'm patching that in earlier, that part works
<raz> i just can't figure out how to bind to Terminate properly ;)
<FromGitter> <Blacksmoke16> wouldnt it be easier to do something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fe3d51eac9d8e7463ca8b46]
<FromGitter> <Blacksmoke16> er `Time.monotonic - self.start_time`
<raz> ohhh, yup, that looks nice!
<raz> didn't know it can be done that way
* raz tries it out
<FromGitter> <Blacksmoke16> just be sure to make it a class
<FromGitter> <Blacksmoke16> but yes, each listener instance is specific to each request so you can store state between the events
<FromGitter> <Blacksmoke16> assuming its a class, otherwise the pass by value thing gets you
<raz> yup, works!
* raz likes it
<raz> looks like i have to monkey patch Athena::Routing::Listeners::Routing tho, to get rid of the "Matching" line
* raz would suggest to move that to log-level debug, but obv just a cosmetic thing
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <Blacksmoke16> the default log thing?
<raz> yup
<FromGitter> <Blacksmoke16> cant just play with the sources?
<FromGitter> <Blacksmoke16> like exclude `athena.routing`
<FromGitter> <Blacksmoke16> i should prob make that `Log.` given thats the more standard name...
<raz> ah right, guess i could. but doesn't feel like a nice thing to ask from the user
<raz> (raises questions like what other potentially interesting messages might i lose etc.)
<FromGitter> <Blacksmoke16> yea fair point, all the exception ones
<raz> yup but anyway, logging is not a 0.13 prio i think. can wait till 0.15 :P
<FromGitter> <Blacksmoke16> is tricky because every user prob wants something diff
<raz> yeh, ideally the default should just be easy and straightforward to change
<FromGitter> <Blacksmoke16> prob could move it to a protected method, like i did for https://github.com/athena-framework/athena/blob/master/src/listeners/error_listener.cr#L55
<raz> yup i saw that, and monkey-patched it
<FromGitter> <Blacksmoke16> πŸ‘ thats how it was designed ha
<raz> yup, but feels a bit out of place. i mean, isn't that what all the fancy event-handling is for :p
<raz> so stuff can be overridden w/o patching
<FromGitter> <Blacksmoke16> my original thought was you could like extend the listener, alias it, and then define the method to do it
<FromGitter> <Blacksmoke16> but went with monkey patch approach as the was more ruby like and easier
<FromGitter> <Blacksmoke16> :shrug: