Month: September 2017

Easily Switching Between i3 Modifiers

In the search to make my computing experience as ergonomic as possible (read: mouse free), I use i3.  I change between a built-in laptop keyboard where I would like to use the Windows key aka Super aka mod4, and an ErgoDox where I use AltGr aka ISO_Level3_Shift aka mod5.

I have two scripts to facilitate easily switching between them. A command line tool:


#!/bin/bash
# i3changemod
# CLI tool to switch between i3 modifiers by editing the i3 config.

case $1 in
1)
sed -i "s|set \$mod Mod4|set \$mod Mod1|g" /home/$U/.i3/config
sed -i "s|set \$mod Mod5|set \$mod Mod1|g" /home/$U/.i3/config
;;
4)
sed -i "s|set \$mod Mod1|set \$mod Mod4|g" /home/$U/.i3/config
sed -i "s|set \$mod Mod5|set \$mod Mod4|g" /home/$U/.i3/config
;;
5)
sed -i "s|set \$mod Mod1|set \$mod Mod5|g" /home/$U/.i3/config
sed -i "s|set \$mod Mod4|set \$mod Mod5|g" /home/$U/.i3/config
;;
esac

The default shortcut to restart i3 in-place is mod+shift+r. If you do not have the modifier key, you can’t restart it. So, I added another shortcut:
bindsym Ctrl+Shift+h restart


#!/bin/bash
# GUI tool to pick an i3 modofier, uses i3changemod script.

#i3changemod is located in my private binaries path..
PATH=$PATH:/home/$U/bin/

command=$(zenity --list --text "Change i3 Modifier" --radiolist \
--column "Pick" --column "Command" --column " Label" \
TRUE 'i3changemod 1' ' Alt: mod1' \
FALSE 'i3changemod 4' ' Super: mod4' \
FALSE 'i3changemod 5' ' AltGr: mod5' \
);
#$command $1
$command

i3-msg restart

# for my ergodox:
xmodmap -e 'keycode 104 = ISO_Level3_Shift' # 104=kp enter

For convenience, I added the xmodmap command that I need to map AltGr on to KP Enter on my ergodox, rather than having to use another keyboard shortcut for that too.

Moving MariaDB Data Drama

For those of you who work with MySQL on CentOS or RedHat servers on a regular basis, running out of room for large MySQL databases on the root partition is pretty common.  The default options in the OS installer suggest a 30GB root partition which has probably been the default value for at least ten years.  Normally, this is easy to remedy. However, I was trying this on a server with MariaDB …

Trying this both via editing my.cnf and by simply a symlink produces failure:

Sep 14 16:49:06 id27131.1wpo.com mysqld[22796]: 2017-09-14 16:49:06 140313610287360 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB) starting as process 22796 …
Sep 14 16:49:06 id27131.1wpo.com mysqld[22796]: 2017-09-14 16:49:06 140313610287360 [Warning] Can’t create test file /var/lib/mysql/id27131.lower-test64 ID=15680 PROTO=UDP SPT=53 DPT=60246 LEN=192 UID=25 GID=25

Looks like it may be due to a bug with mariadb!

A tutorial on DO says you need to specify the socket for the MySQL client.. i didnt even try that as mysqld fails to start!
Seems like this would have to be done by changing  the variable basedir not datadir, I have yet to try that.

[Top]

Ergodox Scavenge Build

I bought my first ErgoDox from a coworker. Bringing a keyboard back and forth to work is a pain in the ass, so I built another one.

I used to have what I am pretty sure was a Chicony 5581.

Chicony 5581 Keyboard

Chicony 5581 Keyboard

For whatever reason some years back, during the height of my take-shit-apart-without-a-concrete-goal-in-mind phase, I lost the top half of the case, some components of the track ball, and some keycaps. Well, turns out this sucker used Cherry MX Blue switches. They feel quite a bit different from the low mile switches in my aluminum-acrylic-sandwich bodied ErgoDox I use at work. I’m not sure if the MX blues from ’88 are equivalent to modern days ones. Anyway I figured I would put those to use eventually.

Naked Chicony Keyboard

Naked Chicony Keyboard

Chicony Controller

Chicony Controller

Chicony Close Up

Chicony Close Up

Chicony Printed Circuit Board Back

Chicony Printed Circuit Board Back

Chicony Printed Circuit Board Back Detail

Chicony Printed Circuit Board Back Detail

Weller Soldering Iron

Weller Soldering Iron

There have been several ways to order ErgoDox keyboards either completely assembled or as a kit.  Currently you can get an assembled ErgoDox from ergodox-ez.com but starting at $270 its awfully expensive. Well, I have these key switches just waiting for a purpose, and key switches make up a large amount of the price of any mechanical keyboard.  Also, I already had a set of keycaps which aren’t included in kits anyway, so, instead of a kit I went ahead and ordered a pair of PCBs from mechanicalkeyboards.com, a teensy from PJRC and other miscellaneous bits from DigiKey.

It took a while and more than a little elbow grease to harvest the switches.  If you have not done something like this it involves jamming a screw driver under the switch while alternating between which leads you hit with a soldering iron.  The trusty ol’ Weller I inherited from my dad’s days of television repair got the job done, love that thing.

ErgoDox Printed Circuit Board

ErgoDox Printed Circuit Board

While the keycaps from the Chicony are doubleshot, they do not suit the ErgoDox well as they are sculpted, not flat DSA, which does not facilitate customizing your layout.  I did end up using a different set of non-DSA keycaps for the alpha which looked better matched with blank DSA caps I had for the modifier keys.

 

ErgoDox Teensy Controller

ErgoDox Teensy Controller

ErgoDox 3D Printed Assembly in Progress 1

ErgoDox 3D Printed Assembly in Progress 1

ErgoDox 3D Printed Assembly in Progress Close Up

ErgoDox 3D Printed Assembly in Progress Close Up

ErgoDox 3D Printed Assembled 2

ErgoDox 3D Printed Assembled 2

ErgoDox 3D Printed Assembled 4

ErgoDox 3D Printed Assembled 4

ErgoDox 3D Printed Assembled 3

ErgoDox 3D Printed Assembled 3

[Top]

Less Syntax Highlighting on Ubuntu 16.04 and Debian 8

Looking at shell scripts or just about anything without highlighting is painful. I use less a lot to page through long stuff, so why not have some color?

sudo apt install source-highlight

then add the following to your .bashrc:

export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=" -R "

This is modified from a script on GitHub. That script is specific to CentOS

[Top]

MechWarrior Chronological Playthrough Intro

For a few months I’ve been on a bit of a BattleTech / MechWarrior kick. One of the things that crossed my mind is how disjointed most of the MechWarrior games are chronologically:

    The first releases, BattleTech: Crescent Hawk’s Inception in 1988 and MechWarrior in 1989 were sensibly enough set in the original or ‘classic’ BT time period in 3028.
    The sequel to BT:CHI, Crescent Hawk’s Revenge began right after BT:CHI but made jumps forward as far as the Battle of Luthien in 3052. This one covers a lot of ground.
    Next, released in 1995 the ground breaking MechWarrior 2: 31st Century Combat inexplicably advances the timeline to 3057. In a major departure the backdrop is in Clan space rather than the Inner Sphere. The story is basically completely unrelated to events in prior titles, and I’m not even sure if they are explained in-game / a link is made to earlier titles in-game.
    1996’s MechWarrior2: Mercenaries reverts to a spheroid protagonist and takes a time machine back to 3044 and concludes at the Battle of Luthien .. uh, again.
    For 1998’s MechCommander and 1999’s MechWarrior 3 the timeline leaped forward to 3059 and finally from here on out the releases actually increment the timeline predictably. What a mess

Trying to wrap your head around any of that is a waste, not to mention the glaring differences from cannon that many of the games exhibit.
But hey why not figure out the chronological order and play them? So, here are all 18 games:


Game		Year		Published	Plot/Era/Locale		
------		----		---------	--------------
mw1		3024-3028+	1989
mw snes		3027		1993	
bt: chi		3028		1988	Chara III (Pacifica)	
bt: chr		3028-3052	1990	Lyons, War of 3039, Luthien
mw2 mercs	3044-3052	1996	Clan Invasion!
mw 3050		3050		1995	Clan Invasion
mw2 31cc	3057		1995	Refusal War
mw2 gbl?	late 3050s	1995
mc1		3059		1998	Operation Bulldog
mw3		3059		1999	Post OpBulldog, Serpent
mw3 pm		3060		1999	
mcx		3060		1999	Post OpBulldog
mw4: v		3062		2000	FedCom civil war
mw4: bk		3060s		2000	FedCom civil war
mw4: mercs	3062-67		2002	FedCom civil war
mc2		3063		2001	FedCom civil war
ma		~3067-81	2002	WoB Jihad
ma2		~3067-81	2004
[Top]

MechWarrior Retrospective

I came across a great YouTube channel The Examined Life (of Gaming). You can tell this guy is a true nerd by his fofxStudios YouTube URL … my kind of guy! Well he happens to be as nerdy as I am about all things MechWarrior and has a great series of videos critiquing the games and going over their history. Check out the playlist here MechWarrior Retrospective

[Top]