I found this photo of a fat cell that a food scientist had given me.
I did some searching and quite frankly, I believe this to be one of the highest quality fat cell photos on the internet.
There Are Bugs in the Gonis
A former colleague of mine once shared a picture of some sentences that one of his wife's student's had written. The student was a very young kid with very young kid handwriting and the sentences were funny and we all had some laughs at how cute they were.
One of the sentences was partly incomprehensible. As far as we could tell it looked like it said "There are bugs in the gonis." For some reason this was hilarious to us and because we all wrote software for a job we began to use the word "gonis" to refer to any complex, old or difficult-to-work-with piece of code: it's where bugs come from.
I don't work there anymore. Neither does that colleague. And his wife no longer teaches those hilarious kids. But not a week goes by that I don't find myself at my new job wishing I could call some file or system a gonis.
So I figured I would write this little story. That way I can just use the word freely and hope that people drop it into a search engine and find this.
Restarting Python SimpleHTTPServer on file system changes
I have a little static site generator that I made for my own uses. When I'm ready with my changes, I run a test command that uses Python's SimpleHTTPServer to serve the built, public folder so I can make sure it all looks good before I rsync it to my remote server.
I wanted to run some custom build code every time one of the files changed, and I wanted that hidden behind a single command. Using watchdog seemed like an easy enough solution, but running the server was an issue, since the SimpleHTTPServer included with python will block the main thread as soon as you start it. Thankfully, you can just toss it in its own process and go about your day. I ended up with something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
def dev_command(): from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler from multiprocessing import Process from http.server import HTTPServer, SimpleHTTPRequestHandler def create_server(): httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) httpd.serve_forever() class Rebuilder(FileSystemEventHandler): p = None def stop_server(self): if self.p: print("Stopping server") self.p.terminate() def rebuild(self): # run all your rebuild commands def start_server(self): if self.p: self.stop_server() print("Starting Server") self.p = Process(target=create_server) self.p.start() def on_modified(self, event): if self.should_rebuild(event): print("Rebuilding") self.rebuild() def should_rebuild(self, event): """Include code to make sure you only rebuild on events you care about. Or you could implement watchdog's RegexMatchingEventHandler""" return True rebuilder = Rebuilder() rebuilder.start_server() observer = Observer() observer.schedule(rebuilder, "/path/to/watch/", recursive=True) observer.start() try: while True: time.sleep(1) except KeyboardInterrupt: observer.stop() observer.join()
Thinkpad X1 Gen 7 with Ubuntu, Windows Dual Boot and Disk Encryption
I recently set up a Thinkpad X1 Gen 7. I wanted disk encryption and to retain the Windows installation in case I ever needed it in the future. I was a bit nervous because there are some stories of people needing to fight with their settings and configuration and unfortunately the Ubuntu installer gives you pathways for either dual booting or encryption, but not both. Luckily I found a fairly good write up and things went smoothly. Since the write up focuses on a Dell machine, I thought I could allay some fears with a few notes on how things went for me. For the most part, I just followed the instructions and everything worked out.
Mike's tutorial shows a few BIOS settings to be made. I didn't make any changes to my bios. The settings were either alread correct, or I couldn't find one that applied. Mike mentions that he disabled Secure Boot, but that it may be optional. I did not disable this.
The only difference here is that my device was not
/dev/nvme0n1. One thing to be careful with is that you need to replace all the occurences in this tutorial careful. In some places, he mentions partitions not devices. In these cases you will have a corresponding numbered partition. For example one line in the configuation is
mkfs.fat -F 32 /dev/sda1, in this case I needed to enter
mkfs.fat -F 32 /dev/nvme0n1p1.
Two small tips. When you eneable bitlocker, actually save the key to a location off the computer. This seems obvious, but I'm not familiar with Windows and in a first attempt I just stored it on the Window's hardrive thinking I would get it later. But no, I needed it later and I didn't have access to it.
After the Windows install I was not able to access my BIOS with F12. To fix thisyou need to go into your Settings > Recovery > Advanced Startup "Restart now". When the computer restarts, select Troubleshoot > Advanced options > UEFI Firmware Settings > Restart. Check out this laptopmag.com article for screenshots.
This part was pretty straightforward. During the install process I did not select to install the third-party packages because this forces you to make a decision about using secure boot and I figured it was better to not introduce that variable.
Make sure you're very careful translating the commands in the tutorial to refer to your disk / partition layout.
Everything went smoothly. Don't become discouraged if you select windows from the Grub boot menu and get failure message. You need to boot Windows from your BIOS's boot menu. I will re-iterate Mike's note here:
"By default, your computer will boot into grub, which can boot Ubuntu. Although Windows is listed in grub, booting Windows from grub with BitLocker enabled won’t work because the system’s TPM will detect a change in the boot sequence. To avoid this problem, you should boot Windows directly from your computer’s BIOS boot menu - usually accessible by pressing F12 on startup."
I missed this the first time around and ended up installing everything again.
Amazingly, everything I have tried in Ubuntu has worked perfectly:
- Bluetooth ✓
- Wifi ✓
- Sound ✓
- Webcam ✓
- Trackpoint ✓
- Trackpad ✓
- Function Keys ✓
- Webcam ✓
- Fingerprint scanner ✓
- Microphone ✓
- Sleep / Wake ✓
I have the UHD option and the screen looks great and there are plenty of options for scaling.