Skip to main content

Posts

Sync FitBit with Google Fit

Finally: sync FitBit and Google Fit at high time resolution!
I have been trying to figure out a way to sync the intra-day (i.e. high time resolution data) from FitBit to Google Fit (and other services/databases). I managed to stumble upon this awesome project: https://github.com/praveendath92/fitbit-googlefit

I installed it on a first gen. Raspberry Pi and set up a cron job to run every morning, after I have weighed my self, and to sync a few days back (since I might forget to sync the FitBit for a few days). It will always overwrite what has been written already, so don't worry about syncing the same steps twice.

My next project is to modify the code to also sync to a local database (PostgreSQL, MariaDB or something)!
Recent posts

Multiple configurations for different external monitor setups in i3wm

General I use i3 window manager (https://i3wm.org/) on my ThinkPad X2xx series Ubuntu Linux work laptop. At work I have a docking bay for the laptop and an external screen connected to it, at home I have just a HDMI cable that I plug in. I really like how i3 makes everything quick and easy, it just takes effort to learn how to set things up, like most Linux things.

Figure: Anyone that recognize this image might find this `guide` useful!

The problem In i3, to set up workspaces on specific monitors, you have to have `workspace X output OUTPUT` in your i3 configuration file (usually at ~/.config/i3/config, but changes with version), where X is workspace number 1 through 10, and OUTPUT is the name of the display output. This means that the workspace output is defined in the i3 configuration file, when i3 is loaded! Put in another way, the variable OUTPUT_E as you see in my file above, is hard coded in the i3 config file at start. You might want to define this variable different depending on…

Installing IRAM GILDAS on Ubuntu

    Figure: Screenshot of GILDAS MAPPIN in action viewing an imported FITS spectral cube.

Fore information on IRAM GILDAS, see http://www.iram.fr/IRAMFR/GILDAS/

NOTE: Updated for Ubuntu 16.04 Xenial Xerus and above.
Nowadays the readme file on the IRAM webpage gives pretty good instructions for Linux as well: http://www.iram.fr/~gildas/dist/gildas.README

First download the source code from http://www.iram.fr/~gildas/dist/index.html
named "gildas-src-mmmyya.tar.gz" where "mmm" is month e.g. Oct, and "yy" is year e.g. 16 and "a" is some letter which signifies the release number, starting with a.

Unpack and enter the directory (it will be installed in the same directory as the unpacked directory, but with "exe" instead of "src" in the name):
tar -xvzf gildas-src-mmmyya.tar
cd gildas-src-mmmyyaFor the new GNOME3 framework, we still need to download libgtk2.0. Hence the dependencies are (including optional dependencies):
sudo apt install gf…

Screen brightness using Fn keys in i3wm on Lenovo Thinkpad X260

Screen brightness using Fn keys in i3wm

I got a new laptop for work, Lenovo Thinkpad X260. Installed Ubuntu 16.04 Xenial Xerus without much problem.
There are several Fn-hotkeys for the F1-F12 keys, most of them do not work out of the box in Ubuntu, at least not when running i3-window manager.
I managed to solve it in the end. This is how. Part of this solution is from
http://ttrmw.co.uk/linux/hardware_button_brightness.html
Thanks for that!

Changing the brightness I figured out that the brightness can be changed with

$ sudo echo VALUE > /sys/class/backlight/intel_backlight/brightness

where VALUE is between 0 and what is given by the output

$ cat /sys/class/backlight/intel_backlight/max_brightness

These paths might be different for you, so you have to figure it out, and edit the paths in the script below to fit your needs.
The script So I created a script that changes the brightness, as mentioned it borrows heavily from the above mentioned page, but there are some changes.

I save it a…

Installing SMA MIRIAD on Ubuntu (2014/05)

What is MIRIAD? See http://bima.astro.umd.edu/miriad/ for information.

Edit : Tested on the Ubuntu 13.04 Raring Ringtail
Edit2 : Tested on the Ubuntu 13.10 Saucy Salamander
Edit3 : Tested on the Ubuntu 14.04 Trusty Tahr

I am not 100% sure about the prerequisites, it should work with the ones below, however (especially after installing IRAM GILDAS).
sudo apt-get install build-essential pgplot5 gfortran libreadline-dev libforms-bin csh cvs Then go and grab the latest binary release from :
ftp://ftp.astro.umd.edu/progs/carma/miriad_201X.X/NOTE: Got into catalog with highest number. At time of writing this is "2014.7". Choose miriad_linux64_u14_gfortran.tar.gz for Ubuntu.
Unpack it where you want it to install:
tar zxf miriad_linux64_BINARY_gfortran.tar.gz where "BINARY" is your Ubuntu version i.e.  miriad_linux64_u14_gfortran.tar.gz for Ubuntu 14.04.

Enter the catalog and run the "install script":
cd miriad
install/make_miriad_starts then to source the miriad binari…

TP-Link WN725N v2 WIFI on the Raspberry PI

TP-Link WN725N v2 on Raspberry Pi at N speeds (150 Mbps). So I managed to get the wireless nano-dongle to work on one of my Raspberry Pi's. It's a TP-Link WN725N version 2. It has N capabilities, and it wasn't easy making sure I got N speeds either, more on that later.
Drivers To get the drivers into the kernel, I used the script downloadable in this forum post:
http://www.raspberrypi.org/forums/viewtopic.php?p=479340#p479340

You might have to edit the script, basically change the part .../phpBB3/... to .../forums/...
Just run the script and reboot.


N-speeds and connecting it to your network  Then we want to make sure we get the N-protocol up and running. The key to this lies in the security settings of the wireless, not the Raspberry Pi.
If you run

iwconfig wlan0

the output should look something like:

wlan0     IEEE 802.11bgn  ESSID:"SSID"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.437 GHz  
Bit Rate:72.2 Mb/s   Sensitivity:0/0  
 …

RATRAN : get RESTFREQ written to FITS file

Current versions of RATRAN (http://www.sron.rug.nl/~vdtak/ratran/) does not put the FITS keyword RESTFREQ and the corresponding value in the output FITS-files by default. Below is a quick fix that I forgot to note down when I figured it out and thus had to rediscover twice...

Note about getting FITS output working:
make sure your shell variable CFITSIO is set to the path where it is installed, on my Ubuntu 13.04 this is CFITSIO=/usr/include:/usr/lib/x86_64-linux-gnu/:/usr/lib (several paths to make sure its correct) and also the LD_LIBRARY_PATH path (e.g. LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/include)

So for the RESTFREQ to be printed we need to add it to the routine 'openfits', so edit 'Ratran_install_dir/sky/openfits.f'

first add restfreq to the definition of the routine
change
SUBROUTINE openfits(lout,outname,naxis,naxes,status) to
SUBROUTINE openfits(lout,outname,naxis,naxes,status,restfreq)  then define the type
DOUBLE PRECISION restfreq this should be added after the d…