tag:random.christopher.su,2013:/posts Random 2021-01-06T03:35:44Z Christopher Su tag:random.christopher.su,2013:Post/1131133 2017-02-14T06:17:53Z 2018-07-31T17:00:37Z Fix Chrome Black Screen on Ubuntu

I've been getting a full black screen on my external monitor on many pages in Google Chrome on Ubuntu 16.04 LTS running GNOME. The solution to this problem is to launch chrome with the --use-gl=angle flag, like so:

google-chrome --use-gl=angle

You can also edit the google-chrome.desktop file in /usr/share/applications so Chrome always launches with this flag.

Christopher Su
tag:random.christopher.su,2013:Post/1120640 2017-01-05T08:26:16Z 2017-07-14T04:39:42Z Get Bose QC35 to work on Linux

I finally managed to get my Bose QC35 to play audio properly on my Linux machine with the following:

  • Ubuntu 16.04
  • GNOME 3.18.2
  • pulseaudio 8.0
  • bluetoothctl 5.37
I was getting this error when trying to switch the audio profile of my headphones to A2DP Sink:
Failed to change profile to a2dp_sink
The solution was to do the following:
  1. Create /var/lib/gdm3/.config/pulse/client.conf with the following:
    autospawn = no
    daemon-binary = /bin/true
  2. sudo -ugdm mkdir -p /var/lib/gdm3/.config/systemd/user
  3. sudo -ugdm ln -s /dev/null /var/lib/gdm3/.config/systemd/user/pulseaudio.socket
Christopher Su
tag:random.christopher.su,2013:Post/1112601 2016-12-03T00:53:29Z 2016-12-03T00:53:29Z Dokku giving a "pre-receive hook declined" error on push

Dokku was giving me this error when I tried pushing my app to it:

[remote rejected] master -> master (pre-receive hook declined)

The error message is very vague and unhelpful. You can get more information by ssh-ing into your dokku instance and enabling tracing by running dokku trace on. You will then get more detailed output when you try pushing and from that you should be able to tell what exactly went wrong. In my case, my app repository included a git submodule that the dokku server did not have permission to clone.

Christopher Su
tag:random.christopher.su,2013:Post/1112600 2016-12-03T00:48:59Z 2019-02-06T23:25:40Z plymouthd crashing on startup on Ubuntu 16.04 with GNOME

If you're getting a crash on startup on Ubuntu GNOME 16.04 because of a problem with plymouthd, try running this to fix it:

sudo chown -R : /sbin/plymouthd

Christopher Su
tag:random.christopher.su,2013:Post/1112412 2016-12-02T06:43:49Z 2020-07-07T01:03:39Z Fixing "pkg-resources==0.0.0" pip error on Ubuntu

I ran into this error when trying to pip install from a requirements.txt file on Ubuntu: No matching distribution found for pkg-resources==0.0.0. This line is added to the requirements.txt file (if you look in the file, you'll probably see it) by the pip that comes with Ubuntu's python-pip package (also I had created the requirements.txt file using pip freeze in a virtualenv). The solution to this problem was to first uninstall the Ubuntu version of pip:

sudo apt-get remove python-pip-whl python3-pip

Then install it using easy_install: 

# install easy_install if you don't already have it
sudo apt-get install python-setuptools

# install pip using easy_install
easy_install pip

# install virtualenv using pip
pip install virtualenv

# now you can recreate the requirements.txt file
# pip install whatever dependencies you have
pip freeze > requirements.txt

Christopher Su
tag:random.christopher.su,2013:Post/1111332 2016-11-28T10:38:33Z 2016-11-28T10:38:51Z Notes on Calibre Server
  • Calibre Server is mainly used for browsing and sharing books through a web browser
  • It doesn't seem to provide a way to sync Calibre libraries across devices
  • Instead, use Dropbox or Syncthing or another similar service to sync libraries
  • If you're looking for a Docker image that supports username/password authentication for Calibre Server, I made one: https://hub.docker.com/r/christophersu/calibre-server/
  • It works on unRAID
Christopher Su
tag:random.christopher.su,2013:Post/1107887 2016-11-14T02:15:14Z 2021-01-06T03:35:44Z Ubuntu boot slow after resizing partition

I recently resized my Ubuntu partition to move some space from a Windows partition and I noticed that, upon rebooting, the Ubuntu startup was much slower. It turns out, in the process of resizing my root partition, I had also moved my swap partition. My /etc/fstab file still had the UUID for the old swap partition (I had done the partition resizing with gparted on the Ubuntu live usb, so it did not update the fstab file). The solution was to do the following:

  1. Get the UUID for your new swap partition using sudo blkid
  2. Update the UUID for the swap partition in the /etc/fstab file (you can edit in a terminal using sudo nano /etc/fstab)
  3. Reboot and check if that solved the slow boot problem
Christopher Su
tag:random.christopher.su,2013:Post/1107715 2016-11-13T09:12:27Z 2016-11-13T09:12:27Z Install the Gnome Shell integration for Chrome
  1. Install the GNOME Shell Integration Chrome extension from the Chrome Web Store
  2. Add a new repository: sudo add-apt-repository ppa:ne0sight/chrome-gnome-shell
  3. sudo apt-get update
  4. sudo apt-get install chrome-gnome-shell
  5. Go to https://extensions.gnome.org/local/ in Chrome and check that your extensions appear
Christopher Su
tag:random.christopher.su,2013:Post/1097405 2016-10-09T22:23:08Z 2016-10-09T22:23:08Z Get First Commit in Git

To get the first commit in a git repository:

To get the date of the first commit in a git repo (demonstrates use of the format parameter):

Christopher Su
tag:random.christopher.su,2013:Post/1094666 2016-09-29T18:55:08Z 2019-02-02T20:28:54Z Insert Current Date with AutoHotKey

This AutoHotKey script/macro will type the current date in the YYMMDD format after you type "#d-". I use this to add date tags to WorkFlowy.

Christopher Su
tag:random.christopher.su,2013:Post/1093773 2016-09-26T20:32:43Z 2016-09-29T18:55:40Z Custom Chrome Search for WorkFlowy

To add a custom search engine to the Chrome omnibar to search WorkFlowy globally:

  1. Open Chrome settings and search for "Manage search engines"
  2. Add a new search engine with your keyword of choice (I use just "w")
  3. For the query string, put https://workflowy.com/#/?q=%s
  4. Now you can enter the keyword into the omnibox, hit tab, and enter your search query
Christopher Su
tag:random.christopher.su,2013:Post/1081041 2016-08-14T03:01:00Z 2016-08-14T19:09:36Z Installing Nginx and PHP on Mac OS X
  1. First, make sure you have Homebrew.
  2. brew install nginx
  3. brew tap homebrew/dupes
  4. brew tap homebrew/php
  5. brew install --without-apache --with-fpm --with-mysql php56
Christopher Su
tag:random.christopher.su,2013:Post/1079473 2016-08-07T20:39:23Z 2016-08-07T20:39:23Z Install Python 3 on Mac OS X

First, install homebrew if you don't already have it:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then run:  brew install python3. This will install python3 and pip3. You can then use pip3 to install other Python 3 dependencies.

Christopher Su
tag:random.christopher.su,2013:Post/1078669 2016-08-04T19:48:24Z 2016-08-04T20:45:16Z Setting up a MPI cluster on Ubuntu machines
  1. Bring up your machines and ensure you have SSH access to them. I'm using two Ubuntu 14.04 LTS VMs.
  2. Install MPI on each machine by running sudo apt-get install libcr-dev mpich2 mpich2-doc
  3. Create an MPI user using sudo adduser mpiuser
  4. Log into mpiuser with su - mpiuser
  5. Generate an ssh key for mpiuser: ssh-keygen
  6. Append the newly generated public key (~/.ssh/id_rsa.pub) to the other machine's ~/.ssh/authorized_keys file
  7. Set up NFS for a shared file system
    1. On one machine:
      1. sudo apt-get install nfs-kernel-server
      2. mkdir mpi_shared
      3. Add /home/mpiuser/mpi_shared *(rw,sync,no_root_squash,no_subtree_check) to /etc/exports
      4. exportfs -a
      5. sudo service nfs-kernel-server restart
    2. On the other:
      1. sudo apt-get install nfs-common
      2. mkdir mpi_shared
      3. Add <other machine hostname>:/home/mpiuser/mpi_shared /home/mpiuser/mpi_shared cloud nfs to /etc/fstab

Christopher Su
tag:random.christopher.su,2013:Post/1078274 2016-08-03T01:44:49Z 2017-07-08T23:54:13Z Lesser known FastMail features
I just discovered a bunch of other things that FastMail can do (besides just hosting my email):
  • DNS server
  • File storage
  • Website host
  • Website redirects
  • Automatic photo galleries from files
  • SMS via email (haven't figured this one out yet)
  • Note-taking (notes sync via IMAP)
  • 2FA with U2F and YubiKey OTP support
Christopher Su
tag:random.christopher.su,2013:Post/1078068 2016-08-02T05:30:47Z 2016-08-02T05:33:49Z Fix "must access using HTTPS" error on PyPi upload

If you get an error that looks like this when you try to upload a PyPi package:

Even though your .pypirc looks correct:

Then you probably want to use the "-r" parameter on the upload for "setuptools":

Christopher Su
tag:random.christopher.su,2013:Post/1078022 2016-08-02T01:40:52Z 2020-01-23T08:39:14Z Posthaven wish list These are some features I wish Posthaven had:
  • Two factor authentication
  • Change post permalink after saving
  • Set up custom redirects
  • Password protect individual posts
  • Disqus comments
  • HTML customization/theming
  • Change favicon
  • Manually share posts on publish (currently only allows per-post opt-out of autopost)
  • Additional export formats (e.g. JSON)
  • Render Markdown sent via email
Christopher Su
tag:random.christopher.su,2013:Post/1078001 2016-08-02T01:00:00Z 2016-08-05T12:50:11Z iOS apps that lack an Android equivalent

These are some iOS apps that I wish had decent Android equivalents.

Christopher Su
tag:random.christopher.su,2013:Post/1077766 2016-08-01T04:54:55Z 2016-08-01T06:16:34Z Moving to Posthaven

I've decided to finally move my blog from Jekyll, hosted on GitHub Pages, to Posthaven. None of the existing content will be moved and will continue to reside at the current location. Instead, new posts will be published here, on Posthaven.

Here are the main reasons behind the move to Posthaven:

  • Much less time needs to be spent on website maintenance
  • Posthaven has a great pledge to keep content and links alive
  • Posting by email and web is easier and more flexible than pushing flat files through git
  • Posthaven implements tags and archives better than I do in Jekyll
  • I can use Posthaven to power other sites

I also intend to increase throughput on the blog and on writing in general.

Christopher Su
tag:random.christopher.su,2013:Post/1077757 2016-08-01T03:59:55Z 2016-08-01T04:02:37Z Random

This website will be a very high throughput blog where I can post miscellaneous thoughts (that are too long for Twitter, too short for the blog, and don't belong anywhere else) and get stable permalinks to share them with.

Christopher Su