Live data from Hacker News

Show HN: Search code in GitHub repos using regular expressions

grep.app

151–160 of 165 posts

Re: Show HN: Search code in GitHub repos using regular expressions

#152
post #147

Earlier quoted context omitted.

If OP's goal was to get a job at Github, I'd say this was very well played.

It would certainly be an expensive play. When he mentioned a 20 core system, I'm assuming it is some VM system, since I don't know of any 20 core CPUs. I'm guessing he is using DigitalOcean and he has two of them, so he is looking at $1000 a month in hosting cost.

It's an expensive side project for sure, but it doesn't have to be anywhere near as expensive as that.

My own side project uses a server with 20 cores (2x E5-2690v2 CPUs), with 256GB RAM and a 2TB SSD. This is a dedicated server I rented from tier.net in Texas, after seeing it listed on webhostingtalk [1]. It costs about $160/mo, and that's recently fallen further by paying for 3 months up front.

1. https://www.webhostingtalk.com/forumdisplay.php?f=36

Re: Show HN: Search code in GitHub repos using regular expressions

#155

Earlier quoted context omitted.

pattern is, btw: (teakettle\w|abcd) Either pattern in alternation works fine, but even a simple alternation of the two goes back to the behavior that you might expect to get from awful patterns like \d..\d..\w...\s...\d (i.e. reporting only a partial set of matches).

Did you mean either patter in "isolation"?

Yup, you're right - I wound up saying the opposite of what I meant!

Re: Show HN: Search code in GitHub repos using regular expressions

#158
post #43

I still miss Google Code Search, which was a great way to find examples of anything I wanted to learn about in programming and usually answered my questions better than anything else, including Stack Overflow. Has it really been 8 years... https://news.ycombinator.com/item?id=3112029 If this tool can fill that hole in my world, I'll be stoked. I've bookmarked it.

Google code search still exists as long as you want to search Chromium source code.

[1]: https://cs.chromium.org/

Re: Show HN: Search code in GitHub repos using regular expressions

#159
post #43

I still miss Google Code Search, which was a great way to find examples of anything I wanted to learn about in programming and usually answered my questions better than anything else, including Stack Overflow. Has it really been 8 years... https://news.ycombinator.com/item?id=3112029 If this tool can fill that hole in my world, I'll be stoked. I've bookmarked it.

Google code search still exists as long as you want to search Chromium source code. [1]: https://cs.chromium.org/

The main difference it has IMO is it indexes a symbolic code graph extracted from halfway through the compilation process. That means when you search, it knows which functions are frequently called. For example, the LOG() macro is defined in hundreds of places, but the one in logging.h is the one everyone calls, so that's the one that comes top of the results.

It also keeps track of back references, so you can search "who calls any function in this file", which is very hard to do with any other search system.

Major disadvantages are it only indexes one build config, so if you're debugging android code in a multi-platform project and the indexing was done on the windows version, you won't find much (apart from dumb text based search which it does in addition).

The difficulty of compiling every project to build a decent index would make this approach hard on a GitHub scale - all it takes is one missing header file from a dependency not in the repo and the build fails and the whole project can't be indexed. Also, have fun with things like JavaScript which are so dynamic you have to solve the halting problem to know which bit of code calls which other.

Re: Show HN: Search code in GitHub repos using regular expressions

#160
Amazing feat!

Something I found when testing the regexp: the highlights seem to be off sometimes. When grepping for '' (sorry, just the first thing that came to mind to try out the regexp), the second highlight in the first result seems to be in the wrong location:

https://grep.app/search?q=%3C.%2A%3F%40gmail.com%3E&regexp=t...

https://imgur.com/a/VyUXhcF

Post reply on HN