rtluckie + golang   22

knapsack problem, Python & Go : golang
​without that much effort (knapsack problem in Go) and pretty good performance.​Ref.:If you have slow loops in Python, you can fix it…until you can’t via /r/golang
IFTTT  reddit  golang 
7 days ago by rtluckie
Please explain Go context to me like I'm a five year old what are the main benefits? : golang
Hi,I would like to get a better understanding of of using context's in Go:​I know I can use context for deadlines and cancellation fr API's in a Go package but what are the main benefits against using writing own functions in an API for this? Why are context safe for using with multiple goroutines?Any links or resources you can recommend? via /r/golang
IFTTT  reddit  golang 
9 days ago by rtluckie
Single command SSL Reverse Proxy w/ Autogenerated Certificates (LetsEncrypt, self-signed, provided) : golang
Hi everyone,I created a simple single command SSL reverse proxy in Go for fun: https://ift.tt/2QUERpW will autogenerate SSL certs for you if none are provided to it, either using LetsEncrypt (if you specify a domain) or by creating self-signed certificates. I find this useful for jupyter notebooks and other services that I want to slap SSL onto in a pinch--certainly easier than modifying the app directly (if I didn't write it) or dealing with nginx and apache configs.ssl-proxy -from -to -domain=mydomain.com​-Suyash via /r/golang
IFTTT  reddit  golang 
october 2018 by rtluckie
Streaming Regex with io.Reader : golang
I have a small application that scans for credit card numbers on a local system. Because it scans all files on a system regardless of their size, I didn't want to read full files contents into a `[]byte` . My current solution uses a ring buffer and looks at each byte as it is read to see if it matches the pattern. A sort of FSM.This works pretty well but the matching code is so specific to credit card numbers now I'm having trouble extending it to match other types of sensitive data.The easiest approach would be if there were a regex implementation that could take an io.Reader. I've searched and don't think that one exists, but I'd love to know if I missed something.An alternative approach that I considered is to keep using the ring buffer, and then run a regex each time a byte is read. This seems to work OK with https://ift.tt/2MRXgkL since the pastern must always match the first character and it bails out if the first byte doesn't match. This works less well with the regex in the std lib as it runs much slower. Another downside of this approach is that I will need to know a maximum length of input the regex could match in order to configure the ring buffer size. This is less of a problem since most of my patterns will be non-recursive and relatively short.A final approach I considered is to just break the file up into larger chunks to run the full regex against, say 1mb. I would use the reader to fill the buffer and then run the regex against it. I could introduce some overlap of the chunks so fewer matches that span two chunks would be missed.The main reason I'm using a reader is because I'm decompressing files on the fly without having to worry that the decompresses size will fit into memoryIs there a better way of doing this? I like the idea of moving to regex as it makes introducing new patterns much easier but I don't want to introduce false negatives or use significantly more memory. via /r/golang
IFTTT  reddit  golang 
september 2018 by rtluckie

related tags

golang  IFTTT  reddit 

Copy this bookmark: