Prime Number Regex
I was messing around representing integers using binary trees, and noticed that a certain tree format makes it trivial to grep for prime numbers. Probably not very novel, but thought y'all might enjoy it. Here's one through sixteen: * (()()) * ((()())()) * (((()())())()) (((()())())(()())) * ((((()())())())()) ((((()())())())(()())) * ((((()())())(()()))()) ((((()())())(()()))(()())) ((((()())())(()()))((()())())) ((((()())())(()()))(((()())())())) * (((((()())())())())()) (((((()())())())())(()())) * (((((()())())())(()()))()) (((((()())())())(()()))(()()))…
What it does
In the maker’s words, at launch
I was messing around representing integers using binary trees, and noticed that a certain tree format makes it trivial to grep for prime numbers. Probably not very novel, but thought y'all might enjoy it. Here's one through sixteen: * (()()) * ((()())()) * (((()())())()) (((()())())(()())) * ((((()())())())()) ((((()())())())(()())) * ((((()())())(()()))()) ((((()())())(()()))(()())) ((((()())())(()()))((()())())) ((((()())())(()()))(((()())())())) * (((((()())())())())()) (((((()())())())())(()())) * (((((()())())())(()()))()) (((((()())())())(()()))(()())) (((((()())())())(()()))((()())())) (((((()())())())(()()))(((()())())())) I added asterisks in front of the primes. Here's the set of 16-bit ints: https://gist.github.com/cieplak/213fb4c88581d8971b274b7ec647... The regex just checks if the string ends with '())': cat integers.txt | grep '())$' | nl | tail -1
Does the same job
all alternatives →- IWI wrote a book on Python regular expressions2019 · ▲193
My book titled "Python re(gex)?" is free to download through this weekend [1][2] The book covers both 're' and 'regex' modules, has plenty of examples and chapters also have cheatsheets and exercises. Code snippets, exercises, sample chapters, etc are available on GitHub repo [3] I used pandoc+xelatex [4] to generate the pdf. [1] https://gumroad.com/l/py_regex [2] https://leanpub.com/py_regex [3] https://github.com/learnbyexample/py_regular_expressions [4]…
- IWI wrote a book on GNU grep and ripgrep2019 · ▲182
My book on "GNU grep and ripgrep" is free to download today and tomorrow [1][2] Code snippets, example files and sample chapters are available on GitHub [3] The book uses plenty of examples and regular expressions are also covered from scratch. The book is suitable for beginners as well as serves as a reference. Hope you find it useful, I would be grateful for your feedback and suggestions. I used pandoc+xelatex [4] to generate the pdf. [1] https://gumroad.com/l/gnugrep_ripgrep [2] https://leanpub.com/gnugrep_ripgrep [3]…
- GGGrasp – grep Clojure code using clojure.spec regexes2020 · github.com · ▲123



More life & fun this month
the category →- TL
Life & fun · 10d ago · louisabraham.github.io

Photosynthesis fires two of your iPhone
Life & fun · 28d ago · photosynthesis.camera
SoloUno▲310Take control of hair pulling, nail biting & skin picking
Life & fun · 28d ago · solouno.io

Scroll through all 43,252,003,274,489,856,000 reachable Rubik's Cube permutations.
Life & fun · 26d ago · everycube.alen.is


Hi HN, I built Eigendrum, a web tool that solves the 2D wave equation for arbitrary shapes so you can hear what they sound like as drums. How it works: * Solves -∇²u = λu using finite element analysis (Kφ = λMφ) on a triangle mesh. * Validated to <0.1% error against closed-form solutions for circles (Bessel zeros) and rectangles. * Sound model factors in strike location, Rayleigh damping, and mallet width. * Includes Kac drums I & II to demonstrate identical sound spectra from different geometries. * No frameworks, build steps, or dependencies. Repo and tests:…
Life & fun · 26d ago · baselashraf81.github.io
Launched alongside, August 2018
the whole month →- IM
Life & fun · 2018 · bitbucket.org


Create unique illustrations for websites & applications.
Dev tools · 2018 · craftwork.design

- PJ
Dev tools · 2018 · ptsjs.org
- RB
Life & fun · 2018 · tryretool.com