Skip to content

Instantly share code, notes, and snippets.

View plembo's full-sized avatar

Phil Lembo plembo

View GitHub Profile
@plembo
plembo / relocatedockerdataroot.md
Last active March 16, 2023 20:09
Change Docker data directory

Relocate the docker data directory

By default docker on linux uses /var/lib/docker as its data directory (in docker parlance, "data-root"). This can be inconvenient for those of us whose /var is located on a boot drive with only a modest amount of space. After installing docker I always relocate its data directory to a bigger volume. Assuming that volume is named "data1", here's the procedure:

  • Shut down docker and containerd, systemctl stop docker; systemctl stop containerd.
  • Create a /etc/docker/daemon.json file with the following contents:
{
  "data-root": "/data1/docker"
}
@plembo
plembo / seleniumexpand.md
Last active June 12, 2022 14:51
Expand rows on a page with Selenium

Selenium to click open a table

A certain state goverment web app uses Ifragistics igGrid to publish tables to a page, with a button to reveal a second table. Because its javascript is executed after you visit the page, easy page scraping methods (like pandas read_html) won't work. Instead, you have to imitate a browser and the clicking of a button. Fortunately, the Selenium Python bindings allow you to do all that. With a little help from Beautiful Soup 4 and pandas, the rest is history. This code was developed in a Jupyter notebook as part of a larger effort to help ordinary citizens leverage public data for the public good.

Here's the code, with comments:

# Import Selenium
@plembo
plembo / returntognome.md
Last active June 1, 2024 19:46
Return to Gnome

Return to Gnome

Not an epic journey.

Switched back to Gnome Shell from Ubuntu MATE desktop after 6 months, mostly because it was becoming as difficult to do nonstandard things in MATE as it had in Gnome. Although I tried simply re-installing Gnome and switching to it, all the cruft that had accumulated, including an in-place upgrade from Ubuntu 18.04 to 20.04 LTS, eventually got the better of me. Three hours in I was stuck at the Plymouth splash on both my desktop and laptop. On to Nuke and Pave.

Well, not exactly. All I did was do a minimal install of Ubuntu 20.04 LTS Desktop to my root (/) partition and left /home and the data volumes alone. It took a while (around 2 hours working on two machines in parallel), but I got it done.

This time around I had to create an EFI partition out of my existing root volume because that's how Ubuntu rolls now. That was easy enough: the "something else" option in the installer lets you blow away a partition and then create whatever you need in the unused space. I went

@plembo
plembo / wgetforwin.md
Last active June 28, 2024 03:39
wget for Windows

Getting wget for Windows

For most of the Unix-like work I do on Windows, the small set of utilities provided by Git for Windows suffice. But just yesterday I found myself needing wget to complete a small (Windows) shell script I wanted to write.

In my search for a solution I finally took a closer look at the Git for Windows SDK, and lo! found it includes a wget binary for Windows.

There are a few ways I could have gone with this. The "right" way would have been to replace my existing install with a recompiled Git for Windows. But I wasn't going to exert that kind of effort to get a single utility. What I did instead was install wget for the SDK and then copy it and its one dependency to where I had Git installed.

First install the SDK and open its shell (msys1_shell.cmd). Then install wget using pacman(pacman -Sy wget).

Next, open a Windows terminal as Admin and copy the wget executable and

@plembo
plembo / remappimagelauncher.md
Last active March 29, 2022 22:32
Completely remove appimagelauncher

Completely remove appimagelauncher

Stumbled on this while trying to install the "new" appimaged (go-appimage).

Apparently sudo apt remove --purge appimagelauncher isn't good enough.

Need to manually remove remnants of broken links for appimagelauncherd (and appimagelaunchefs) under ~/.config/systemd/user and ~/.config/systemd/user/default.target.wants.

Also, any appimagelauncher* files under ~/.config as well. Also see appimaged README.

@plembo
plembo / GitNotOneDrive.md
Last active July 18, 2024 07:51
Never put git working dir on OneDrive

Never put a git working directory on OneDrive (or Google Drive)

Over 600,000 changes.

The other day I decided that it would be nice to store my code Projects folder under Documents on my work machine (after all, so many apps want to store their data in %UserProfle%\Documents by default).

But my company has implemented a policy that syncs that Documents folder to the cloud with OneDrive.

That's not a problem for most content, like documents. Git working directories, on the other hand...

@plembo
plembo / installtestarduinoide.md
Last active June 4, 2022 16:30
Install and test Arduino IDE on Linux

Install and test the Arduino IDE on Linux

And by Linux, I mean my own Ubuntu Desktop 18.04 LTS workstation. I barely understand how it works. Consider this a diary entry by a neophyte embedded experimenter.

The hardware used was a Lolin/WeMos D1 Mini compatible development board manufactured by ACEIRMC. It is based on the ESP-12F (ESP-8266MOD) SoC and the CH340G USB to UART interface. Order here on Amazon (listing is for a package of 5 boards and an assortment of pins). These boards have 4 MB (that's MegaBytes, not GigaBytes) of programmable memory, so they are definitely more challenging to work with than "higher-end" Beagles or the Raspberry Pi. But they are small, low power, controllers that can fit in place

@plembo
plembo / blenderinstalltohome.md
Last active January 14, 2022 22:22
Install of blender binaries to user home

Installing blender binaries to $HOME

This gist follows my new pattern of installing vendor binaries to user $HOME rather than /opt or /usr/local. Installing to user home has 2 basic benefits: (1) avoids permissions issues; and (2) avoids conflicts with system software.

Here is my new practice when installing Blender:

  1. Download the latest LTS release from https://www.blender.org/download/lts/.
  2. Extract the contents to ~/.local/blender.
$ mkdir ~/.local/blender
$ tar xJf blender-x.xx.x-linux-x64.tar.xz -C ~/.local/blender --strip-components=1
@plembo
plembo / rpizerow-force-turbo.md
Created December 24, 2021 01:27
rasberry pi zero w cpu speed only 700 MHzx

Force turbo speed on a Raspberry Pi Zero W

Some of us still stuck with a first generation Raspberry Pi Zero W really wish it defaulted to its 1 GHz turbo speed, but it doesn't. Under normal circumstances, a Pi Zero W will default to 700 MHz. The fix is simple: add the following line to /boot/config.txt and reboot:

force_turbo=1

That's it.

At least until the Raspberry Pi Zero W v2 is actually shipping...

@plembo
plembo / lvtvhdmielitedesk.md
Last active April 8, 2022 20:52
LG TV HDMI in and HP Elitedesk

LG TV HDMI-in and HP EliteDesk

Back in 2016 we bought an LG Model 65UH615A-UC 65" 4K LED TV. It has performed well and been mostly reliable.

Except that every so often I have to unplug it from the house mains, wait some minutes, and then plug it back in before moving on. This usually becomes necessary when apps, like the one for YouTube, emit nonsensical warnings like "no network" or "no Internet", or simply refuse to come up. The TV's SOC (System On Chip) has limited RAM to work with (certainly less than half a gigabyte once WebOS and a few apps are loaded) and occasionally will reboot the TV when it runs low. For a long time I thought the problem was just bad software design on the client app side. But now I'm not so sure.

Had a moment of dispair this morning when I fired up the HP Elitedesk machine we're using as an HTPC and got a black screen and "No signal" error on the HDMI port it was connected to.

After a few reboots, multiple reseatings of cables, and probing over an ssh connection to the machin