Publishing some modules from a larger project - splitting out parts of a monorepo

When developing, often there are parts of the project that are worth releasing as separate independent projects. There is a tool from the Symfony authors - https://github.com/splitsh/lite - which can assist, but it took a little working out.

The script I've ended up using is below. I run it from the root of the project.

It should be usable by simply adjusting the few variables are the top and then run the script with bash.

Drupal8 Manipulating field groups on module install

While working on a timekeeping module I encountered an issue that couldn't be resolved with the config/install & config/optional combinations. This module requires other modules to be installed first, but then some field group manipulation was needed to add the timekeeping tab into the tabs on the main page, luckily, there are tests on the field group module, so with a bit of looking through tests and experimenting, it ends up like this:

hook_install() code

Rancher 2.0 in lxc

Note: Updated slightly now rancher 2.0 is GA.

There are a couple of tricks, but it is possible to get the Rancher beta running in an lxc container with some tweaks. Firstly, the lxc profile needs to be tweaked:

lxc profile edit default

The defaults that worked for me were:

Start a shell in a docker container that refuses to start

Sometimes, containers die, and you need to look inside to resolve, this one liner allows a quick way to adjust the 'container_name' and it will drop you right into the container so you can look around, then cleanup afterwards.

CTR="container_name"; docker commit $(docker ps -a | egrep " ${CTR}$" | awk '{ print $1 }') test; docker run --rm -ti --entrypoint=bash test; docker rmi test

Or maybe as a script, something like:

dnsmasq in ubuntu zesty

The systemd included in ubuntu zesty doesn't work nicely with dnsmasq by default, which is a pain if you are a developer and want to setup a local .test or similar domain. The way around this is to change the /etc/systemd/resolved.conf and uncomment/add a line like:
 

DNSStubListener=no

Then setup you dnsmasq as normal, probably by creating a file /etc/dnsmasq.d/test with the contents:

Getting <ctrl>-<tab> to work in gnome-terminal

If you are used to using <ctrl>-<tab> and <ctrl>-<shift>-<tab> in firefox, chrome, etc, and want to have the same in gnome terminal, its a little tricky, but these commands should get things setup so that it works for you.

 

gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ prev-tab '<Primary><Shift>Tab'

gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ next-tab '<Primary>Tab'

 

 

Enabling <alt>-<space> in Ubuntu for Ulauncher

If you are wanting to use <alt>-<space> as the key for the excellent Ulauncher with Ubuntu, there are a couple of tweaks that you need to do:

1. Ensure that CompizConfig Settings Manager is installed:

apt-get install compizconfig-settings-manager

2. Start the CompizConfig Settings Manager

Go to General, General options, Key bindings and disable Window Menu which is assigned <alt>-<space> by default.

Ubuntu - Large external USB drive slow to unmount, eject or sync

When using a USB HDD (probably a stick as well), there can be large delays when using a Ubuntu machine while waiting for data to be synced to the disk. After much googling, trying different filesystems and tweaking mount options, the solution that worked was:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

Which i found here: http://unix.stackexchange.com/questions/107703/why-is-my-pc-freezing-while-im-copying-a-file-to-a-pendrive/107722#107722 http://lwn.net/Articles/572911/