12 ms·
A Git Implementation in Awk
- aasasd 5y agoApparently astrologers declared this the year of Git implementations. Production of Git implementations has increased five-fold.
- amznbyebyebye 5y agoAstrologers you say.. But is no one going to talk about how mercury retrograde wiped out Facebook ..?
- dudus 5y agoMy mother in law who's into this sort of stuff warned me a few days before the Facebook blackout about this. Her exact words were "Mercury is in retrograde and that is bad news for technology" i just brushed it off and a couple days later Facebook had the worst outage of its history. Gave me chills. But not enough to change my sceptic ways (again her words)
- psd1 5y agoMercury retrograde happens every few months and lasts three weeks. And it's also "bad news" for travel, change, decisions, activity... I'd get chills too, tbf, but your MIL's gnostic pronouncement is total foofoo
- srvmshr 5y ago> Astrologers you say.. But is no one going to talk about how mercury retrograde wiped out Facebook ..? For a fact, Facebook engineering uses mercurial instead of git in their tooling. They are going to do some 'hg rebase' whenever the stars are out of alignment =)
- eesmith 5y agoNitpicking. :) I know about 'shit' (== Shell Git) at https://git.sr.ht/~sircmpwn/shit https://git.sr.ht/~sircmpwn/shit from last year. https://en.wikipedia.org/wiki/Git#Implementations https://en.wikipedia.org/wiki/Git#Implementations lists JGit (<=2012), Go-git (2015), Dulwich (2008), libgit2 (<=2010), and JS-Git (<=2013). A five-fold increase means at least 30 new implementations. :)
- aasasd 5y agoProduction is the rate, per year.
- eesmith 5y agoIs it? Well, given last year's 'shit', there should be another four this year, yes?
- emptyparadise 5y agoI really want to see a C compiler written in shell.
- asdff 5y agohttps://github.com/otakuto/bashcc https://github.com/otakuto/bashcc
- mypalmike 5y agoNow can we unsee it?
- mmcdermott 5y agoIt isn't a good idea for a production system or anything, but the code itself seems pretty clean. I've seen infinitely worse bash scripts than this compiler.
- 5y ago
- selrond 5y agohaha love the subtle Heroes of Might and Magic reference
- Klaster_1 5y agoAmong the russian-speaking IT crowd, the "astrologers declared a week of X" joke is quite widespread, even overdone.
- potta_coffee 5y agoIs HOMM popular with the Russian speaking IT crowd? HOMM2/3 are my favorite games ever.
- Klaster_1 5y agoHoMM3 has a cult following among lots of 25-45 years old males. During recent elections, one of candidates mentioned that he enjoys playing HoMM3 a lot, comments under the video were like 80% "I'll vote for anyone who plays HoMM3" and alike.
- aasasd 5y agoIn the 2000s they were among the go-to strategy games. The hot-seat mode probably helped. Of course, the publishers and devs saw little profit from all that following—unlike middle-aged dudes selling pirate CDs in mall stands. HOMM 5 was developed by Nival, a major Russian dev and publisher at that time—though the 4 and 5 games weren't as famed, afaik.
- aasasd 5y agoYeah, I fucking love subtlety. Tons of it.
- asdff 5y agosomeone needs to make a script that can scrape tweets/medium articles and predict what the next hot pet project will be. you could have your git implementation out and on your resume six months before the rush with a system like this.
- billpg 5y agoIf you'll excuse me, I'm going to implement GIT in 6502 assembler.
- Drakim 5y agoFinally version control for Famicom BASIC, it was about time.
- aasasd 5y agoBack in the days of yore, I briefly borrowed this Chinese import thing: https://74.img.avito.st/640x480/1870138674.jpg https://74.img.avito.st/640x480/1870138674.jpg — which both could play cartridges and had Basic, with absolutely unlicensed Mario sprites in the mem. But never connected the dots that there was an official thing like that, even though vaguely heard of the Famicom brand's various forays into neighboring markets of the day.
- bitwize 5y agoYes, the Famicom had Family BASIC (it was a Family Computer after all!), an official Nintendo release only in Japan. What you had on your Subor was probably a totally unlicensed copy of Family BASIC, as that program did come with Mario and Donkey Kong assets to play with.
- marton78 5y agoAfterwards follow up with PROLOG and Brainfuck, please.
- lelandfe 5y agoGetting started on a malbolge implementation, check back in approximately 1000 years.
- KineticLensman 5y ago> Getting started on a malbolge implementation, check back in approximately 1000 years. This could be an appropriate software challenge for the Long Now Foundation [0], when they have finished that clock. [0] https://longnow.org/clock/ https://longnow.org/clock/
- dwheeler 5y agoTechnically this isn't quite compatible, because it uses a different hash algorithm. git as of v2.13.0 uses a hardened sha-1 algorithm to counter the shattered attack. In normal Cases you won't see the difference.
- veltas 5y agoThe only really horrid thing about awk is the way you declare local variables in a function ... by just adding more parameters (and letting them be default-initialised on calls). Otherwise it can act like a relatively conventional scripting language, aware of associative arrays (ahead of its time).
- OskarS 5y agoI have really warm feelings about AWK, actually! It’s such a simple language that you can learn pretty much all of it in an afternoon, but it is still expressive enough to be really useful as a text processing language. I have an AWK script that turns my CSV bank statements into Ledger transactions, and AWK is just perfect for that kind of thing.
- kmarc 5y agoLOL that's what I do too. A bit of pdf2txt, awk and some shell scripting, and budgeting becomes very easy...
- veltas 5y agoDidn't mean to sound negative about it, I love awk too. It is definitely small enough to learn in a day (or two), and it fills a niche people don't realise they have.
- hkt 5y agoCan you share? I've been thinking of doing the same and would love to see some prior art.
- asdff 5y agobe wary that the initial parsing is probably going to be bespoke for your bank account csv export format. my own bank doesn't even share consistency in these exported csvs between the checking, savings, and the credit card I have with them.
- jrochkind1 5y ago
- p4bl0 5y agoWe are used to see awk very condensed one-liner, so the code in the repository is surprisingly readable. This makes it a fun project which can be used to learn a lot about both awk and git. Nice!
- known 5y agoAll exotic things we can do in AWK https://rosettacode.org/wiki/Hello_world/Web_server#AWK https://rosettacode.org/wiki/Hello_world/Web_server#AWK
- bewuethr 5y agoNamespaces (GNU Awk 5.0+) make Awk pretty well suited for larger projects (as demonstrated by aho), but it never quite took off; this article (by the author of GoAwk[1]) is a nice look at the relevance of Awk in 2020: https://lwn.net/Articles/820829/ https://lwn.net/Articles/820829/ [1]: https://github.com/benhoyt/goawk https://github.com/benhoyt/goawk
- anthk 5y agoDo not use AWK for that. Perl is best suited for that, literally. It was born as a better version of AWK. AWK is for tools less than 20 lines long. Anything more, use Perl, please.
- neilsimp1 5y agoYeah, but you gotta admit, this is cool. It may not be the most practical or useful thing, but it is cool that someone made Git in AWK.
- anthk 5y agoYeah, an a Z-machine (v3) in PostScript, but I woudn't write an IF interpreter in AWK.
- gompertz 5y agoPerhaps; but Awk is such a compact approach. My head feels cleaner when using it compared to Perl - perhaps as it's fairly close to C. The interpreter is a single binary on practically any OS, and is usually around 5MB in size. It's installed by default on essentially every OS (aside from Windows, which is an easy single exe download). Also with implementations like Mawk, it will destroy Perl in speed.
- anthk 5y agoAWK would work greatly well on plan9/9front, as most programs are short and really compact. On "big" Unixen (and I am an OpenBSD/Void user), for larger tools, Perl is preferred. On speed, that doesn't matter. Perl under OpenBSD has a pledge/unveil module, and it's used to write the package manager. Problem solved.
- jhbadger 5y agoIt's a pity that this apparently needs gawk. If it could run in the awk included in busybox/toybox it could actually be useful in tiny installations.
- ducktective 5y agoHow would it be useful? Can anyone show me a non-SBC embedded system in which busybox/toybox are relevant?
- jhbadger 5y agoBut developing on SBCs is exactly the use case!
- ducktective 5y agoIf one is gonna develop on a SBC, he can utilize proper GNU/Unix tools not trimmed-down equivalents from busybox/toybox. In fact, I fail to see a use-case for these tools in embedded space whether on SBCs or not.
- da39a3ee 5y agohttps://github.com/djanderson/aho/blob/8cd5cb737a3296cd3b3fe5da934b60e06cada942/include/commit.awk#L46 https://github.com/djanderson/aho/blob/8cd5cb737a3296cd3b3fe... Wouldn’t it be more in the spirit of awk to write this as editor = config::get("core.editor") || ENVIRON["EDITOR"] || “vi”
- xonix 5y agoBtw, I’m developing an IntelliJ IDEA plugin for Awk: https://github.com/xonixx/intellij-awk https://github.com/xonixx/intellij-awk You can already install it from marketplace.
- deleted 5y ago[deleted]
- elandeholm 5y agoWeird flex(sic) but OK.
- shp0ngle 5y agowait awk has functions?
- abecedarius 5y agoFun fact: early awk did not. The Lisp interpreter in awk which I linked in another comment was from those days and worked entirely as a big nested loop, using no functions besides the built-ins.
- tannhaeuser 5y agoSee also awk-jvm [1], a toy JVM in awk. Though, inexcusably, that one also uses gawkisms rather than awk proper, when portability is the one thing awk has over other mini langs ;) [1]: https://news.ycombinator.com/item?id=23612910 https://news.ycombinator.com/item?id=23612910
- deleted 5y ago[deleted]
- naltun 5y agoI reviewed the aho source code a month ago and was blown away by the quality. It helped me advance my Awk skills.