Dear Future Me

KDE 4.4 keyboard shortcuts

2010-05-23
It just took me about 20 minutes to figure out where the h*#@!! are the settings for keyboard shortcuts under KDE 4.4… My hard drive was failing, so I bought another one (I have plenty of backups :) yay!), install it, install Kubuntu 10.04, run a script I have that configure some stuff for me (vim, bashrc, and other config files). Then I have to configure some keyboard shortcuts for my favorite applications.   Read more

Goodbye Facebook

2010-05-06

… In which I try to explain why I am closing my Facebook account.

Not that it’s a big deal or anything, just thought that some people may care. if not, fine.

A bit of background first. When I started using facebook, I would use it in my “zombie of the web” mode…. Meaning “being bored, clicking on stuff, following infinite link chains in Wikipedia, random Youtube videos, and sometimes ending up on Facebook”. Then it became more of a habit: it was still evolving, new and fun. Lately I sort of moved away from it. I still go sometimes have a look at my friend’s pictures, check what they are doing, and I definitely read ALL of their status updates since they pop up on my phone’s home screen. I also “reconnected” with some old friends from middle school or something.¬†And Facebook is great for all that!

So I like Facebook (FB) right ?

  Read more

Reading data from a Wintech Alti bike computer under linux

2010-03-28
I got this Wintech Alti bike computer. It looks like a USB key, and connects to your computer where you can download the data. Of course, the software only works under Windows. I tried to look at the serial communication between a virtual machine and the wintech, but with no success so far. It would be almost ok, if the software that comes with it could export the data in any readable format.   Read more

Django custom tags and filters

2010-02-28
3 examples of django custom tags and filters. 1 from django.template import Node, Library, resolve_variable 2 3 # Tag that set a context variable. 4 # Example uses are in setvar function. It's kinda stupid/dirty function 5 # for assigning lists as well. It should probably be 2 different tags. 6 # But it's easy to do from here. 7 class SetVar(Node): 8 def __init__(self, variable, value, valueIsVariable=False): 9 self.valueIsVariable = valueIsVariable 10 self.variable = variable 11 self.value = value 12 13 def render(self, context): 14 if self.valueIsVariable: 15 context.dicts[-1][self.variable] = \ 16 resolve_variable(self.value, context) 17 else: 18 context.dicts[-1][self.variable] = self.value 19 return '' 20 21 def setvar(parser, token): 22 bits = token.split_contents() 23 # first case: {{ "{% setvar myVar as otherVar "}}%} 24 if len(bits) == 4 and bits[2] == "as": 25 return SetVar(bits[1], bits[3], True) 26 # second case: {{ "{% setvar myVar abcd "}}%} 27 # myVar = "abcd" 28 if len(bits) == 3: 29 return SetVar(bits[1], bits[2]) 30 # {{ "{% setvar myVar "}}%} 31 # myVar = None 32 elif len(bits) == 2: 33 return SetVar(bits[1], None) 34 # {{ "{% setvar myVar a b c d e f "}}%} 35 # myVar = ['a', 'b', 'c', 'd', 'e', 'f'] 36 return SetVar(bits[1], bits[2:]) 37 38 #========================== 39 # Filter jsid.   Read more

Django template standalone

2010-02-28
When writing a python webserver, using django templates is an easy way to print HTML and have access to powerful functionalities. You may want to use them standalone, without the whole django thing around though. Here are some useful snippet of code to achieve that. You can also have a look at the custom tags and filters used in this example. from django.conf import settings settings.configure(TEMPLATE_DIRS=('templates',), DEBUG=False, TEMPLATE_DEBUG=False) from django import template from django.template import Template, loader, Context def SetupDjangoFiltersAndTags(): # See django doc on hwo to define your own tags and filters.   Read more

Split a GPX file into tracks

2010-02-28

I almost never clear my GPS data logger. As a result, I keep downloading aobut 3 years of waypoints every time I use it. I needed a way to split the GPX file that it outputs.

After 30 minutes of mining the web, nothing convincing enough came up. I figured it would be faster to write that quickly in Scala.

It also shows how to read, parse and write XML in Scala.

  Read more

Read GPS logs from QStarz data logger

2010-02-21
Using MTKBabel: mtkbabel -s 115200 -f gpsdata -t -w -p /dev/ttyUSB0 will write a binary file gpsdata.bin, and 2 files: gpsdata_wpt.gpx with waypoints, and gpsdata_trk.gpx with tracks. Use -c instead of -t -w for a single file with both tracks and waypoints. To empty the memory: mtkbabel -s 115200 -E -p /dev/ttyUSB0 Then use gpicsync to create a kml with pictures (ready for the web). Also, it is possible to   Read more

Simple webserver in python

2010-02-12

Ok, all this code is somewhere on the web, but at least I will know how to find it again….

It shows how to:

  • Write a quick simple python web server
  • Handle GET and POST requests
  • Parse parameters from a GET request (there may be a better way though)
  • Parse parameters from a POST request
  • File upload
  • Set a cookie and read it back
  • Do a simple HTTP redirect

The code is dirty and was extracted from the app I already wrote, trying to remove irrelevant stuff. The HTML in particular are just bits, and do not produce valid HTML pages. But you get the idea.

  Read more

Pdf To Odp

2010-01-08

Initially written to have a pdf presentation written with latex, imported into Google docs. Google docs have the option of reading a pdf, but at the time of this witting, there were not presentation mode for pdf documents, or any ways of importing pdf into a presentation.

  Read more

Qfx To Csv

2009-12-11
So the other day, I downloaded my bank account information. It was offered to me as QFX of Microsoft Money. I needed CSV. Quick search for Qfx2Csv… nothing in the first results that is free, and work under linux. I didn’t search much, since I realized I would spend more time searching than writing a quick piece of code for doing the same thing. Quick and dirty coding :). So just in case I need it again, or if it is useful to someone else.   Read more
« Older Posts Newer Posts »