View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

The GitHub Archiving Project is coming along. At this stage of the production of the archival artifacts, it’s going to take a month to complete. In the meantime, they are looking for more contributions to the guide at the beginning of every film reel.

20200206/https://github.blog/2020-02-03-the-arctic-code-vault-starts-production-and-your-open-source-projects-are-being-archived/?utm_campaign=1580753014&utm_medium=social&utm_source=facebook,linkedin,twitter&utm_content=1580753014

Online digital libraries listing every single book in the world? Again, I reiterate, because this is important! Here we circle back to OpenLibrary. Apparently, because they’ve made the most progress out of anyone else, more so than, WorldCat, for example. Yes, they are part of the Internet Archive.

And, they have a means by which you can sponsor a book to appear in the Open Library. Sponsoring a book includes the digitization cost and expedites its inclusion compared to book donations. Ideally, the books are available in the library forever… but of course, there are always rare reasons why a book might get removed from a library for legal reasons.

20200206/https://openlibrary.org/
20200206/https://openlibrary.org/sponsorship

Windows `.res` file format

2020-02-05

Categories: windows  
Tags: windows  

What is the file format of the .res resource files that are emitted by the MSVC compilers? MSVC++ 6.0 has this really nice ability to be able to open up the .res compiled resource files and browse around the resource contents. In one case, I saw it also able to do this no an New Executable (NE) object format DLL. However, it appears that the ability does not extend to Portable Executable (PE) object code formats, i.e. the required format for 32-bit Windows software.

Fortunately, it wasn’t too hard to find information about this. So, here’s what happens. The .res file format is basically a RIFF-like sequential-search list chunk block format as-is. Then, MSVC uses a utility called CVTRES to add a resource index table and pack the whole object into a COFF object code file, which is then passed to the linker and linked in as-is. MinGW, by contrast, does not produce an intermediate .res file but instead jumps straight to the COFF object code file.

20200105/DuckDuckGo .res compiled windows resource file format
20200105/http://bytepointer.com/resources/win32_res_format.htm

Unfortunately, this document did not completely specify the 32-bit resource table/directory format. Fortunately, there is sufficient information inside the MinGW tools themselves, especially the objdump output, for determining this information.

Important! How do you read NTFS file creation dates from GNU/Linux? Assuming your running on an old Linux kernel version, the only way to do this is to use the ntfsinfo NTFS attribute read utility program.

sudo ntfsinfo -f -F "your/full/path/name.txt" /dev/loop0

Then you look for the “File Creation Time” attribute.

20200203/DuckDuckGo linux get ntfs file creation date
20200203/https://unix.stackexchange.com/questions/87265/how-do-i-get-the-creation-date-of-a-file-on-an-ntfs-logical-volume

If you are using a newer version of ntfs-3g, you can use getfattr to get the extended attribute that is set for creation time. And if you are using a really new Linux kernel version and all, maybe you can even get this information directly from an ls listing, asking for creation times to be displayed.

For quite a while, I was saving up my notes on how to clean corrosion on battery contacts, and well, I finally got around to trying it out. And boy, did I learn one lesson the hard way.

The online sources recommended using an acid of some sort to clean the contacts. I’ve tried that previously, to no avail in cleaning power. Yeah, the problem was that when I tried it, it was only immediate contact for the particlar clean, then remove it all in the course of a few minutes. The online source recommended soaking for some more time, like maybe 24 hours?

Now, that is where you have to be careful. What kind of metal are you cleaning? If you are cleaning, say, bare copper, than this method will work fine. Yeah, it’s essentially the same method to make a copper penny shiny: the top-most layer of corroded metal is stripped away. But, if you are cleaning nickel-plated copper or any other plated metal, be forewarned that this cleaning method can strip off your plating. And alas, that’s what happened to me. At the outset, it is merely cosmetic damage.

Read on →

Good article from the EFF on why using Public Wi-Fi is no longer a security risk. All of us techies know this all and well, but non-technical folks seem to still be at loss about the news of the updates.

20200131/https://www.eff.org/deeplinks/2020/01/why-public-wi-fi-lot-safer-you-think

The standard C library has subroutines for computing square roots on floating point numbers, but what if you want to compute square roots on integers? Then you have to write your own square root subroutines. But no worries, this is actually rather simple to do in an efficient manner.

Basically, you use an iterative square root computation approach that revolves around this formula:

(x + n)^2
= x^2 + 2*x*n + n

n is a power of two… so 2nx is wholly bit shifting. x is your running total of your guessed square root so far. The idea is that you incrementally test adding one bit value to your total. Of course, you need a starting guess, and for that, counting the number of significant bits using the bit-scan reverse instruction (bsr on x86) works very well. Divide that by two (shift right by one) to get a starting value for x.

If you don’t have bit scanning instructions, then you must use an iterative square root method. Then you can cache the results in a lookup table, of course. Note that a square root is a polynomial, so there is no “polynomial approximation”, just polynomial computation.

Read on →

The post stage steps in Jenkins are special in that for a step in a Jenkins stage, there are more status codes than just SUCCESS and FAILURE. How are the other status codes used? Jenkins, by default, as its own logic to assign which such codes should be used, and sometimes it is not always what you expect.

Also, note that Inspec returns more than two diferent exit code values, so this can be used to determine what the particular failure cause was. This behavior can also be disabled by using the command-line option --no-distinct-exit to distill this down to simple pass/fail exit codes.

20200130/DuckDuckGo jenkins pipeline result failure error
20200130/DuckDuckGo jenkins pipeline on success on failure
20200130/https://jenkins.io/doc/pipeline/tour/post
20200130/DuckDuckGo jenkins post success failure
20200130/DuckDuckGo jenkins post
20200130/https://jenkins.io/doc/book/pipeline/syntax/#post
20200130/DuckDuckGo jenkins post run on success or failure but not abort
20200130/DuckDuckGo jenkins shell catch exit status
20200130/https://stackoverflow.com/questions/42428871/jenkins-pipeline-bubble-up-the-shell-exit-code-to-fail-the-stage
20200130/https://www.inspec.io/docs/reference/cli/

Prometheus blackbox exporter

2020-01-29

Categories: misc  
Tags: misc  

How do you monitor the status return results of an arbitrary URL in Prometheus with ease? Use the blackbox exporter.

20200124/DuckDuckGo prometheus blackbox
20200124/https://github.com/prometheus/blackbox_exporter

How do you parse JSON in Puppet? Well, now that is a bit of a more complicated question to answer. First of all, Puppet doesn’t handle standard JSON; rather, it uses a variant called “PSON.” PSON’s main difference is that it is specified in 8-bit ASCII rather than UTF-8, and some ASCII control characters must be escaped via an escape sequence. Furthermore, if you have a string parsed into Puppet with Unicode characters, you cannot use that string as-is, else you will get “invalid UTF-16le literal” errors. You must first decode the UTF-16 into UTF-8, then encode and escape and ASCII control sequences.

20200124/DuckDuckGo puppet parse json string from command
20200124/https://stackoverflow.com/questions/43729915/parse-a-json-string-in-puppet
20200124/https://ask.puppet.com/questions/28878/how-to-handle-json-data-in-puppet/
20200124/https://puppet.com/docs/puppet/latest/http_api/pson.html
20200124/https://tickets.puppetlabs.com/browse/MODULES-9195

In particular, if you are reading the output of a “shell backticks” command, Unicode characters will be translated and represented in the Puppet native form. Which is what? UTF-8… strings are just sequences of bytes, but in the future, all strings may be required to be valid UTF-8.

20200124/DuckDuckGo puppet string literal syntax
20200124/https://puppet.com/docs/puppet/latest/lang_data_strings.html

Read on →