agr: like ag/ripgrep, but for search and replace. [1] set-opt: ensure settings in conf files in /etc. [2] s4: when i need to do distributed data processing and don’t want to import an apache project. [3] bsv: when i need maximum performance data processing. [4] tinysnitch: for monitoring network connections to/from my laptop. [5] new-gocljs: when i need to start a new fullstack web prototype. [6] cli-aws: when i need…
For agr, have you seen fastmod? https://github.com/facebookincubator/fastmod
Ask HN: Have you created programs for only your personal use?
251–260 of 671 posts
Re: Ask HN: Have you created programs for only your personal use?
#252My main user interface is bash, so every time I want to view a PDF file, launch a web browser, list the files in a directory, or compile a program, I write a program to do it in bash and then hit "enter" to execute it. For example:
arm-linux-gnueabi-gcc-10 -mcpu=cortex-m4 -c -Wa,-adhlns=armpapel.lst -g -Wall -Os mpapel.c
Or: ls /media/compu/E8D3-C6AF/
Or: firefox &
Or: bg
In this way I estimate I create about 32 new programs a day for only my own personal use. But in many cases I only use each one once. ^R makes it easy to use them again a few times, but in other cases I save them into a shell script to make them easier to distribute to other machines, parameterize, and maintain. The one I most often use is probably a user interface for YouTube via youtube-dl or yt-dlp that consists of a few such shell scripts.My main editor is Emacs. If I want to do the same thing repeatedly (e.g., delete a line containing the string .LVL) I create a keyboard macro with F3 and F4 (or C-x ( and C-x )) when I do it once, then run it repeatedly with C-x e. I probably write about 4 programs a day in this way.
Emacs has a M-: command to evaluate Lisp expressions, which are programs. Recent programs I have written in this way include (/ 43.2 1.7), (* 9.3 1.2), and (+ 8 3 2.50 3.50 3 7 3.50 3 1.50 4.50 6 5.50 6.50 6 3 2.50 2.50). Probably I write about 1 program a day in this way but I only use each one once. Longer Lisp programs like this can be written in *scratch* and executed with C-j or in .emacs (or .emacs.d/init.el) and executed with C-x C-e. For example, (global-set-key [f5] 'recompile). I use my .emacs file constantly every day but probably only add something to it about once a month. An outdated version is at https://github.com/kragen/kragen-.emacs.d/blob/master/init.e....
Sometimes I write bigger programs for my own personal use too.
A few years ago I wrote https://github.com/kragen/pytebeat for a livecoding performance of bytebeat in a bar. I finished writing it in the train on the way to the bar.
In https://github.com/kragen/laserboot I wrote a simple parametric 2-D CAD system for laser cutters in PostScript.
For Dercuano http://canonical.org/~kragen/dercuano I wrote a kind of shitty HTML rendering engine that generates a PDF file, as well as a simple CMS for generating a tree of HTML files from a directory of Markdown.
The other night I wrote a bytecode interpreter with a graphical display in C as a sort of mockup for the operating system of a small computer I recently got the parts for; it's in http://canonical.org/~kragen/sw/erika.git.
I've also written compilers, interpreters, ray tracers, database engines, parser generators, graphics libraries, logic circuit optimizers, 2-D game engines, etc., for my own use.
Some of the recent ones are in http://canonical.org/~kragen/sw/dev3. Over the last 9 years, according to a shell script I just wrote, it has accumulated 170 C programs, 254 Python programs, 60 HTML files (mostly JS with a thin shell of JS), 43 Jupyter notebooks, 28 files in assembly language (though some of these are compiler output), 23 programs in OCaml, 17 programs in Golang, 15 programs in Rust, 14 programs in OpenSCAD, 11 standalone JS files, 9 programs in PostScript, 6 programs in Perl, 9 programs in C++, 7 programs in Scheme, 5 programs in Meta5ix, 5 programs in Java, 5 programs in Lua, 5 programs in Forth, a program in Prolog, and a lot of etc. That's 688 programs in all, according to a program I just wrote in the browser console, which is 69 per year or one every 5.3 days. However, there's probably some double-counting there, or counting of things I started but didn't finish, or things like the copy of D3 I checked in there, and the real number might be more like one every two weeks.
Some of the larger ones are https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/fir-v..., which is a vocoder; http://canonical.org/~kragen/sw/dev3/ritmo.c, a stochastic wavetable synth for an Arduino; and http://canonical.org/~kragen/sw/dev3/qfitzah.s, an interpreter for a higher-order programming language with pattern matching, flexible parametrically-polymorphic data containers, and dynamically dispatched method calls with multiple dispatch, that assembles to an executable under 1K. Some other random ones are http://canonical.org/~kragen/sw/dev3/dnsscan.py, which scans random IP addresses for open DNS servers; http://canonical.org/~kragen/sw/dev3/andnot.go, which tests the behavior of the Golang &^ operator; http://canonical.org/~kragen/sw/dev3/weemenumain.cc, which is a test program for a C++ library for an imgui-style menu system I wrote for microcontrollers that only uses a few bytes of RAM; and http://canonical.org/~kragen/sw/dev3/rpncalc.c, a four-function RPN calculator program.
But, like I said, there's nearly 700 of these, and more in http://canonical.org/~kragen/sw/aspmisc, http://canonical.org/~kragen/sw/inexorable-misc, http://canonical.org/~kragen/sw/netbook-misc-devel, and the kragen-hacks archives, so I'm not going to try to describe them all here. They're all git cloneable except kragen-hacks.
Re: Ask HN: Have you created programs for only your personal use?
#253Hundreds! Doesn't everyone? Most of them are just bash scripts, many of which have now reached a complexity so high that I wish I'd started writing them in a different language but it's too late now. The majority of the rest are Python. Off the top of my head, the most used ones are: * A replacement front-end for "tar" and various compressors * A script to synchronize my music library to a compressed version for play…
> A secure-but-readable password generator I love pronounceable passwords, but there's research indicating that such generators typically produce lower than expected entropy. Do you mind sharing what algorithm you use?
Re: Ask HN: Have you created programs for only your personal use?
#254Earlier quoted context omitted.
I think the generator from xkcd sounds pretty good. https://xkcd.com/936/
Problem is so many websites have these arbitrarily low password lengths that usually max out at 20 characters.
Re: Ask HN: Have you created programs for only your personal use?
#255Tracking Finances I originally wrote a web app to track my finances in 2003 using classic ASP and T-SQL. In early 2017, I rewrote it from scratch, still using T-SQL, but with C#.NET and jQuery. Lets me review my budget, ensure my net worth is heading in the direction I want, make sure all my payments get made, and ensure my account balances never get too low (with a light forecasting element.) Ideally I'd open source…
How do you ingest the transactions? I’d love to be able to replace Mint!
(I use placeholders with schedules to ease my burden, but ultimately I track every transaction manually.)
Re: Ask HN: Have you created programs for only your personal use?
#256Earlier quoted context omitted.
> A secure-but-readable password generator I love pronounceable passwords, but there's research indicating that such generators typically produce lower than expected entropy. Do you mind sharing what algorithm you use?
Not OP, but I prefer memorable passwords, thus, correct-battery-horse-staple style passwords in bash: (Install cracklib, or any dict file) #!/bin/bash pickaword() { WORDFREQFILE=/usr/share/dict/cracklib-small; WORDLENGTH=$1; awk -v wordlength="$WORDLENGTH" 'length($1) == wordlength {print $1}' "$WORDFREQFILE"|shuf|head -n 1; } [[ ! -z $1 ]] && numWords=$1 || numWords=4 separator="-" count=0 currentWord="" while [[ $c…
Modulo operations like these are another thing to avoid. To get equal chances for each word, the simplest thing to do is e.g.
do
wordlistlength = 10e3
randomnumber = os.urandom(1) * 256 + os.urandom(1)
while randomnumber > wordlistlength
return wordlist[randomnumber]
(Adjust if your list length is greater than 255×256+256, of course.)Further, I see that cracklib-small is 52k words. That's not good or bad, but it makes the default 4-word phrase 52e3⁴ ~ 63 bits of entropy, which isn't terrible but in my opinion on the short side as a default. It will be perfectly fine if you only ever want to defend against online attacks, but in some cases (think disk encryption or password manager) offline cracking should be kept in mind and for the rest you should usually use a password manager anyhow (so then memorability doesn't matter).
Or perhaps more succinctly: please don't roll your own crypto.
I understand that this is of course very unlikely to be abused if it's just for yourself and nobody knows of this weakness in your credentials (security through obscurity works... until it doesn't), but one day someone will use this as inspiration or it will spread somehow, say through an HN comment... just use good password generators or at least keep insecure ones secret.
Btw: many standard Debian(-based) installations have /usr/share/dict/words available so you don't need an extra install; I haven't seen cracklib used before but that might just be me.
Re: Ask HN: Have you created programs for only your personal use?
#257Another useful one was an Alexa skill to pick which kid at random had to do something (like get their shower first). Leaving it up to chance felt fair in a way that “JFC, it doesn’t actually matter!” didn’t.
Re: Ask HN: Have you created programs for only your personal use?
#258Yes, for over 30 years. I could never list them all. Nearly every thought I have becomes a program. I've written x86 asm game hacks (DOS era), 2D tile games (80's), Windows MIDI composers, game frame languages, ray-tracing renderers, OpenGL visualization, PID controllers, camera controllers, video controllers, circuit simulators, flight controllers, so so so many games, scripts for analyzing data, scripts for scraping websites, ODBC readers for my cars, FM synths, game solvers, and that's just stuff in C, not even getting started with the bazillion websites.
Over decades, programming becomes such a part of your life, that it is simply the way you move about the world, and think about it.
Re: Ask HN: Have you created programs for only your personal use?
#259Earlier quoted context omitted.
I gave up on readable. with open('/dev/urandom', 'rb') as f: return base64.urlsafe_b64encode(f.read(12))
alias genpwd="tr -dc 'a-zA-Z0-9!@#$%*()[]{}' < /dev/urandom | fold -w 16 | head -n 1 | xclip -sel clip"
(Then again, you were proposing an alias, so then command complexity/memorability doesn't really matter.)Security level: log((26+26+10)¹⁶)/log(2) ~ 2⁹⁵ (95 bits of entropy), comparable with adding those 12 extra symbols: log((26+26+10+12)¹⁶)/log(2) ~ 2⁹⁹. (Adding a character makes more sense than adding a symbol if you want more security, all else being equal of course.) If a stupid application still has outdated password requirements (thankfully this is rare among the applications I use) then one can of course add the classic ! at the end.