Archive for the ‘Coding’ Category

GPL Your Children!

3 June 2014

Recently my family was discussing the working of patents at the kitchen table. Patents on ideas and objects made are to protect them from being used, copied or changed by others without you wanting or knowing. Besides, it’s your idea after all and people should pay you as the super smart inventor. When I entered the discussion trying to explain the benefits of using GPL, my status as ‘Linux Freak‘ was acknowledged. So far.

Next time I’d better use the LEGO metaphor.

Every weekend we lay on the floor building whatever comes to mind with LEGO. With over 40 years collecting we not only have a huge stack of pieces, but also I have a very rich experience in inventing and building vehicles, airplanes and even my own version of an R2D2 with rotating head and adjustable legs.

r2d2And every time me and my children are building they ask me whether they can

  • have the <device_name> I built to play with;
  • modify the <device_name> into something different / better / faster;
  • use parts of the <device_name> to fit to their inventions.

Being Open Source minded I like them using my invention to accumulate with theirs. Most of my LEGO builds are instantly GPL-led.

But what happens when I just say ‘No‘ to them changing the order, form or colour of my buildings blocks and ripping off any modules? Well, they quit playing with me because in their opinion I don’t foster their creativity. And they are right indeed.

Now the link to Open Source software, city planning, […] and education is obvious. We need to share to make things greater and with better fit for whatever human need. Not only in coding, but also in organizing things, building houses and in a spiritual sense. Thesis – Antithesis – Synthesis is practised with enough eyeballs makes things grow faster, with better fit and chase bugs away easier. Besides: we wouldn’t be able to travel though time if Einstein kept his Theory of Relativity all to himself.

But how do we convince our junior citizens and beginning coders to share their ideas or code and have them mix and accumulate with the inventions of others?

By just playing with them and sharing the mindset of the GPL.

Advertisements

Monitor battery discharge in Linux

25 August 2013

I wondered how long the battery of my Acer Aspire One A110-BW would make me ‘socket-less’. Monitoring by hand is not very practical, so I started to bash around and did some low level coding.

The result is a simple script that monitors the discharging of a laptop battery. It starts with reporting basic info on the condition of the battery. Every 60 seconds the power status is written to the same file. The file and its lines have detailed date and time stamps to compare subsequent reports.

The bash script needs acpi installed, it should be in the repo of any Linux distro. You can run it as a regular user. Needless to say that the laptop should run on battery power…

[user@mybox ~]$ ( date && acpi -V | grep Battery ) > `date +%y%m%d_%Hh%M`_batterylog.txt; sleep 60; while x=0; do (( date && acpi -V | grep Discharging) ; sleep 60 ); done >> `date +%y%m%d_%Hh%M`_batterylog.txt

[changed the %H:M to %Hh%M in the output filename as the colon ‘:’ frustrates filemanagers and other CLI handling]

Bash spreads the output of two subsequent commands (here <date && acpi>) over two lines. I tried <echo -n> to make one line every minute but with no succes yet–it’s something I have to work on. I set monitoring pace to one minute (60 secs) to get detailed reports.

Use this script if you like. If you make interesting improvements I’d like to hear from you!