Sat, 30 Sep 2017

Upgrading android on Nexus 6P


In order to upgrade a rooted Nexus 6P:

The codename for this device is "angler".

  • Download the image.
  • Follow section 9 of this guide.
    • Plug the USB cable in and on a windows terminal check the connection:
      • adb devices
    • Boot into bootloader by holding down power and volume down for five seconds or so and check the connection
      • fastboot devices
    • Flash TWRP if it is not already there. Follow the guide. See this guide too.
    • NOTE that in order to boot into recovery mode the USB cable probably needs to be disconnected.
    • Install Magisk from this guide.
      • Copy the magisk zip file with "adb push G:\g\n6p\Magisk-v14.0.zip /mnt/sdcard"

[/unix/android] permanent link

Sat, 15 Jul 2017

Setting up windows


Keywords: Windows setup

I needed to set up a new Windows 10 box. In case I need to do it again, I'm making a few notes.

Install:

- https://conemu.github.io/
- https://chocolatey.org/
- https://joelpurra.com/projects/X-Mouse_Controls/

- in chocolatey:
  - 7zip
  - autohotkey
  - clementine
  - Firefox
  - GoogleChrome
  - jdownloader
  - logitechgaming
  - Revo.Uninstaller
  - vim
  - virtualbox
  - VirtualBox.ExtensionPack
  - windirstat

- to swap cpas lock and escape
  - download Interception: https://github.com/oblitum/interception/releases/latest
  - as administrator, run install-interception /install
  - add a shortcut to caps2esc.exe to the startup directory
    - Windows-R / shell:startup / add link

[/software/windows] permanent link

Sat, 22 Oct 2016

Swapping caps lock and esc keys


Keywords: Windows capslock escape control caps2esc

On almost all modern keybaords the useless capslock key is right where something useful should be. Initially the control key would have been there. On some keyboards the escape key was there and this influenced the design of vi.

The escape key and the control key can actually be combined such that if you press the key on its own then you get an escape, and if you press it with something else you get the control key. Then you need to put this key where the capslock key is now and move the capslock to the escapse key.

On Windows the Interception library can be used to do this. The steps for Windows 7 are:

- Download and install the Windows Driver Kit from https://www.microsoft.com/en-us/download/details.aspx?id=11800
- Set WDK to C:/WinDDK/7600.16385.1 (or wherever it was installed)
- git clone https://github.com/oblitum/Interception
- run buildit.cmd in the library directory
- run buildit.cmd in the samples/caps2esc directory
- copy caps2esc/objfre_wxp_x86/i386/caps2esc.exe and library/objfre_wxp_x86/i386/interception.dll into a new directory (I use C:/caps2esc)
- add a shortcut to c:/caps2esc/caps2esc.exe to the startup directory

For linux use caps2esc, but this won't work well inside a VM.

I suppose you could download the version I compiled for Windows 7. I have no idea whether it will work for anything else, amd you will need to make sure you are within the licence.

For Windows 10 tihngs are somewhat simpler:

- download Interception: https://github.com/oblitum/interception/releases/latest
- as administrator, run install-interception /install
- add a shortcut to caps2esc.exe to the startup directory
  - Windows-R / shell:startup / add link

[/software/windows] permanent link

Wed, 28 Jan 2015

Debian and conntrack


Keywords: linux debian conntrack

To set up conntrack on debian 6:

# aptitude install conntrack
# modprobe nf_conntrack_ipv4
# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
# cat /proc/net/ip_conntrack
# aptitude install iptstate
# rehash
# iptstate

[/unix] permanent link

Sat, 27 Jul 2013

Installing rvm


Keywords: rvm ruby 1.9.3 tmuxinator zsh

In order to upgrade tmuxinator I needed to run Ruby 1.9.3. So I installed rvm as follows:

$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

and added the following to my .zshrc:

if [[ -e ~/.rvm/scripts/rvm ]] then
    . ~/.rvm/scripts/rvm
    .  ~/.rvm/gems/ruby-1.9.3-p448/gems/tmuxinator-0.6.2/completion/tmuxinator.zsh
fi

then

$ rvm install 1.9.3
$ rvm use 1.9.3 --default
$ gem install tmuxinator

I also had up change my tmuxinator config files:

$ cd ~/.tmuxinator
$ perl -pi.bak -e 's/cli_args/tmux_options/' *.yml
$ perl -pi.bak -e 's/tabs/windows/' *.yml
$ perl -pi.bak -e 's/^project_//' *.yml
$ perl -pi.bak -e 's/-2$/-l -2/' *.yml

The last change there is because with just the "-2" in tmux_options I got the error:

in `tmux_options': undefined method `strip' for -2:Fixnum (NoMethodError)

[/software/ruby] permanent link

Sat, 22 Jun 2013

Postfix and Return-Path


Keywords: linux ubuntu postfix Return-Path Sender From

My family connects to my mail server in order to send mail. But everyone has mail addresses that differ from their login names. On sending mail, postfix would add a Return-Path header matching my username on the mail server. In order to have the correct Return-Path added, I created /etc/postfix/generic with the following content:

local_user1@pjcj.net          user1@example.com
local_user2@pjcj.net          lonelyboy99@example.com

And added to /etc/postfix/main.cf:

smtp_generic_maps = hash:/etc/postfix/generic

Then run:

# postmap /etc/postfix/generic
# service postfix restart



Passing that mail through another server running exim4, I added the following lines to /etc/exim4/exim4.conf:

no_local_from_check
untrusted_set_sender = *

[/unix] permanent link

Sat, 17 Nov 2012

Git cheatsheet


Keywords: git

Merge newer changes on the branch you came from (eg master):

$ git rebase master


Merge your branch:

$ git merge [--no-ff] newbranch


Push a newly created branch upstream:

$ git push -u origin newbranch

-u makes your branch a tracking branch of upstream

.


Create a new tracking branch:

$ git branch -t newbranch origin/newbranch


Delete remote-tracking branch:

$ git branch -r -d origin/oldbranch


Delete remote branch: (see also http://git-scm.com/book/ch3-5.html)

$ git push origin --delete oldbranch


Rewrite history:

$ git rebase -i HEAD~5


Make a branch retroactively (see http://blogs.perl.org/users/mark_leighton_fisher/2012/11/when-to-create-a-branch-in-git.html):

$ git checkout -b newbranch
$ git update-ref refs/heads/master origin/master


Merge a branch that should have been rebased:

$ git fetch https://github.com/user/repo.git upstream_branch:local_newbranch
$ git checkout local_newbranch
$ git rebase master
$ git checkout master
$ git merge -ff-only local_newbranch
$ git branch -d local_newbranch


Create a branch for a pull request:

$ git pull https://github.com/user/repo.git upstream_branch:local_newbranch


Move a branch to a new commit:

$ git branch -f branch_name new_tip_commit


Look at a file from an previous revision:

$ git cat-file -p <sha1>:filename

[/revision_control] permanent link

Fri, 27 Jan 2012

Ubuntu and Notion


Keywords: linux ubuntu notion

I use Notion as my window manager under Ubuntu. Notion is a fork of Ion.

Under Ubuntu 11.10 you can set Notion as your default window manager by creating the file /usr/share/xsessions/notion.desktop with the contents:

[Desktop Entry]
Encoding=UTF-8
Name=Notion
Comment=This session logs you into Notion
Exec=notion
Icon=
Type=Application

Then edit /etc/lightdm/lightdm.conf:

user-session=notion

and if you want to automatically login set:

autologin-user=XXX

where XXX is your username.

[/unix] permanent link

Fri, 28 Oct 2011

Shrinking disks in VirtualBox


Keywords: Virtualbox shrink disk size minimise

Update - 19.07.2014

This is actually a little easier now. Or I know better, perhaps.

Again, there should be no snapshots.

1. On the VM install zerofree:

# aptitude install zerofree

2. Boot into single user mode.

3. Run zero free on each virtual disk:

# zerofree /dev/sda1
# zerofree /dev/sdb1

4. Power down the VM

(On a Windows guest, for steps 1-4 just download and run sdelete -z)

5. On Windows, compact each virtual disk:

> "c:\Program Files\Oracle\VirtualBox\VBoxManage" modifyhd root.vdi --compact

And you're done.


If you've been using VirtualBox for a while with dynamically allocated disks, you've probably found that the size of the virtual disk exceeds that of the data stored therein. Sometimes by quite some ammount. Once used, the disk space is never returned.

I recently bought an SSD and wanted to put one of my Ubuntu virtual machines on it, that being where I do most of my work. However, the three virtual disks being used by that VM had grown quite large - too large to store on my SSD. There were also snapshots in use, despite the VM apparently not using any. This, I suspect, may have been due to mounting a virtual disk from another VM which had snapshots. Or it might not. In any case, things were a little bit of a mess and I wanted to sort them out too.

The first thing I did was to clear out as much of the disks as I could that was just being used for storage. Then we get to the complicated part of trying to reduce their size. I have seen suggestions to use zerofree or resize2fs but it wasn't clear to me whether they worked with ext4. So here is the method I used.

1. Using VirtualBox 4.1.x, clone the VM. This removes all the problems with the snapshots and makes a single definitive copy of all the virtual disks. If you have more than one virtual disk, you could remove those disks beforehand, since copies of those disks are not actually required, though a copy of the disk containing the root filesystem is required.

2. Create new, empty virtual disks for each of your original disks.

3. Add these new empty disks to your VM, along with at least the copy of the root filesystem.

4. Start your VM, run fdisk and mkfs.ext4 or mkswap to create the filesystems.

5. Create mountpoints and mount your new and cloned disks.

6. For all filesystems except the root filesystem, run cp -a to populate the new disk either from the clone, if you made one, or just from wherever they are mounted on the VM.

7. For the root filesystem do the same, but this must be done from the clone.

8. Assume your new root filesystem is mounted as /mnt/root. Run:

# mount -o bind /proc /mnt/root/proc
# mount -o bind /dev /mnt/root/dev
# mount -o bind /dev/pts /mnt/root/dev/pts
# mount -o bind /sys /mnt/root/sys

Edit /etc/fstab to reflect your new disk layout. If possible, it might be easier if you just mount the root filesytem at first and don't use the UUID format.

# chroot /mnt/root
# grub-install --root-directory=/ /dev/hda

Replace hda with whichever device you are booting from.

# update-grub
# exit

9. Create a new virtual machine, use your cloned one, or reuse your old one. Attach the appropriate disks and start the VM. If you are lucky, grub will be set up and the VM will boot.

10. Find out the UUIDs of your partitions by running blkid. Edit /etc/fstab appropriately and reboot.

11. Copy averything to where you want it to be. (My SSD.)

And that's all there is too it!

[/software/virtualbox] permanent link

Tue, 26 Jul 2011

android.process.media has stopped unexpectedly


With Cyanogenmod I kept getting the message:

"the process android.process.media has stopped unexpectedly"

when running Market or a music player.

The fix for me was to umount and then remount the SD card.

[/unix/android] permanent link




September 2017
Sun Mon Tue Wed Thu Fri Sat