outsmartin

...coding is fun :)

Limit Spotifys bandwith needs with trickle

I had the problem that spotify sometimes uses my bandwith in a spontaneaus manner. To fight that behaviour I found the small program trickle which does work quite good.

To install just:

1
sudo apt-get install trickle

Then to start with spotify I use:

1
trickle -u 5 -d 200 spotify

which limits the upload to 5 KB/s and download to 200 KB/s.

No more laggy ssh sessions because the next song is coming up :)

Howto: Setup Ubuntu 12.04 for Ruby/Rails development on an Asus U44S Ultrabook

This article was in the making some time ago, but somehow I managed to delete my notes while installing… so here is another attempt.

starting point

  • The Asus U44S
  • Usb Stick with Ubuntu 12.04 64bit (for the 8GB ram) link for the lazy

things I wanted

  • a nice stable setup for programming
  • vim setup
  • rvm setup
  • zsh setup

things I did

First thing to do is install ubuntu + all upgrades it wanted to do and then reboot for the kernel stuff.

Now to get support for the multigpu setup install bumblebee:

sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia

Then a lot of packages you need to get rolling:

sudo apt-get install vim-gnome build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

You can skip this one if you are on 32bit. These files are needed to use the android sdk and other things you might want to use.

sudo apt-get install ia32-libs

Now you can install zsh if you want to have a shell with some modern features like git branch markers and other goodies.

sudo apt-get install zsh

I like using oh-my-zsh :) read up on it on its github page, to install just

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
chsh -s /bin/zsh

I had to restart at this point so ubuntu would accept the new login shell.

Now we install RVM for convenient per project ruby package and version isolation.

curl -L https://get.rvm.io | bash -s stable --ruby

Restart the terminal, so your enviroment variables are all set, then

rvm install 1.9.3

should install the most recent ruby, if you think that is not the most recent version(2.0 is coming soon) just check with a quick

rvm list known

and install accordingly.

After installing (I had to change the settings of the terminal default profile to use a login shell at this point) you can use

rvm use 1.9.3 --default

to use this version by default.

ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Should give output like shown.

Now you can

gem install rails

rails new my_project

and you are set for using Ruby on Rails :).

Some extras

It is a good idea to set up your dotfiles now, you probably want a:

.zshrc: You already got one by installing ohmyzsh, but there are lots of goodies to add and themes to explore.

.gitconfig: You probably want to write your name or nickname in there.

Here is my config:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[alias]
st = status
ci = commit
requests = fetch origin +refs/merge-requests/*:refs/merge-requests/*
unpushed = log origin/master..HEAD

[color]
branch = auto
diff = auto
interactive = auto
status = auto

[user]
name = Your Name
email = your@email.com

.vimrc + .vim:

Maybe you already got a setup or you can always look at existing setups, for example:

I want to add some more things I use daily:

Yakuake:

sudo apt-get install yakuake

I use this one all the time with a slightly changed Solarized theme and I really love it.

The multiload indicator for ubuntu. Somehow it is not in Unity by default…

sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload

Feel free to give me hints on optimizations for the process.

Howto copy text out of protected PDF files

I often get asked how to copy the text out of protected PDFs in Windows. Authors can mark their PDFs as protected to apply certain restrictions like commenting or copying. But not all Readers care about them. There are a lot of old Readers that allow you to copy.

The default PDF-Reader in Ubuntu doesn’t care as well and easily lets you copy the content. So go and get Evince for Windows.

Interessante Online-Kurse

Ab 2012 werden von englischsprachigen Universitäten Kurse in verschiedenen Bereichen angeboten.

Hier die komplette Liste der Kurse:

Ich werde mir sicherlich auch das eine oder andere anschauen. Ist ja alles kostenfrei! :)

Solarized Colorscheme für Vim

Seit kurzem benutze ich das Solarized Colorscheme für Vim und will hier eine kurze Installationsanleitung posten.

  • Ihr benötigt die Colorscheme Dateien. Wenn ihr pathogen für Vim benutzt, könnt ihr das github Repository clonen:
1
git clone git://github.com/altercation/vim-colors-solarized.git ~/.vim/bundle/vim-colors-solarized
  • Da das Colorscheme 256 Farben benötigt, muss das Terminal ebenfalls darauf abgestimmt werden. Dazu entweder ein passendes Farbschema herunterladen oder wie in meinem Fall(ich nutze yakuake) in der .bashrc folgende Zeile einfügen:
1
export TERM='xterm-256color'
  • Jetzt kann in der .vimrc das colorscheme aktiviert werden:
1
2
3
let g:solarized_termcolors=256 "benoetigt für xterm mit 256 farben
    set background=dark "mit light gibts einen hellen hintergrund
    colorscheme solarized

Viel Spaß mit eurem sonnigen Design.

fontface compass und Ruby on Rails 3.1

Wenn man genug von Arial und Helvetica hat, kann man mit dem schon seit Internet Explorer 5 vorhandenem CSS-Feature @fontface eigene Schriftarten einbetten.

Da ich eine Weile probiert habe hier die Kurzform:

  1. Als erstes eine zur Nutzung freigegebene Schriftart finden und zum Beispiel bei fontsquirrel in alle benötigten Typen umwandeln lassen.
  2. Im Ordner app/assets/ einen neuen Ordner fonts anlegen. Hier rein die Schriftdateien .ttf .eot .otf. Rails sucht seit der neusten Version nach dem fonts Ordner, es muss nichts angepasst werden.
  3. Jetzt möchte ich zwei Beispiele zeigen, einmal mit compass (und Sass) und einmal ohne.

Als erstes einmal mit Sass und compass, das ein mixin anbietet :).

fontface mit compass
1
2
@import compass/css3
+font-face("FontName", font-files("fontname.ttf", truetype, "fontname.otf", opentype))

Nun das ganze nochmal mit CSS.

mit CSS
1
2
3
4
5
6
7
8
@font-face {
  font-family: 'FontName';
  src:src url('fontname.eot');
  src: local('notexistingdummy'),
    url('fontname.woff') format('woff'),
    url('fontname.ttf') format('truetype'),
    url('fontname.svg#webfont') format('svg');
}

Viel Spaß damit und auf die Lizenzen achten!

Vim Konfiguration für die HTW Dresden

In der Firma, in der ich tätig bin, haben wir eine fertige Vim-Umgebung, die über Github zugänglich ist. Da in der HTW aber leider kein Vim mit Ruby-Unterstützung vorhanden ist, habe ich unsere normale Umgebung geforkt und ein bisschen zurechtgestutzt, sodass man damit arbeiten kann.

1
2
3
4
5
ssh sxxxxx@ilux150.informatik.htw-dresden.de #erstmal auf den ilux verbinden
git clone git://github.com/outsmartin/vimfiles.git ~/.vim
ln -s ~/.vim/vimrc ~/.vimrc
cd ~/.vim
git submodule update --init

Nachdem diese Aktionen durchgeführt wurden, lohnt sich der Blick auf das Github Repository. Hier findet man in der README Verlinkungen und Anleitungen für die Plugins.

Die wichtigsten Features sind:

  • CodeCompletion
  • Faltung
  • Gutes Syntaxhighlighting
  • verbesserte Usability (wenn man Tabs usw benutzt :))
  • und vieles weitere mehr…

Viel Spaß mit Vim (und C in DBS3)

Vim 7.3 mit Ruby Unterstützung kompilieren

Meinen Blog möchte ich mit einem kleinen HOWTO beginnen. Um Vim als IDE für Ruby-on-Rails zu nutzen, muss die Ruby Unterstützung reinkompiliert werden. Dies ist nicht besonders kompliziert und mit ein paar Handgriffen getan. Wichtig ist, dass vor der Installation alle alten Vim Versionen entfernt werden(vim-tiny oder vim-gnome…). Der Installationsvorgang sieht dann wie folgt aus:

1
2
3
4
5
6
7
8
cd /usr/src
sudo su
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
tar jxf vim-7.3.tar.bz2
cd vim73/
./configure --with-features=huge --enable-rubyinterp --enable-gui=gnome2
make
make install

Im Anschluss einfach mal vim ausführen und gucken, ob alles geht :)

happy hacking :)