Gade(b)llaa

A blog where I talk about the stuff I make, do and more

Wednesday, March 9, 2016

[HOWTO] Automatically adjust adaptive brightness based on time/dawn/dusk (root required, sadly)

A quick intro: I use CF.lumen to adjust my screen temperature during the evening and night and I love it. It's highly customizable and the one thing I really like is that it actually filters the colors instead of just overlaying a color. That means that black remains black (because there is no color to filter) instead of a getting an orange/reddish tint. And CF.lumen offers a ton of options to let you tweak its behaviour.

One of those options is that, besides the actual color temperature and amount of red, blue and green, it lets you configure the display brightness for when it's day, evening and night. But that's exactly where I ran into a bit of trouble because I use Android's Adaptive Display feature (the one that lets you set the display brightness but still gives the system some room to maneuver based on the amount of light the device detects in your surroundings). The problem is that apps can only set the system brightness when Adaptive Brightness is disabled. Which is stupid.

Luckily, Tasker comes to the rescue.

I'm not going into a lot of detail about what Tasker is and what it does and-so-on but lets keep it at this: Tasker lets you configure certain rules (called 'profiles') and do things (called 'tasks') based on those rules. And there are a LOT of plugins available for it, extending its not-so-limited standard feature set even more.

I found out that Android actually does provide for a "settings key" to change the brightness when the Adaptive Brightness feature is enabled[1]: "screen_auto_brightness_adj". And you can use that key by running a shell command with Tasker.

Now, you could of course just set a time and run the command based on that but - in most parts of the world - the sun doesn't come up and goes down at the same time of the day. Here's where the Tasker plugin Twilight comes to the rescue. It lets you create rules based on your location's dawn and dusk times!

So just a quick rundown (I'll update this section later but it's getting late right now so this'll have to do for now):

  1. Open Tasker and create a new profile > State
  2. Search for twilight, tap it and then the 'pen' icon
  3. Choose your from/until and confirm
  4. Create a new task, give it a useful name ("Brightness Night" or something)
  5. Add a command, search for "run shell"
  6. Paste "settings put system screen_auto_brightness_adj [value]" where [value] is between -1 and 1.
  7. Don't forget to check the 'run as root' option or it won't work.
  8. Confirm everything and in the Profile section of Tasker longpress the task you just created and choose "Add exit task"
  9. Create a new task, name it "Brightness Day" and repeat step 6 and 7 but now with the brightness value you want to use during daylight.
  10. Done! Keep pressing 'back' until Tasker exits (this is important, it seems Tasker doesn't actually save things until you do this!)
[1] Some manufacturers - among them Samsung of course - decided to change and/or remove this key. It might still exist but you probably need to google for it..

Thursday, December 31, 2015

[List] Best android tablet apps of now

Yesterday I posted a list of my favorite apps that I use on my phone. In that list I excluded Google apps and apps I solely use on my tablets.

In this post I'll be focusing on tablet apps. Most of those are centered around media consumption so in this post I'll use a slightly different approach compared to the others and list them per category.

Comic readers

One of the things I use my tablets for is reading comics but since I my collection is spread over various sources I use a bunch of apps for that.


If you own a large digital comic collection because you started collecting comics in the days before they were available digitally (and you digitized them yourself or.. uhmm.. found some other questionable(?) source) then ComicRack is the app to use for reading them. I've tested quite a lot of comic readers before settling on this one. It has a ton of options and can even sync your progress with the desktop app (if you have that installed). If you buy the pro version it does that over wifi, too.


Both Marvel and DC have their own comic reader app but if you look closely at who developed it you'll find that, in both cases, Comixology is the company behind the apps. So why bother with two separate apps when there is one that offers the same functionality and lets you buy comics from both publishers?  Besides giving access to pretty much the entire catalogue of the two biggest comic publishers and others (the only one I find missing is Dark Horse?), Comics is a pretty feature complete comic reader app.


I wasn't planning on having Google apps in this list but for this post I'm making an exception. Why? Because it's just to darn nice to be able to buy content from the same source as you do for apps. Play Books got a nice update recently to make it easier to discover and read comics so if it's possible to buy a specific comic on the Google Play Store I do. It's not as feature complete as Comixology's app but instead of giving you a lot of option this app just does what it needs to and that's it. And sometimes 'simply works' is preferable to a lot of options.

Movies and series


There are currently two basic models for consuming payed video content: The one where you buy or rent something and the subscription model where you pay a monthly fee and can consume all the content you want. Google's Play Movies & TV service is of the former catefory. One of the reasons it's so good is because Google has a lot of experience with streaming videos thanks to Youtube. Besides working on a multitude of platforms besides Android if you have an internet connection (Chromecast, the web) you can also download movies on your Android device so you can watch them offline.


The idea is simple: you pay a monthly subscription fee (somewhere between 8 and 10 euros/dollars) and for that you get a access to a pretty large collection of movies and especially series that you can watch. One thing to keep in mind: their catalogue depends on which region you live in. The US and UK regions tend to offer more content but that's just my personal experience. Netflix is available on even more platforms than Google Play Movies (web, iOS, smart-tv's, chromecast, etc) so it's worth checking it out even if you don't plan to use your tablet for video consuming.


I've talked about this app before so go check out that post. I'll just say this: it's awesome :D


It's Youtube. Nuff' said.

Games

I don't often play games, but when I do, these are my top picks. Note: I'm not into casual gaming but you'll probably notice that if you look at the list below :)


Actually, you should check out the entire Broken Sword series - if you're into point-and-click adventures, that is. Even if you're not it's well worth a try as the Broken Sword series is one of the best in its genre.


Awesome take on the Hitman franchise. Its turn-based board game mechanics are completely different from the non-mobile games but somehow do make complete sense and the game utilizes sound design to really bring you into the Hitman universe.


Just like Hitman Go but with a subtle difference in gameplay and puzzles that align nicely with the Tomb Raider franchise.


This game has been available on iOS for ages but was released on Android sometime last year. The controls are a bit less intuitive than its PC/console counterpart but the pace of the game allows for this. It's not a cheap game but you get somewhere between 20 and 50 hours worth of gameplay and one of Bioware's best stories ever in return.

Did I miss something?

This is it. I've listed pretty much every app I think that other people should have a look at. Sure, I use (a lot) more than just these apps but I'm quite confident that these are the best of them.

Except when it comes to Google apps. And I haven't talked about any of the apps I don't use on my phone but I think are crucial for tablets. I'll talk about those in my next(ish) post(s).

Anyway. Did I miss something? Do you disagree on one or more of my choices? Let me know!

Wednesday, December 30, 2015

[List] Best android apps of now


I've seen a lot of "best apps [of 2015]" lists come by lately and I thought two things:

  • They often contain apps that have been around before 2015. So the title is wrong?
  • I can make a list of my own! How hard can it be?!

I've chosen to keep this post free of any Google app because most of those come pre-installed on Android devices anyway (even though some people insist on using alternatives). Neither will you find any apps I solely use on my tablets. Those are for another time and post.

One other thing: This list is sorted in alphabetical order. Not because I don't want to give the impression that there is some order of importance to them, but primarily because I'm literally going through my app drawer.

Anyway. My best apps of *now*:

Feedly

I've been using lots of apps to get my daily fix of news in the past but this app has replaced them all. It's just a lot nicer to maintain a single list of sources and being able to read them everywhere I go and on any device I use - whether it's on Android, iOS, pc or mac. Even though I do think that the team behind Feedly got some minor UI things wrong (like a reversed sharing icon.. WHY?!) and they require you to enter your Pocket username and password(!) if you want to save articles directly to pocket - even though Pocket has an API that works perfectly fine for adding, retrieving and modifying articles - it's just an awesome app that I can't do without these days.

Oh, in case you're wondering: Feedly is basically a RSS reader that presents articles in magazine style. Other views can be configured and it offers all the other options I require.

Feedly on Google Play

Pocket

Another app I rely on heavily. Pocket lets you save articles and other links you come across on the web so you can get back to them later on. It can even store those items on your phone so you can go through the list when you're offline. It's super useful for those times when you don't have time to read a full article or you just want to read it on another device that better suits the content. It can also be used as a quick way to store some things you want to organize later on. It's so damn good that I even built a web app on top of its API to overcome its one shortcoming on mobile: quickly cleaning up that ever growing list. Besides this, it's simple, clean and reliable.

Pocket on Google Play

Flynx

This app may not be a must-have for everyone, but it is for me. Flynx opens web links in a floating bubble that allows you to go on with your business and let the page load in the background. It's a lot like Link Bubble but improves on it in a few ways: It has an "article view" mode, for one, that strips pretty much all of the layout (and ads!) of a page and shows a clean article for you to read on. Secondly, it looks a lot cleaner - although that's just a matter of a less cluttered UI - and, in my experience, a lot less hungry when it comes to your device's resources.

Flynx on Google Play

Icerrr

Okay this is just blatent self promotion. I'll keep it short: a free radio streaming app that lets you set alarms and isn't trying to be a social platform.

Read more and download Icerrr

Material Player

The name of this app may be a bit misleading. It doesn't play materials, it's an audio book player. And it's pretty good! It has all the features one would want (good looks, snappy performance, keeping track of reading positions per book, snooze timers, etc). Why am I not using my default music app to listen audio books? Because when I want to listen to a song in-between I lose my reading position. By using a separate app I can safely listen to a book, listen to music and then come back to my book later on.

Material Player on Google Play

Plex

If you own a hefty digital movie and/or series collection and a bunch of devices you want to be able to watch those on then Plex is the app for you. It's a free service that requires you to install a server app on your computer that can stream its entire local database to all of your devices, including (smart) TV's, chromecast, tablets, Apple TV, other computers (via its free web app), etc. It even works when you're at another location, for example at work or at your parent's during the holidays. Just open the right ports on your computer and router and of you go. It does require you to organize your collection in two categories - namely movies and series - to properly detect and recognize all of the videos but once you've done that it does its work pretty flawlessly and rarely makes a mistake matching a movie or series against a database.

For a monthly fee you can add some bonus features but I found they are not really required. The Android and iOS app do cost money but you can watch and cast your movies from the web app or on your smart-tv for free.

Read more about Plex

Pocket Casts

I've recently discovered the world of podcasts and I think I'm already hooked for life - and Pocket Casts is the app I use to get my fix. It looks good, syncs your listening position between devices and platforms and has a sh*tload of other useful features like automatically downloading new episodes and deleting episodes that you've listened. It does cost money but it's not an absurd amount of it and to be frank: developers need to eat, too. The web app does cost a bit more but they deliver a great experience so it's probably worth it.

If you are into podcasts, you want this app. There's not much more to say.

Pocket Casts on Google Play

Pushbullet

Another one of my favorite apps in the 'productivity/tools' category. Pushbullet started as an app that lets you push things like links, files and notifications between devices but it has grown to be much more than just that. It allows you to receive and send SMS messages from your computer or tablet via your phone, acts like a full blown messaging app and more.

Recently, the Pushbullet team announced a Pro subscription plan and with that came limitations on some of the existing functionalities but in most cases you won't need it unless you really are a power user. I find the fee they ask to be a bit high for what I use it for but if you're a Pushbullet Power User and you use at least two of the pro features, it might be worth the bucks.

Besides the Android and (somewhat limited) iOS app they offer Chrome and Firefox extensions, a web app and desktop apps for Windows and Mac.

Pushbullet on Google Play

Root Explorer

Even though most of my devices are not rooted, Root Explorer is my weapon of choice when it comes to file management. Its looks are a bit outdated but its functionality is not: it does it all, from general file management to file and folder permission modifications (root obviously required for this), etc. A free version is also available (simply called Explorer), it basically lacks the root features.

If Root Explorer's interface is a bit daunting for you I'd recommend Solid Explorer (free or paid version).

Root Explorer on Google Play

Talon

After Falcon started to show some weird issues which never got fixed even though I payed good money for it, I returned to my second-favorite 3rd party Twitter client: Talon. I came across some really good looking alternatives lately but since I don't feel like paying yet another fee for a not-horrible Twitter experience (I'm looking at you, Twitter) I'm staying with Talon and I'm very confident in that choice. It lets you register with up to two accounts, has lots of options when it comes to styling and organizing the UI, the developer is updating it with new features and fixes regularly and, in general, it's just a really good Twitter app. Nuff' said.

Talon on Google Play

Weather Timeline

My favorite weather app. Why? Because its design is super simple yet manages to cram a lot of information in there and all that while still looking awesome (and maybe not like what you might have come to expect from a weather app). If that didn't convince you, it also boasts a ton of features like choosing a weather database that offers the most accurate results for your location, a bunch of notifications like daily forecast and "weather alarms", an android wear app and more.

Weather Timeline on Google Play

WifiOpti 2.0

I've tried (and partially succeeded) in keeping the self promotion to a minimum in this list, but I couldn't resist when it comes to this little tool. WifiOpti 2.0 finds its origins in the Android Gingerbread (and earlier) days when wifi was a terrible thing to keep enabled when you weren't actively using it because it drained your battery like crazy. Thus, the idea was basically to have it manage when your wifi was on and more importantly: when it should be off. Since then a lot has changed and leaving wifi on is not so bad, especially now Google also uses it to keep track of your location without having to access the (even more) power hungry GPS sensor in your phone.

So what does WifiOpti do? It primarily tries to remedy one of the last annoyances that still haunts wifi on Android: staying connected to a wifi access point that is pretty much out of reach even when others are available. It also helps prioritizing between hotspots and metered networks.

The interface may still need some work but since the primary function of WifiOpti is to do its job in the background and have you *not* micro manage things, you should not have to bother with it too much. Anyway, too much talk already. Just have a look here or continue straight onto the Play Store page below.

Note: WifiOpti 2.0 requires Android 4.4 or higher. On older devices you may also take a loot at its predecessor

WifiOpti 2.0 on Google Play

For the power users 

DiskUsage

A super simple app that visualizes disk usage on your device so you can quickly see what's taking up so much storage space and act on it.

System Monitor

The one app to replace them all when it comes to monitoring your device: cpu frequency statistics, memory usage, cpu usage per app, battery statistics, network usage, and more. And it has floating and homescreen widgets for most of those stats, too! A lite version is also available.

Tasker

Automate all the things. This app can really do it all - and if it can't, there probably is a plugin that extends its functionality to even fill that gap. It has a steep learning curve but once you master this app you are the true master of your device.

Wifi Analyzer

Doesn't look all that fancy and you probably won't need it often, but when you do you're glad you can. Wifi Analyzer offers a bunch of ways to view and compare wifi signals. Super useful when you want to figure out where to place your wifi router or on which frequency it should run.

Did I miss something?

This is it. I've listed pretty much every app I think that other people should have a look at. Sure, I use (a lot) more than just these apps but I'm quite confident that these are the best of them.

Except when it comes to Google apps. And I haven't talked about any of the apps I don't use on my phone but I think are crucial for tablets. I'll talk about those in my next(ish) post(s).

Anyway. Did I miss something? Do you disagree on one or more of my choices? Let me know!

Wednesday, December 16, 2015

Dailygadellaa: The Making Of...

"A picture says more than a thousand words" so I'll keep this short (and still have a post worth of more than 4000 words :)). For anyone wondering what my workflow is for creating a #dailygadellaa comic: here we go!

Although I know how to work with a wacom I prefer to use pen and paper so we start out with exactly that.

In most cases I do one quick sketch of what I want to draw to get a good idea of the face expression I want and optional objects I need and where to place them. In this case I did a quick Google Image Search to find an example of a Star Wars Episode VII stormtrooper helmet. When I have a good idea of that the image should look like I do the final version. I almost never do a pencil sketch and just draw the image using a black pen. If something goes wrong I start over.

Then I take a picture using my phone. Fun fact: I've been using phones that are known for their 'terrible' cameras since I started the comic (Nexus 4, Moto G 2013, Moto X 2013). Especially the Motorola cameras use a lot of post-processing to get the image up to an acceptable level and that actually works pretty well for this use case.

Next up: some quick image processing using the (Motorola) Gallery app:

  • Punch
  • Border (with smallest thickness)
  • Exposure (+50)
  • Black and white (+50)
  • Save
  • Share
Done!

You can follow my #dailygadellaa comics on Tumblr, Google+ and Twitter

Friday, December 4, 2015

PageSpeed Insights and optimizing websites

The day before yesterday I let Google have a look at my website via the PageSpeed Insights tool. In case you're not familiar with it: it's an online tool that analyzes a website and gives it a score based on how fast it loads, how well images are compressed, etc. It's really nice to get some ideas about which areas of your site may need some more work (just in case you thought you were done).

I knew my site was far from perfect but it actually didn't score that bad. I didn't write down the actual score but it was above 50/100 for Speed and 100/100 for user experience. The things I should improve on, according to Google, were:
  • Leverage browser caching
  • Minify html, css and javascript
  • Optimize images
  • Eliminate render-blocking JavaScript and CSS in above-the-fold content
I postponed the first and forth point for now. Browser caching doesn't make too much sense at this time as I'm still working on the site and things may change. Cache is your worst enemy in those scenarios. Regarding render-blocking javascript and css (because it's loaded in the <head> section so the <body> won't render until it has loaded all the files): javascript is needed for my site to work as soon as content is shown (so I need it before any content is shown). It can be solved by showing a splash/loading screen and wait for the javascript to load asynchronous. But since minifying javascript will make loading the javascript faster it will also partially eliminate some of the loading time my website requires before it can show something. Css and fonts can be loaded async so that's not a real issue but I still have to do that.

So I had a look at minifying css, javascript and optimizing the images.

I like to try and fix problems my own way before I look at other possibilities (sorry, I'm an autodidact, it's what we do ;)) I created a small python project that runs through all the files in a directory (including subdirectories, of course) and optimizes what it can:
  • Javascript using Python-jsmin
  • Css using Python-csscompressor
  • Images using PIL (or Pillow) and later also PyImageOptimiser
It all works pretty well. My css and javascript files are reduced by an average of 30 to 50% and jpegs are reduced to 50% quality and that saves a lot, too. The only thing I still need to look into some more are png'ss - Google keeps saying I should optimize them but I already compressed them with everything PIL has to give (9 out of 9) and when I try to optimize the palet (the available colors in the image) it produces larger images than the original files. So I guess Photoshop isn't all that stupid, after all. It actually does a better job at optimizing png's than me. I gave PyImageOptimiser a try and after fixing some indentation errors in its code it did a pretty good job. Still, Google keeps telling me I should optimize my images. Not sure if Google is wrong or just not updating the files it checks? Oh well, I'll look into that some more.

After I tested it with my new website and found that it was working well I decided it would be nice if it would also work for other projects. So I let it run through the webapp part of Icerrr and it reduced the size of the www folder by ~40%! The installer shrunk from ~6MB to a little less than 4MB. Nice!

I'll open source the project as soon as I made it a little more easy to configure (command line options, probably) and put it on my github. I'll also update this post with a link to the repo.

UPDATE:

Here's the github: https://github.com/rejhgadellaa/rgpy-tools/tree/master/rgpy-web-optimizer

Tuesday, December 1, 2015

[TLDR] Building a new website

I recently mustered all of my courage and started working on a new version of my website. And since I also got a brand new blog and I'm trying to develop a habit where I actually post something once in a while, I thought it might be a good idea to write down some of my thoughts and observations.

Let's begin with my motivations for starting the project in the first place.

When I recently realized (most of) my recent projects all have their own landing page but there wasn't really one place that linked to them all, I came to the realization that, if anything, "my website" (portal, portfolio, personal site - lot's of "p's") was the place to address that issue.

The thing is that I've postponed revamping my website for a long time for a reason: I hated that, before I changed my website to a single splash screen with a minimal amount of links, my website was constantly out-of-date and that adding new projects took me a lot of time (effort, actually). I was constantly struggling with questions like "Should I translate this to English? It's a dutch project.. but my site is in English.." - stuff like that. So my website went from going from this (archived version I keep online just to look up some old projects once every while) to a VERY barebones landing page with just a bunch of links. My reasoning was: I'll maintain the individual projects using an individual environment and approach.

In the end, it was a nice idea but one splash screen as a homepage with just a few links to projects wasn't enough. I needed a bit more. Luckily, I do enjoy solving problems and building stuff. The time had come to do just that.

I always found the website I designed for Stichting z25.org's Makers Workshops pretty nice because it divided content in clearly separated 'categories' in the form of a series of screens. And, besides being a bit heavy on the memory, the design was pretty adaptive to mobile. That, combined with the stuff I learned from my recent Pocketr revamp project, made me pretty confident that I could solve my website's issue of not properly giving an overview of what I've recently been up to.

What my solution is? Well, for the work-in-progress you can take a look here. I update it regularly with new features and bugfixes so it is still very much in flux.

As for this post, I'll continue the story at a later time and date. I need some sleep now :)

Monday, November 30, 2015

[HOWTO] Raspi tricks: reboot your router every so often

Okay let me immediately start by saying: this is absolutely not a thing that only the Raspberry Pi can do - but because it's such a small device and it uses relatively little power I think it's safe to assume that lots of people have this thing turned on day and night. And in that case, it's the ideal device to do some maintenance jobs over the network.

This little guide will show you how I've set up my Raspi to reset my router every day (it's a long story but one of my routers is very unstable in its current set up and I haven't figured out how to fix it yet).

UPDATE:

I forgot to mention which router I use this script for. It's a ASUS RT N66U.

As Jeroen pointed out in the comments it can be a bit more complicated if you use other routers. If you have a Fritz!box (xs4all tends to supply these as modems/routers) you are in luck:
https://github.com/jpluimers/bash-fritzclient

REQUIREMENTS

  • A raspberry pi
  • A router with telnet access
  • Some basic knowledge of linux, bash and cron jobs

LET'S GO!

First you probably need to install telnet:

#install telnet
sudo apt-get install telnet

Now you have telnet give it a try and log in with your router

#create a connection
telnet [ip-of-router]

You should be prompted for your username and password. Once you provided these, try the reboot command:

#reboot router
reboot

If this is all working we can move on to the next step: create a little bash script that runs a bunch of commands. It doesn't really matter where you put it but I like to have it in /home/pi/scripts/

#create directory
mkdir ~/scripts

#create file
nano ~/scripts/cronjob-router-reboot.sh

Paste the following script

#!/bin/sh
# replace cmd1 for the command to execute

host=192.168.0.179
port=23
user=YOURUSERNAME
pass=YOURPASSWORD
cmd1='reboot'

rm -f /home/pi/scripts/log-cronjob-router-reboot.txt

( echo open ${host}
sleep 2
echo ${user}
sleep 1
echo ${pass}
sleep 1
echo ${cmd1}
sleep 1

echo quit

sleep 2
 ) | /usr/bin/telnet > home/pi/scripts/log-cronjob-router-reboot.txt

You do need to edit the 'host', 'user' and 'pass' values at the top :). Press Ctrl+X, Y and then ENTER to save the file and exit.

Now make the file executable:

#make executable
chmod +x cronjob-router-reboot.sh

And try it out!

# run script
/home/pi/scripts/cronjob-router-reboot.sh

The last thing we need to do now is add it as a cron job. Cron, in case you don't know, is like Windows' Task Scheduler: it lets you run things at a given time and/or interval.

#open crontab
crontab -e

At the bottom, paste the following to start the job every day at 4:00 in the morning (see the text for a short description of that the first 5 characters do and how you can use them to schedule things)

0 4 * * * /home/pi/scripts/cronjob-router-reboot.sh

That's it! Save it and exit. Your raspberry should now reboot your router every day at 4:00 AM :D