From 7115b71c353c004dbfe70a0d96012a2213e77405 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 28 Feb 2016 07:12:18 -0500 Subject: whitespace cleanup --- public/arch-systemd.md | 44 +++---- public/bash-arrays.md | 2 +- public/emacs-shells.md | 4 +- public/fd_printf.md | 3 +- public/fs-licensing-explanation.md | 2 +- public/java-segfault-redux.md | 2 +- public/java-segfault.md | 4 +- public/pacman-overview.md | 4 +- public/rails-improvements.md | 2 +- public/what-im-working-on-fall-2014.md | 2 +- public/x11-systemd.md | 210 ++++++++++++++++----------------- 11 files changed, 138 insertions(+), 141 deletions(-) diff --git a/public/arch-systemd.md b/public/arch-systemd.md index 3ada087..7f6de00 100644 --- a/public/arch-systemd.md +++ b/public/arch-systemd.md @@ -34,27 +34,27 @@ there is compatibility for the variables that used to be there, but that is going away. [^1]: - *I* don't think it's bloated, but that is the criticism. - Basically, I discount any argument that uses "bloated" without - backing it up. I was trying to say that it takes a lot of heat - for being bloated, and that there is be some truth to that (the - systemd-fsck and syslog comments), but that these claims are - largely unsubstantiated, and more along the lines of "I would have - done it differently". Maybe your ideas are better, but you - haven't written the code. - - I personally don't have an opinion either way about SysV-init vs - systemd. I recently migrated my boxes to systemd, but that was - because the SysV init scripts for NFSv4 in Arch are problematic. I - suppose this is another **advantage** I missed: *people generally - consider systemd "units" to be more robust and easier to write - than SysV "scripts".* - - I'm actually not a fan of either. If I had more time on my hands, - I'd be running a `make`-based init system based on a research - project IBM did a while ago. So I consider myself fairly - objective; my horse isn't in this race. + *I* don't think it's bloated, but that is the criticism. + Basically, I discount any argument that uses "bloated" without + backing it up. I was trying to say that it takes a lot of heat + for being bloated, and that there is be some truth to that (the + systemd-fsck and syslog comments), but that these claims are + largely unsubstantiated, and more along the lines of "I would have + done it differently". Maybe your ideas are better, but you + haven't written the code. + + I personally don't have an opinion either way about SysV-init vs + systemd. I recently migrated my boxes to systemd, but that was + because the SysV init scripts for NFSv4 in Arch are problematic. I + suppose this is another **advantage** I missed: *people generally + consider systemd "units" to be more robust and easier to write + than SysV "scripts".* + + I'm actually not a fan of either. If I had more time on my hands, + I'd be running a `make`-based init system based on a research + project IBM did a while ago. So I consider myself fairly + objective; my horse isn't in this race. [^2]: - You can still have `USEDMRAID`, `USELVM`, `interface`, `address`, - `netmask`, and `gateway`. But those are minor. + You can still have `USEDMRAID`, `USELVM`, `interface`, `address`, + `netmask`, and `gateway`. But those are minor. diff --git a/public/bash-arrays.md b/public/bash-arrays.md index bf27dcb..4f47718 100644 --- a/public/bash-arrays.md +++ b/public/bash-arrays.md @@ -311,7 +311,7 @@ Did you notice what was inconsistent? The variables `$*`, `$@`, and "${#}" → length-1 - + diff --git a/public/emacs-shells.md b/public/emacs-shells.md index 638ddbb..3e52804 100644 --- a/public/emacs-shells.md +++ b/public/emacs-shells.md @@ -33,7 +33,7 @@ me). There are two modes of operation: * `(term-escape-char) C-j` switches to line mode. * line mode: Editing is done like in a normal Emacs buffer, `` sends the current line to the shell. This is useful for working with - a program's output. + a program's output. * `C-c C-k` switches to char mode. This mode is activated with @@ -64,7 +64,7 @@ highlighting on the currently being typed command. Ncurses programs will of course not work. This mode is activated with: M-x shell - + eshell-mode ----------- diff --git a/public/fd_printf.md b/public/fd_printf.md index 85ebde4..51e16aa 100644 --- a/public/fd_printf.md +++ b/public/fd_printf.md @@ -38,9 +38,8 @@ to others: return len; } - It is a version of `printf` that prints to a file descriptor—where `fprintf` prints to a `FILE*` data structure. The appeal of this is that `FILE*` I/O is buffered—which means mixing -it with raw file descriptor I/O is going to produce weird results. +it with raw file descriptor I/O is going to produce weird results. diff --git a/public/fs-licensing-explanation.md b/public/fs-licensing-explanation.md index a8ef5ac..9bed879 100644 --- a/public/fs-licensing-explanation.md +++ b/public/fs-licensing-explanation.md @@ -13,7 +13,7 @@ This is based on a post on [reddit][1], published on 2013-02-21. > Foundation Inc". How can software be both licensed under GNU and > copyrighted to a single group? It was my understanding that once > code became free it didn't belong to any particular group or -> individual. +> individual. > > [LiveCode is GPLv3, but also sells non-free licenses] Can you really > have the same code under two conflicting licenses? Once licensed diff --git a/public/java-segfault-redux.md b/public/java-segfault-redux.md index cc4254d..be403ba 100644 --- a/public/java-segfault-redux.md +++ b/public/java-segfault-redux.md @@ -189,7 +189,7 @@ to this: getWidth(); // bogus call to keep `this` around return ret; } - + Yeah. After spending weeks wading through though thousands of lines of Java, C, and C++, a bogus call to a method I didn't care about was the fix. diff --git a/public/java-segfault.md b/public/java-segfault.md index 295ef48..7a2d4c3 100644 --- a/public/java-segfault.md +++ b/public/java-segfault.md @@ -91,7 +91,7 @@ like: // `this` may now be garbage collected return child.somethingElse(var); // segfault comes here } - + Where the destructor method of `this` calls a method that will `free()` native memory that is also accessed by `child`; if `this` is garbage collected before `child.somethingElse()` runs, the backing @@ -111,7 +111,7 @@ around until after we were also done with `child`: this.getSize(); // bogus call to keep `this` around return ret; } - + Yeah. After spending weeks wading through though thousands of lines of Java, C, and C++, a bogus call to a method I didn't care about was the fix. diff --git a/public/pacman-overview.md b/public/pacman-overview.md index 6cee805..4dc2696 100644 --- a/public/pacman-overview.md +++ b/public/pacman-overview.md @@ -36,11 +36,9 @@ To give a brief explanation of cover the "high-level" operations, and which databases they deal with: * "Q" Queries "the database" of locally installed packages. - - * "S" deals with "package databases", and Syncing "the database" with + * "S" deals with "package databases", and Syncing "the database" with them; meaning it installs/updates packages that are in package databases, but not installed on the local system. - * "R" Removes packages "the database"; removing them from the local system. diff --git a/public/rails-improvements.md b/public/rails-improvements.md index c87c093..02a862c 100644 --- a/public/rails-improvements.md +++ b/public/rails-improvements.md @@ -20,7 +20,7 @@ the changes to take effect. Adding the following lines to your [`config/application.rb`][application.rb] will allow it to automatically load and reload files from the `lib/` directory. You -can of course change this to whichever directory/ies you like. +can of course change this to whichever directory/ies you like. module YourApp class Application < Rails::Application diff --git a/public/what-im-working-on-fall-2014.md b/public/what-im-working-on-fall-2014.md index a18b4b1..5f7debf 100644 --- a/public/what-im-working-on-fall-2014.md +++ b/public/what-im-working-on-fall-2014.md @@ -119,7 +119,7 @@ I've got several other projects that I'm putting on hold for a while. compiler bugs that no longer exist (which I guess means that *no one* has tried to build it from source after it was originally published). I've been working on-and-off on this for more than a - year. My favorite part of it was writing a + year. My favorite part of it was writing a [sed script](/dump/jflex2jlex.sed.txt) that translates a JFlex grammar specification into a JLex grammar, which is used to bootstrap JFlex; its both gross and delightful at the diff --git a/public/x11-systemd.md b/public/x11-systemd.md index 6c37895..a24a49b 100644 --- a/public/x11-systemd.md +++ b/public/x11-systemd.md @@ -23,11 +23,11 @@ This means that all of my graphical units take `DISPLAY` as an `@` argument. To get this to all work out, this goes in each `.service` file, unless otherwise noted: - [Unit] - After=X11@%i.target - Requisite=X11@%i.target - [Service] - Environment=DISPLAY=%I + [Unit] + After=X11@%i.target + Requisite=X11@%i.target + [Service] + Environment=DISPLAY=%I We'll get to `X11@.target` later, what it says is "I should only be running if X11 is running". @@ -47,12 +47,12 @@ Xorg requires a TTY to run on; if we log in to a TTY with `logind`, it will give us the `XDG_VTNR` variable to tell us which one we have, so I pass this to `X` in [my `.xserverrc`][X11/serverrc]: - #!/hint/sh - if [ -z "$XDG_VTNR" ]; then - exec /usr/bin/X -nolisten tcp "$@" - else - exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR - fi + #!/hint/sh + if [ -z "$XDG_VTNR" ]; then + exec /usr/bin/X -nolisten tcp "$@" + else + exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR + fi This was the default for [a while][arch-addvt] in Arch, to support `logind`, but was [later removed][arch-delvt] in part because `startx` @@ -65,21 +65,21 @@ So I copy/pasted it into my user `xserverrc`. That's the boring part, though. Where the magic starts happening is in [my `.xinitrc`][X11/clientrc]: - #!/hint/sh - - if [ -z "$XDG_RUNTIME_DIR" ]; then - printf "XDG_RUNTIME_DIR isn't set\n" >&2 - exit 6 - fi - - _DISPLAY="$(systemd-escape -- "$DISPLAY")" - trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}")" EXIT - mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" - - cat < "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" & - systemctl --user start "X11@${_DISPLAY}.target" & - wait - systemctl --user stop "X11@${_DISPLAY}.target" + #!/hint/sh + + if [ -z "$XDG_RUNTIME_DIR" ]; then + printf "XDG_RUNTIME_DIR isn't set\n" >&2 + exit 6 + fi + + _DISPLAY="$(systemd-escape -- "$DISPLAY")" + trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}")" EXIT + mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" + + cat < "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" & + systemctl --user start "X11@${_DISPLAY}.target" & + wait + systemctl --user stop "X11@${_DISPLAY}.target" There are two contracts/interfaces here: the `X11@DISPLAY.target` systemd target, and the `${XDG_RUNTIME_DIR}/x11-wm@DISPLAY` named @@ -95,7 +95,7 @@ window manager exits, the pipe will get closed, sending EOF to the The window manager (WMII) is made to have the pipe opened by executing it this way in [its `.service` file][wmii@.service]: - ExecStart=/usr/bin/env bash -c 'exec 8>${XDG_RUNTIME_DIR}/x11-wm@%I; exec wmii' + ExecStart=/usr/bin/env bash -c 'exec 8>${XDG_RUNTIME_DIR}/x11-wm@%I; exec wmii' which just opens the file on file descriptor 8, then launches the window manager normally. The only further logic required by the @@ -103,24 +103,24 @@ window manager with regard to the pipe is that in the window manager [configuration][wmii/config.sh], I should close that file descriptor after forking any process that isn't "part of" the window manager: - runcmd() ( - ... - exec 8>&- # xinit/systemd handshake - ... - ) + runcmd() ( + ... + exec 8>&- # xinit/systemd handshake + ... + ) So, back to the `X11@DISPLAY.target`; I configure what it "does" with symlinks in the `.requires` and `.wants` directories: @@ -154,9 +154,9 @@ isn't. Anyway, Mozilla's change drove me to to create a display resolution. Disclaimer: I have no idea if it works if the X server has multiple displays (with possibly varying resolution). - #!/usr/bin/env bash - dpi=$(LC_ALL=C xdpyinfo|sed -rn 's/^\s*resolution:\s*(.*) dots per inch$/\1/p') - xrdb -merge <<<"Xft.dpi: ${dpi}" + #!/usr/bin/env bash + dpi=$(LC_ALL=C xdpyinfo|sed -rn 's/^\s*resolution:\s*(.*) dots per inch$/\1/p') + xrdb -merge <<<"Xft.dpi: ${dpi}" Since we want XRDB to be set up before any other programs launch, we give both of the `xresources` units `Before=X11@%i.target` (instead of @@ -174,7 +174,7 @@ I've stuck them in a directory `wmii@.service.wants`: