Picade and audio

A while ago, Peter and I built a RPi based Picade box. It was a lot of fun! We had some issues with sound though, with a lot of static and clicking noises. After some digging, I ended up with the following configurations:

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
overscan_scale=1
# Try to fix sound
disable_audio_dither=1
audio_pwm_mode=2
hdmi_drive=2

I'm not sure exactly which ones are absolutely necessary, but the above works well for us.

Hacking: 

Shrinking VirtualBox VDI's

This is nothing new, but I'm adding this here for myself, so I can find it again. Once in a while, dynamically allocated VDI's in VirtualBox will grow a lot more than what the guest OS reports as being used. When this happen, you can recover some space on the host system, doing the following.

First, in the guest OS, you can do one of the following:

mount -o remount,ro /dev/sda1
zerofree -v /dev/sda1

However, I could not get that to work, for some reason, it just said that it couldn't open the device. So, the second thing to do, which is what I do, is

sudo dd if=/dev/zero of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile
 
These commands will allow the VirtualBox command to recognize the zero-filled blocks that should be recovered:
VBoxManage modifyhd ~/VirtualBox/Linux/linux.vdi --compact

The commands varies slightly depending on the host OS, the above is on my Mac.

Slow emacs startup on CentOS7 under VirtualBox

I use VirtualBox for most of my development efforts on my macBook. I recently had to reinstall CentOS7 on this new machine, and was noticing a 10s (2x 5s) delay on startup times for Emacs. Doing an strace -tt on the Emacs binary, I noticed it would timeout on trying to lookup its own hostname. I'm not sure why, but this timesout on the DNS lookups were annoying the hell out of me. The solution was to add the local hostname (set in /etc/hostname) to the 127.0.0.1 entry in /etc/hosts.

Hacking: 

gzip vs Brotli compression

I enabled Brotli on one of the sites that I run (https://docs.trafficserver.apache.org/ and https://ci.trafficserver.apache.org). I examined the logs (about 200,000 log entries so far), and comparing the sizes for each URL that gets both Brotli and gzip. I summarized by content type, and see 5-10% smaller objects with Brotli.

application/javascript  -6.42%
text/css               -10.05%
text/plain              -4.64%
text/html               -8.44%

High Sierra and local TimeMachine backups

I was wondering where some of my disk space was going, and realized that macOS HighSierra will make local TimeMachine backups as needed, and while disk space is available. This might be cool in some cases, and you can see (and delete) these snapshots with 

$ tmutil listlocalsnapshotdates /Volumes/com.apple.TimeMachine.localsnapshots
2017-11-29-134430
2017-11-29-144409
2017-11-29-154648

$ tmutil deletelocalsnapshots 2017-11-29-134430

Another alternative is to use the thinlocalsnapshots option

$ tmutil thinlocalsnapshots /Volumes/com.apple.TimeMachine.localsnapshots

However, that didn't do anything on my box. Instead, I just looped over all of the snapshots, and nuked them all:

for snap in $(tmutil listlocalsnapshotdates /Volumes/com.apple.TimeMachine.localsnapshots); do
    tmutil deletelocalsnapshots $snap
done

TCP Fast Open

i've been fiddling with TFO lately, and my BFF Randall found this excellent article on the topic. Well worth a read! Doing some tests, for small requests / responses, you can make resonse times quite noircably faster!

Note: On my modern linux kernel, the command to get the TFO metrics out of netstat is not correct. It should be

$ grep "^TcpExt:" /proc/net/netstat | cut -d " " -f 91-96  | column -t

 

Hacking: 

Convering Github markdown to PDFs

I've been using this tool called pandoc to convert various files to PDF. In addition to pandoc itself, I also had to install TeX on my macOS box. Details for that is given here. Once all is installed, pandoc via HomeBrew of course, I simply do e.g.

$ export PATH=${PATH}:/Library/TeX/texbin   # Yeh, I could add this to my RC files
$ pandoc CppCoreGuidelines.md -o CppCoreGuidelines.pdf

You might need the additional images etc. properly downloaded as well, of course.

Pages

Subscribe to Ogre.com RSS