Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

DevOps

Disabling Windows Recycle Bin with Puppet on all versions of Windows And when I say "All versions of Windows" I mean that I tested it on Server 2008, 2012 and 2016.

This was oddly hard to figure out, and most tutorials either apply to only one version of windows or to outdated tools. The best way to do this that I found was using Local Group Policy. Now, how to automate this? The puppet local_group_policy module didn't work at all when I tried it (and has not been updated since 2014). The proper way to do this is of course with a Domain-based Group Policy, but my machines are not members of a domain.

Fortunately, there is a new Microsoft tool called LGPO that allows for some degree of command-line control of the Local Group Policy. Download "LGPO.exe" here.

First, let's make a reusable policy text file that we can import on all machines:

  1. take a vanilla Windows machine that hasn't had any Group Policy customization, and use lgpo.exe to export the policy: "lgpo.exe /v /parse /u c:\windows\system32\GroupPolicy\User\Registry.pol" (at least that was appropriate in my case). You should get more or less empty output.
  2. Then use the Local Group Policy Editor to change "Do not move deleted files to the Recycle bin" (under User Configuration -> Administrative Tools -> All Settings) to "Enabled"
  3. Repeat step 1. You should see this one setting that you changed in the output. Redirect output to a file, this will be our text file
  4. You can test that importing this file will change the setting: "lgpo /r myfile.txt". (Change the setting back first, run this, then re-open the Local Group Policy Editor to see the change)

Now, we can set up puppet:

Continue reading "Disabling Windows Recycle Bin with Puppet on all versions of Windows"

DevOps

Jenkins Pipeline: parallel and waitUntil, waiting until the other branch finishes»
Let's say that for the sake of speed, you are running two slow things in parallel: parallel one: {     node {         sh "sleep 15"     } } , two: {     node {         //slow part:         sh "sleep 10"         ...

Code and Hacks Code and Hacks

Customizing Windows 7 keyboard and mouse to act like Linux»
After using only Linux for nearly 20 years, I'm being forced to use a Windows machine for work. To make matters worse, I'm really (really) used to Enlightenment shortcuts, yet I use XFCE (Xubuntu). So, I'd like to have a seamless experience if I can help it. This is a log of my experimentation. Note that I am not talking about a skin - I don't care that much about the looks, and ...

Linux Linux

OCR on a large PDF using tesseract and pdftk»
This turned out to be harder than I thought. I found a large (50MB) PDF with about 50 pages, and none of the tesseract GUI's seemed to be able to handle it without crashing. The solution is to convert the PDF to TIFF so that command-line tesseract could handle it directly, but now ImageMagick couldn't handle that conversion as it was running out of memory (even with the limit settings). ...

DevOps Java Java Linux Linux

Running Jenkins Swarm client as a service via Upstart»
This turned out to be fairly simple, with only one gotcha: do not follow the how-to's out there that tell you to use expect fork . The process doesn't technically fork. When I had that setting enabled, upstart commands would hang under very specific but repeatable conditions (if the process was killed externally). So, here is my upstart conf file:

DevOps Linux Linux

Docker: Automatically remove containers that have been running too long»
Why Because my Jenkins setup sometimes starts containers and forgets about them. Either it thinks it failed to start one, or the container itself has trouble starting. Either way, I'm left with containers that are running, trying to connect to Jenkins in vain, forever. The proper way to fix this is probably to have the containers timeout at some point, but that mechanism is broken . ...

Automotive Automotive Hardware Hacks Hardware Hacks

Odometer Reprogramming - Nissan Sentra»
Disclaimer : It is perfectly legal to program an odometer to represent the correct mileage for the car. Problem: The car is a 2006 Nissan Sentra 1.8S . The instrument cluster is faulty and flips overdrive on and off at random. I ruled out the rest (switch, TCM). Thus, the cheapest option is to swap in another cluster , but that means that my mileage will be wrong . The ...

DevOps Linux Linux

Jenkins command line ssh: Host key verification failed despite ssh-agent»
After hours of "Why does it work locally but not in Jenkins", this error boils down to StrictHostKeyChecking... In other words, since the job runs as a user on a random slave, and this user most likely doesn't have a known hosts file with an entry for the target system, this fails rather cryptically. You think that the user's keys don't work, but that's not the problem. The whole ...

Low Tech Hacks Low Tech Hacks

Replacing batteries in a Philips Norelco T980 Turbo Vacuum Trimmer»
I bought this trimmer in 2008 and the NiCd batteries finally died in 2016 - not bad. Still, no reason to trash a working trimmer and contribute to the landfill problem. As it turns out, it's fairly easy to disassemble, and even easier to reassemble. So here are the steps, which probably apply to many similar models.

Low Tech Hacks Low Tech Hacks

Replacing batteries in a Sonicare Elite toothbrush»
I've had this toothbrush for over a decade, and the batteries finally died. I suppose that's a long time for NiCd cells to last. For the last year or so the toothbrush would not complete the 2 minute cycle but would instead stop sometime earlier. The batteries are clearly still alive but simply don't have enough capacity. The toothbrush is not designed to be opened (it is ...

Linux Linux

Ubuntu 15.10: Handling Dell Latitude laptop dock events to reconfigure displays»
Couldn't find any good solutions out there. I have a Dell Latitutde E6410 running Ubuntu 15.10 with XFCE (no Gnome or KDE). I use a physical docking station that allows me to use two external monitors. Ubuntu doesn't seem to understand that if these external monitors vanish, it should switch to the monitor that remains (built-in LCD), and vice versa, so I have to automate it myself. ...

Code and Hacks Code and Hacks DevOps

Marking Jenkins build UNSTABLE from environment inject groovy script»
The way we use the Jenkins "Prepare an environment for the run" feature of the Environment Inject Plugin is this: we use the "Evaluated Groovy Script" to retrieve some info from a successful run of some other job (svn revisions, environment vars, whatever) in order to make it available to the environment of the current build. But what if that other job hasn't run successfully (yet)? I'd ...

DevOps Linux Linux

Migrating Maven Jenkins jobs to FreeStyleJobs due to JDK 1.6 incompatibility»
Soon after Jenkins 1.609.1 support for JDK 1.6 was dropped altogether. This means that you can run jobs with whatever JDK you want as long as you are not using the Maven job type . Maven jobs require JDK 1.7 or higher (actually they run on whatever version the master is using, ignoring the JDK setting in the job configuration). This is a big deal for a shop that does extensive ...