Blog
-
Shai Afsai: “Ignore the neo-Nazis! Benjamin Franklin was no anti-Semite.”
For 80 years anti-Semites worldwide have celebrated a bare-faced forgery, ‘Franklin’s Prophecy,’ as proof the founding father saw Jews as ‘vampires’ and ‘a great danger for the United States.’
-
computer (etc) displays and colour schemes – “black on white” or “white on black”?
I have “no idea”, what is better for my health:
- a dark (or black) background
- a light (or white) background
I think, the human eye enjoys white as a “general background”, … – so I somehow think, white as background is “more enjoyable”.
I just noticed, that
- my favourite editor has white as background
- and the CLI console has black as background,
and suddenly I found it tiring for my eyes to constantly change between a black and a white background.
My (current) CLI console on Windows is “ConEmu“, and apparently there are just these two colour schemes with white as background:
- “Tomorrow“
- “Solarized Light“
I switched to “Solarized Light” for now, because I enjoy its stronger contrast better than the one of “Tomorrow“.
BTW (just in case you/I want to switch back): Its default (resp. previous setting) is “ConEmu“.
-
your OOXML file (“.docx”, “.xlsx”, “.vsdx”, …) and its “modified” timestamp
- https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
- https://github.com/JochenHayek/misc/blob/master/using_timestamps_in_filenames/create_snapshot_from_OOXML.sh
- https://en.wikipedia.org/wiki/XMLStarlet
VSDX does not get listed as an OOXML conform file format, but for this purpose (here) we can treat it like one.
Your “.docx” (or “.xlsx”) file is a ZIP file with a docProps/core.xml inside:
$ unzip -l YOUR.docx … … docProps/core.xml …
This is a convenient way to extract docProps/core.xml to STDOUT:
$ unzip -p YOUR.docx docProps/core.xml …
This is how to get the XML reformatted using xmlstartlet:
$ unzip -p YOUR.docx docProps/core.xml | xml fo
This command line shows you the possible XPath expressions:
$ unzip -p YOUR.docx docProps/core.xml | xml el … cp:coreProperties/dcterms:modified …
How to extract “modified” to STDOUT?
$ unzip -p YOUR.docx docProps/core.xml | xml sel --template --value-of cp:coreProperties/dcterms:modified
And how to extract the timestamp w/o anything but decimal digits?
$ unzip -p YOUR.docx docProps/core.xml | xml sel --template --value-ofcp:coreProperties/dcterms:modified | tr -d ':TZ-'
…
-
shell command completion with busybox-w32 resp. its “ash”
With Bash command completion works the way, I expect it – or through all the years with Bash I learned what to expect: If I try to complete through a relativ or absolute directory, it lets me complete (sub)directory names and names of executable files.
With ash (under busybox-32) initially I had trouble getting certain executables recognised by command completion. It turned out, I only had trouble with shell scripts. And that was because my shell scripts did not have a shebang line:
That’s because I “always” want to get them run through THE STANDARD system shell, and this is being achieved through not using a shebang line – so (under “normal” circumstances) why should I let them have a shebang line?
On busybox-w32 shell scripts w/o shebang line get properly executed – but they are not considered for command completion.
That’s a phenomenon resp. approach I had never come across before. And because I could not guess it by myself (and I falsely assumed the “ash” would consider the file extension), I created an “issue” here:
- https://github.com/rmyorston/busybox-w32
- https://github.com/rmyorston/busybox-w32/issues/68 : “command completion”
The reply:
In this context the file extension doesn’t matter. A text file is considered to be executable if the first characters are “#!“.
And it works exactly as described.
On Windows there is not “executable bit”, as on Unix/Linux/… filesystems. So busybox-w32 (or BusyBox in general?!?) looks at the “shebang”, and if there is one, the file is considered for command completion.
-
my 2017 Windows working environment
All these packages resp. utilities do not require Windows admin rights for getting them “installed” – actually they do not need “a Windows system installation”.
Below C:\Users\jhayek I created a couple of subdirectories:
- opt: every package resp. utility has its own subdirectory below there
- bin: some .bat and .sh (BusyBox ash) scripts go there
Packages resp. utilities:
- GNU Emacs
- busybox-w32: includes a shell and a lot of Unix utilities
- Strawberry Perl
- https://ConEmu.github.io — a Windows console alternative, where you can paste text w/o using the mouse 😎
- xmlstarlet
After having worked with this set-up for a couple of days, I have to admit: this is not just a minimalist Unix-ish working environment, but it is rather enjoyable working environment. I do not have the GNU utilities with all their advantages (nice long command line options and lots of features) – but for most purposes the utilities built into busybox-w32 are good enough for my purposes. What a great idea it was to think of “busybox for Windows” a couple of days ago – and actually find “busybox-w32”!!! I had to consider a lightweight alternative of Cygwin, because on my new client’s Windows computers it’s not available.
ConEmu makes busybox-w32 and its shell (the “ash”) even more enjoyable.
GNU Emacs is as good as always – I can’t really describe how sad it is to not have it available in a serious working environment.
Strawberry Perl so far has all the modules, that my utilities need. I am really glad to have that “distribution”.
xmlstarlet is my XPath and XML Swiss Army Knife.
With all these utilities and packages available it’s even quite fun to work on Windows 7 😆
-
BusyBox’s “Almquist shell” is not as rich as the Bash
- https://en.wikipedia.org/wiki/Almquist_shell
- https://linux.die.net/man/1/ash – the markup is in a terrible state
- https://en.wikipedia.org/wiki/Bash_(Unix_shell)
The problems with “ash” always most evident, if a shell script got written to work with Bash and needs adapting / downgrading to the “ash”.
-
Perl on Windows w/o Cygwin: Strawberry Perl for Windows
I need (some) Perl on Windows to be run from within shell wrapper scripts. Looks like there will be no Cygwin. Which shell will it be? Probably Busybox:
- https://frippery.org/busybox/
- http://strawberryperl.com/releases.html
- I don’t have admin rights on that Windows machine, so I am going for “64bit PortableZIP edition + extra PDL related libs”
- I unzip it to the subdirectory derived from the ZIP filename
- then for setting up the environment I run the portableshell.bat therein
- afterwards I start the busybox shell as suggested on the web page shown above