First install powertop and TLP . We use powertop to estimate power usage when unplugged and TLP to run as a service

sudo apt install powertop tlp

I then did a little tweaking in my /etc/rc.local

#!/bin/sh -e

# Temp disable bluetooth
modprobe -r btusb

# Autosuspend USB Razer Keyboard after 5 minutes 
echo '300000' > '/sys/bus/usb/devices/3-8/power/autosuspend_delay_ms'
echo 'auto' > '/sys/bus/usb/devices/3-8/power/control'

# VM writeback timeout
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

exit 0

Lastly switch from NVidia GTX 1650 to the Intel Iris Pro

Microbit via WebUSB on Ubuntu 18.04

- 1 min read

Make sure you are running the latest firmware on the microbit

Create a new udev rule

sudo nano /etc/udev/rules.d/80-microbit.rules

With the following content

SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE="0660", GROUP="plugdev"

Then if you want non-admin users to be able to use it (like your kids) run

sudo usermod -a -G plugdev non-admin-user

If you are admin you just need to unplug and replug the microbit (the udev rules run on hot-plug), if you are non-admin you will need to logout and back in to get the updated user groups

Ubuntu file limits 18.04

- 1 min read

sudo nano /etc/systemd/user.conf

DefaultLimitNOFILE=65535

sudo nano /etc/systemd/system.conf

DefaultLimitNOFILE=65535

sudo nano /etc/security/limits.conf

* hard nofile 65535
* soft nofile 65535

Source

So I’ve been working on a little side project for the last couple of weeks to try and create a video based training school to allow myself to scale and maybe not have to repeat myself as much when ever I join a new client.

So I decided to take my post on the Uncommon Sense and turn that into a mini course to try things out.

This was in some ways just an excuse to learn about DSLR filming (read buy some toys), non-linear editing, colour grading etc. Now it’s not perfect (the audio isn’t great as my shotgun mic wasn’t working) but it feels good enough to share.

Uncommon Sense

- 2 mins read

Just because something is compelling doesn’t mean it’s right
i.e. transitive dependencies or the easiest location to add feature X in your codebase

Plugins are a sign of bad composeability or lack of craftsmanship or both
i.e Ridiculous NPM modules that plugin your test tool into your transpiler into your bundler into your web server or equally insane Spring plugins. Maybe look at the unix way…

Libraries are overused and under understood
i.e most day to day problems are easier to solve from first principles than deciphering the README of some library. 

GitHub Get Public Keys for a User

- 1 min read
https://api.github.com/users/danielbodart/keys

Will return

[
  {
    "id": 11647754,
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhoeoQelGjp0Oz3m64SV8AszPTyxlK1jJ8lYlW28WaSK5hu79BemIibekO06P2aA47vhI8hc4R90aqE0Ja1qG6A+jkezn2jeSzZZq7/dvoYFC0i96ljlJTKoOY5E0P4/259giTL1wtMbJrYfFutmVMBidHiOzA1dnLTrZthOuYGlanZL7oazfrz4Ht+ZdvoMoIFqU8yRnW/E903dn2DjH6Wk2dhsdP1QssbOtu3BNguhpcuVksrKw7hqrxCpiJW7Eo7z8yg6qP+KbzGF6G4UmA1/VDn5RFwNC7bvSShirYasEyAOrMHcUiCyvvvtT0a+SlsVfYbyH8wm5Ci38D9HK1"
  },
  {
    "id": 26992755,
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJDZbFgT04IDx5SECPFnHlJfwq/aHkhGr2sgSl0gqo3fOy48du/DPy4VH5cAk0qiLbT8dfzgMmkQm8EourUidZHORlbfbzzptMhWnbwEQbfXBuVyVa1Us5MV6Y0IV0TDOjNIALi6z3QTqJPtoOOfuRnDoumGCnl7bqxaKNrreoVm2vc7ep6yKuBR9HqDBJ6cN6KZ08IYFWjora1CscwsKC2EP6LWcnLsLVh2x4ZgJI0mDtnQ8hHedWmvQGhcyctKg1WdtcrrsVQESwlwDCiEVK9MypThYdZfVhh8d0JTApw37+QVkDW/oQeSMkKEyfss3wuOCCoGiJmurwM18Q/6V7"
  }
]

Should return them in the same order as https://github.com/settings/keys

Ubuntu Theme - Arc or Materia

- 1 min read
# Install Arc soft fork
sudo add-apt-repository ppa:fossfreedom/arc-gtk-theme-daily
sudo apt-get install arc-theme
gsettings set org.gnome.desktop.interface gtk-theme 'Arc-Dark'

# Materia
sudo apt install materia-gtk-theme
gsettings set org.gnome.desktop.interface gtk-theme 'Materia-dark-compact'

# https://github.com/daniruiz/flat-remix
sudo add-apt-repository ppa:daniruiz/flat-remix
sudo apt-get install flat-remix
gsettings set org.gnome.desktop.interface icon-theme 'Flat-Remix-Blue-Dark'

Ubuntu Bash Git Branch Prompt!

- 1 min read
# Git branch in prompt.
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}

export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]:\[\033[32m\]\$(parse_git_branch)\[\033[00m\]\$ "

This is compatible with the default colour prompt in Ubuntu 16.04, put this in you ~/.bashrc.

Original version (non Ubuntu specific)