[2013-10-15] Prism Break, helpful links to get more privacy

You can find here some interesting links for all kind of alternatives. For my self i switched from blogger.com to a static jekyll blog hosted on github. It is not perfect yet, but good enough for now.

[2013-10-15] Sorted tag cloud for jekyll that support spaces

Tobias Sjösten wrote a nice article about how to create a tag cloud in jekyll without using any plugin. But one thing bothered me a little. The tags came in the order, how they where introdouced in the blog posts. I wanted them to be sorted alphabetically.

On stackoverflow was a solution to iterate over an hash ordered by its keys. I improved it a little, so we can use spaces and underscores and mixed them together.

Tobias iterated directly over the categories:

{{"{%"}} for category in site.categories %}
  ...
{{"{%"}} endfor %}

And he accessed the category name with category | first and the list of posts with category | last.

{{"{%"}} capture cat_list %}{{"{%"}} for cat in site.categories %}{{ cat | first }}{{"{%"}} if forloop.last != true%}|{{"{%"}} endif %}{{"{%"}} endfor %}{{"{%"}} endcapture %}
{{"{%"}} assign sorted_cats = cat_list | split:'|' |  sort %}

Now I can just iterate over the sorted list like that:

{{"{%"}} for catname in sorted_cats %}

To access the the posts from a category we can just do this: site.categories[catname].

Here is my final tag cloud:

<ul class="tagcloud">
  {{"{%"}} capture cat_list %}{{"{%"}} for cat in site.categories %}{{ cat | first }}{{"{%"}} if forloop.last != true%}|{{"{%"}} endif %}{{"{%"}} endfor %}{{"{%"}} endcapture %}
  {{"{%"}} assign sorted_cats = cat_list | split:'|' |  sort %}
  {{"{%"}} for catname in sorted_cats %}
    <li style="font-size: {{"{{"}} site.categories[catname] | size | times: 100 | divided_by: site.categories.size | plus: 70 }}%" class="tag">
      <a href="/posts-about/{{"{{"}} catname | slugize }}/">
        {{"{{"}} catname }}
      </a>
    </li>
  {{"{%"}} endfor %}
</ul>

If you want to know how the tag cloud works, read the article from Tobias.

[2013-07-04] How to run a differnt shell command but with the same parameters

I had a script that modifies the docstrings from a python file. I use meld to pre check if all the changes are correct.

$ meld clientpackets.py{.new,}

But now I wanted to run the same line but replace just meld with mv. I found the solution at stackoverflow

$ !!:s/meld/mv/ mv clientpackets.py{.new,}

[2013-07-02] Setup aplications specific passwords

I googled so many times for this now.

https://accounts.google.com/IssuedAuthSubTokens?hide_authsub=1

[2013-06-28] install sphere camera on CM 10.1 galaxy S3

  1. get the zip file from here
  2. copy it to your sd card
  3. reboot into the recovery loader (vol up + center + power for 10 sec)
  4. select install zip from sd card and install it.

Remeber, you have to install the zip again if you update your CM image.

[2013-06-28] python tell

Maybe you think that both examples would produce the same output, but the tell of the filehandler will give you a wrong output in the first version. This version is a bit faster but in this case also a bit inaccurate.

infh = open("bigfile")
print infh.tell()
for line in infh:
    # ...
    print infh.tell()
    line = infh.readline()
infh = open("bigfile")
print infh.tell()
line = infh.readline()         
while len(line) > 0:
    # ...
    print infh.tell()
    line = infh.readline()

[2013-06-28] save edited file in vim as root

If you start to edit a file as a regular user and realise you should have done it as root. You can still save the files as root:

:w !sudo tee %

or

:w !sudo tee new-file.name

[2013-06-28] xmacro on Ubuntu

Install it with:

sudo apt-get install xmacro

Record the macro:

xmacrorec2 > yourfile.txt

Now record your keystrokes and mouse movements, to end it just hit Esc.

To play it back, just run it using the text file like so:

xmacroplay "$DISPLAY" < yourfile.txt

Tip: In my case this wasn't enough because the replay was too fast. I just opend the txt file with an text editor and added some of these Lines:

Delay 1

Now it works like a charm :)

[2013-06-20] ninite - a simple autoupdate tool for windows ...

ninite is a simple autoupdate tool that even helps you to ignore ugly spam from updates like java. You can also choose what set of software you want to install and let ninite install it for you automatically.

[2013-06-19] yummly

Yumly has a nice way to search for recipes.