Bluetooth Breakdown: Sending gatttool commands from my Ubuntu Touch Phone!

Here I am, typing commands from my phone and controlling a Bluetooth Feather!

Of course, the moment of truth! The goal of this whole Bluetooth breakdown project was to figure out how to make my home made auto start work on my Ubuntu Touch phone. Well, here it is, working!

Although the interface could use a face lift.

Last we looked at this, we saw that we could write custom scripts to send the commands from the desktop computer to the BLE auto start, or use interactive mode of gatttool and do the work there. Now we can actually do the same from the terminal of the cell phone.

While this technically counts. We now need a snazzy program that just works with clicky buttons and that sort of thing. So, I suppose that will be the next phase of this project! Stay tuned for adventure!

Linux – keep it simple.

Custom script to build my C++ games

So, I’ve completed section one of my Udemy course. There are eleven sections total. It’s a bit odd, in that the course instructor is using Microsoft Visual Studio, and I am not. Actually, I’m not even using Windows. So there are a few differences that I think are worth noting.

One of the biggest differences, is when he is done adding something, or doing something, he simply presses a debug/play button at the top, and his newfangled app launches. Now, there are several options for good Linux IDE’s to do this sort of thing, but I’m a bit of a minimalist myself, and I feel it helps me learn more as well, so I’ve been using Geany to type out and build the programs.


Geany works great, is lightweight, has a compile and run button, and text color coding specific to whichever language you are working in. To be honest, I couldn’t be happier with the experience. At present, however, I need to link the SFML files to my compiled code to run the game. There are ways to do this in Geany, but I wrote a simple script that does everything for me instead:


# You need libsfml installed on your system!

g++ -c Timber.cpp
g++ Timber.o -o timber-app -lsfml-graphics -lsfml-window -lsfml-system


echo “type ./timber-app to launch”

I call it After I’m done coding, and I’m ready to try my game, I just double click on the script, and it compiles, links, and launches my game. Pretty easy! So far, I’m working through a tree cutting game called “Timber”. You can check it out on my GitLab if you’d like. Just remember, if you download the files, you must install libsfml before running the script.

Linux – keep it simple.

Scripting my zip process!

Every time that I make a kernel adjustment, I have to zip the boot image into a zip file with several other files to make a flash-able zip for my phone. While this is not tremendously laborious, every time I make a kernel adjustment I am also compiling 4 different kernels. Thus, I have to zip the kernels 4 different times.

Being human, I occasionally will make a mistake. Things like a typo, or worse yet, forgetting a directory or file in my zip can have catastrophic consequences! So, I decided to simplify things by making a bash script.

This script is specific for the Lollipop Developer kernel directory, and it resides there. Now a simple command line execution, or GUI double click zips my file with the current date! By God’s grace, it even works!


# zip all files/folders to make a flashable boot image zip.
when=$(date +%C%y%m%d)

zip -r ./aklu-lp-jf-dev-$ ./install/
zip -r ./aklu-lp-jf-dev-$ ./META-INF/
zip -r ./aklu-lp-jf-dev-$ ./system/
zip -r ./aklu-lp-jf-dev-$ ./boot.img
zip -r ./aklu-lp-jf-dev-$ ./file_contexts

echo “Done”

exit 0

Then I applied the same thing to my work on roms that I have made:

# unzip first.
echo “extracting”
unzip -n ./Slim*

# copy updater script.
echo “copying”
cp ./updaterscript/updater-script ./META-INF/com/google/android/updater-script

# zip all files/folders to make a flashable system image zip.
echo “ziping”
when=$(date +%C%y%m%d)

zip -r ./slimlp-jf-$ ./install/
zip -r ./slimlp-jf-$ ./META-INF/
zip -r ./slimlp-jf-$ ./system/
zip -r ./slimlp-jf-$ ./boot.img
zip -r ./slimlp-jf-$ ./file_contexts
zip -r ./slimlp-jf-$ ./system.patch.dat
zip -r ./slimlp-jf-$ ./system.transfer.list
zip -r ./slimlp-jf-$ ./

echo “removing”
# remove old files.
rm -rf ./install/
rm -rf ./META-INF/
rm -rf ./system/
rm -rf ./boot.img
rm -rf ./file_contexts
rm -rf ./system.patch.dat
rm -rf ./system.transfer.list
rm -rf ./

echo “Done”
# exit gracefully.
exit 0

Linux – keep it simple.

My simple calendar script

As some of you know from previous posts, I use JWM as my default window manager. I like to keep things simple and cut down on wasted resources. This helps a lot, as I often run Qemu, Aqemu, or compile Android variants on my older laptop, which is not exactly a resource gold mine. One of the things that I wanted, however, was a lightweight calendar that I could click on and bring up. The original solution was to open up a terminal and simply type “cal”, but that got a little tedious, especially when I already was using the terminal for compiling or something like that.

Eventually, I decided to instead add a shortcut to my JWM start bar, and have that open up a terminal that will run the calendar program for me. The great thing about using a script was that I could specify the colors of the calendar (changing the look), and then give myself an options menu. To make this work with the color, font, or other changes, I actually have the JWM button refer to this first script, by adding this to my .jwmrc file:


Then, at that location, I have this simple first script:


xterm -fg black -bg white -e sh /home/alaskalinuxuser/Documents/scripts/

Which in turn runs this script:



read -p “Would you like a different month? Choose a number or choose (n): ” yn
case $yn in
[1]* ) cal -m jan;;
[2]* ) cal -m feb;;
[3]* ) cal -m mar;;
[4]* ) cal -m apr;;
[5]* ) cal -m may;;
[6]* ) cal -m jun;;
[7]* ) cal -m jul;;
[8]* ) cal -m aug;;
[9]* ) cal -m sep;;
[10]* ) cal -m oct;;
[11]* ) cal -m nov;;
[12]* ) cal -m dec;;
[n]* ) exit 0;;
* ) echo “Please choose 1-12.”;;
echo “I’ll give you 10 seconds to read it.”

sleep 10

exit 0

Here is an example taken from one of the terminals after clicking on it.

June 2016
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30

Would you like a different month? Choose a number or choose (n): 2
February 2016
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29

I’ll give you 10 seconds to read it.

I played around with the colors and settings for a while. I think that I have it tuned for what I like, but others may wish for something else. Essentially, I found that if I open the calendar, I almost always want to see the current month, so that is the default. Sometimes, however, I found that I wanted a different month. So the script asks you if you want a different month by month number. After choosing another month, or selecting no, the window will close after 10 seconds of viewing. Usually that is ample time for me to look at what I wanted to see. Obviously the time could be adjusted. Perhaps more obviously, there are GUI built in calendar applications that probably work 100 times better for the average person. This just works for me.

Linux – Keep it simple.