Living with a new Parser for a year

Hi folks! Today’s post is a retrospective. I would like to gather some thoughts about living with the new parser that I wrote for JsonPath. After a little over a year, some interesting problems surfaced that I thought I’d share for people who also would like to endeavor on this path. Let’s begin. Previously About, two years ago, I took over managing / fixing / improving this ruby gem: Json Parser. It’s a json parser in ruby. Amongst other problems, it used eval in the background to evaluate expressions. It was a security risk to use this gem to its full extent. Something had to be done about that. ...

April 12, 2019 · 8 min · hannibal

Keep your git forks updated all the time

Hi folks. Today’s is a quick tip for keeping your forks updated. If you are like me, and have at least a 100 forks in your repository because: * You would like to contribute at some point * Save it for yourself because you are afraid that it disappears * Would like to make modifications for your own benefit * Whatever the reason …then you probably have a lot of trouble keeping them updated and making sure you always see the latest change. ...

June 8, 2018 · 2 min · hannibal

Replacing Eval with Object.send and a self written Parser

Intro A while ago, I was added as a curator for a Gem called JsonPath. It’s a small but very useful and brilliant gem. It had a couple of problems which I fixed, but the hardest to eliminate proved to be a series of evals throughout the code. You could opt in using eval with a constructor parameter, but generally, it was considered to be unsafe. Thus, normally when a project was using it, like Huginn they had to opt out by default, thus missing out on sweet parsing like this: $..book[?(@['price'] > 20)]. ...

May 28, 2017 · 7 min · hannibal

RScrap scraper

Intro Hey folks. So, there is this project called Huginn which I absolutely love. But the thing is, that for a couple of scrappers ( at least for me ), I don’t want to spin up a whole rails app. Hence, I’ve come up with RScrap. Which is a bunch of Ruby scripts run as cron jobs on a raspberry pi. And because I dislike emails as well, and most of the time, I don’t read them, I opted for a nicer solution. Enter the world of Telegram. They provide you with the ability to create bots. You basically get an API key, and than using that key, you can send private messages, or even create an interactive bot which you can send messages too. ...

October 6, 2016 · 4 min · hannibal

Ruby Sieve

Though it could be done better, I’m sure, but I’m actually pretty satisfied with this one. It loops only twice as opposed to filtered ranges and whatnot other solutions to the sieve. I was thinking of rather creating a list and deleting elements from it, but that’s already three loops. Maybe I’ll do a benchmark later on more solutions. # Sieve contains a function to return a set of primes class Sieve def initialize(n) @n = n end # Returns a list of primes up to a certain limit # @param n limit # @return list of primes def primes marked = [] primes = [] (2..@n).each do |e| unless marked.include?(e) primes.push e (e..@n).step(e) { |s| marked.push s } end end primes end end Cheers, Gergely. ...

July 12, 2016 · 1 min · hannibal