170 karma · joined Jul 10, 2010 (16y ago) · 88 submissions
comment 1y ago · link · parent
My script doesn't try to shuffle code around, which has the advantage that if you are familiar with the general structure of the code, the documentation follows the same structure. (This may not be the best order to explain the theory of the program, as is noted in several introductions to literate programming).
Instead of code blocks, my little shell script has a per-line approach, where each code line is preceded by the name of the file to which it is extracted. This approach allows me to name a variant immediately after the filename, so that I can code alternative lines, and decide at the time of extraction which sets of lines to use. This is also useful for extracting multiple very similar files from a single markdown source. This use of variants has been very effective in supporting alternative implementations, since I can quickly switch between them by the list of variants I give the tool to extract.
comment 8y ago · link · parent
https://github.com/catenate/notabene
I've found that I'm comfortable with the eventual consistency this offers, in exchange for fast lookups when I want something (as opposed to indexing first, and/or indexing globally, and so waiting for indexing to get a result). This distributed-file approach also allows me to add tags to a variety of files: local files, or networked file-system files, or sshfs-mounted files, or Dropboxed files, or files under version control, or files with varying text formats; and find tags across all of them and across all the time I've been indexing.
It runs in linear time with respect to the number of tags I've entered, plus the time to read and process the global index, so obviously there are many ways I could improve the time performance (as an easy example, I could permute the index to list all the tags in alphabetical order, and next to each tag list the files that contain that tag).
I also wrote other tools, since the layout is so simple: for example, "nbdoc", to catenate the actual contents of the references returned by the primary tool (nb); and "so" (second-order), to return all the tags which appear in any nb line with the given tag(s).
I've also found that it's not easy for me to remember what tags I might have used in the past, or how I was thinking about something, so I try to use the conjuction of several tags to narrow down search results, rather than try to remember one specific tag (this seems to correspond to the observation that it can be difficult to remember exactly where in a hierarchy you put something).
The modular approach, of per-directory indexes referenced in a global file, also makes it easy for me to combine work-specific notes, with public notes, with private notes, all in the same global index file, at work; but only have the same public and private notes at home.
comment 10y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
Find and delete standard list of files which credo generates, and derived objects which are targets of *.do scripts:
> cre/rm std
Customize a library template shell script to become the file hello.do, which defines what to do to make hello from hello.c:
> cre/libdo (c cc c '') hello
Run the current build graph to create hello:
> cre/do hello
Obviously this particular translation is already baked into make, so isn't anything new, but the approach of pulling templated transitions from a library by name scales well to very custom transitions created by one person or team and consumed at build-construction-time by another.
Also see other test cases at https://github.com/catenate/credo/tree/master/test/1/credo and a library of transitions at https://github.com/catenate/credo/tree/master/lib/do/sh-infe...
I think this approach reduces the complexity of the build system by separating the definition of the file translations from the construction of a custom build system. These primitives abstract constructing the dependency graph and production rules, so I think it's also simpler to use. Driving the build system construction from the shell also enables all the variability in that build system that you want without generating build-description files, which I think is new, and also simpler to use than current build-tool approaches. Whether all-DSL (eg make), document-driven (eg ant), or embedded DSL (eg scons), build tools usually force you to write or generate complicated build description files which do not scale well.
Credo is also inspired by redo, but runs in Inferno, which is even more infrequently used than Go (and developed by some of the same people). I used Inferno because I work in it daily, and wanted to take advantage of some of the features of the OS, that Linux and bash don't have. Just today I ran into a potential user that was turned off by the Inferno requirement, so I'll probably have to port it to Linux/bash, and lose some of those features (eg, /env), to validate its usability in a context other than my own.
EDIT: Replaced old way, to call script to find and delete standard derived objects, with newer command.
comment 12y ago · link · parent
https://github.com/catenate/credo
(I don't like how makefiles have so many features that reimplement what you can do in the shell. I also don't care for big languages with build-tool DSLs--though you could say credo is a build-tool DSL for the shell, like git is a version-control DSL for the shell. With only language directives, no constructs.)
I wrote it in the Inferno shell to take advantage of some nice OS features and its cleaner shell language. One of these days I should port it to bash, so other people might use it.
comment 12y ago · link · parent
comment 12y ago · link · parent
I think the biggest difference between Plan 9 and Unix is that Plan 9 rids systems programming of many special cases by reusing the filesystem metaphor as far as possible. This is a deep and pervasive change, and makes doing most things on the system just a matter of reading and writing to files. This leads to neat things like the /env filesystem, which is a per-process view of the contents of shell variables as files. (This makes it easy to write make (mk) rules that depend on shell variables, just by listing the files/variables as prerequisites.)
Inferno's biggest difference is that it runs the entire OS on a virtual machine called emu. Kind of like Java, but not just a language. (Inferno has a language too, called Limbo, which is closer to Go than C.)
comment 13y ago · link · parent
comment 13y ago · link · parent
comment 13y ago · link · parent
I spent time programming because I didn't have a modem. It turns out this was the best thing for me, since I didn't waste my time on BBSes. A friend of mine who had, dropped out of the CS program at Penn State after a digital logic course I loved.
In high school I took a year and a half of Basic and Pascal, but more importantly spent three periods a day in the computer lab exploring every nook and cranny of programs I had to write, programs I wanted to write, and the shell language of the school district's VAX.
Seemed clear to me that I wanted to do computer science, but I switched to computer engineering after that digital logic course. Took college classes in Pascal, C, C++, assembly for microprocessors, common lisp for ai, vhdl for processor design, operating systems, and wire-wrapping a microcontroller system.
Grad school courses in Smalltalk [edit: and computer architecture and petri nets and, most importantly, self-taught makefiles for a class project build system].
After I got out of school I took company courses in Java and Perl, but more importantly taught myself the Unix environment from books, and had opportunities to use it every day at work.
On my own, I read books and did programming exercises in Haskell, Ruby, and Go.
[edit: I dug seriously into make and bash for ten years, writing the build system for a telecom network.]
I have a real passion for functional parallel programming in the Inferno shell, so I'm working on a blue-sky build-tool project. [edit: https://github.com/catenate/credo]
On my job I'm now picking up Python because I have to maintain a build system code base in it.
Overall, I'd say I've probably taught myself more than been taught, but only because I had about 8 years of formal instruction in a programming span of 30 years. The education was essential though, because there were so many concepts I would not have gotten to on my own.
comment 13y ago · link · parent
Thanks to HTML, however, you wouldn't know this text, for example, had lines about 72 characters,¹ was carefully hand-justified after fmt(1) to leave no dangling words alone on a line before or after punctuation,² and had double spaces after all periods inside paragraphs, except T and S in T. S. Eliot.
¹ Except the first paragraph, better broken at “letters”, “editor”, and “it”, and this footnote, also broken after “editor”.
² Though I would rather do that than visit violence upon decent sentences, like this one, broke at “sentences”. Obviously it's preferable to expand and contract margins a bit to suit the text. Nobody does this any more though, because auto-sizing to columns destroys manual formatting.³
³ Incidentally, these footnotes had to be separate paragraphs, to keep them from merging with the previous one, and with the body paragraphs. What a piece of work is HTML… it delights not me.
Here is this comment before the autoformatter got to it. https://gist.github.com/catenate/6567903
comment 13y ago · link · parent
comment 13y ago · link · parent
Let's pretend you build a bridge out of this material. Could the direction of force you'd need to apply to dissemble it capable of being generated by an earthquake, or by harmonic oscillation of winds (eg Tacoma Narrows)? It would be tragic to see a bridge with cars on it dissolve into cubes like the spaceship in Super 8.
comment 13y ago · link · parent
The best difference I've seen between "programming" and "scripting" is Knuth v McIlroy, summarized here. http://www.leancrew.com/all-this/2011/12/more-shell-less-egg...
comment 13y ago · link · parent
comment 13y ago · link · parent
comment 13y ago · link · parent
Further, I'd like a phone whose processing power is devoted to Android apps I choose, rather than carrier's undeleteable bloatware. I was hoping for something like a Nexus 5 this year, since the Nexus 4 seemed to have these traits.
I worry that the Moto X would replace a Nexus 5 in their roadmap, and that their desire to compete with the S4 will lead them to mimic it instead of having the kind of product I'd like.
So I see Google focusing so much effort on a Moto phone as a problem for me and what I want, not something to look forward to. Google once had the product I should have bought (Nexus 4), especially at that much lower price point.
I don't believe that Moto is any different now, because I haven't seen them implement better policies. From my POV, the burden of proof is on them to demonstrate they changed, since they decided to screw over me, and everyone else with a Photon. I don't need to give them any more money, unless they are obviously the very best phone available for me, and my wants aren't what people or the carriers apparently want.
comment 13y ago · link · parent
comment 13y ago · link · parent
https://news.ycombinator.com/item?id=5566567
In addition, I wrote a generic tag-indexing tool (in Plan 9's rc and Inferno's sh) to find random bits of information (including commands) without caring where they live in my file hierarchy.
https://github.com/catenate/notabene
http://swtools.wordpress.com/2010/03/05/nb%E2%80%94search-an...