Bootstrap Script for rbenv & ruby-build

I’m currently playing around with Rails Apps in virtual environments. To get started, i threw together a little script.

Update: Available as Gist now. Found some stupid things. Will update as needed.

#!/bin/bash
set -e # exit on error
### README
# * built for Ubuntu (Lucid Lynx)
# * uses GIT via SSH because of !@#$% proxy at work
# * installs your desired ruby version (1.9.2-p290 per default) using rbenv
# ** including openssl (needed by bundler)
# ** including sqlite (probably needed for rails apps)
#
# Before you start:
# * put ssh-keys in place
# * $ ssh git@github.com
# * If you're behind a proxy, be sure to set $http_proxy etc!
#
# After the Script has run:
# * reload your .profile
### /README

### CONFIG
# Ruby Version to install
RBVER='1.9.2-p290'
### /CONFIG

PROFILE=~/.profile
# update system, just in case
sudo aptitude update
#sudo aptitude full-upgrade

# install some dependancies
sudo aptitude install -y \
  build-essential zlib1g-dev \
  sqlite3 libsqlite3-dev \
  libssl-dev openssl \
  curl wget git-core

# build-essential zlib1g-dev  required to install ruby
# sqlite3 libsqlite3-dev      required for sqlite gem
# libssl-dev openssl          required for openssl extension
# curl wget git-core          can i haz tools?

cd
### Install rbenv
test -d ~/.rbenv || git clone git@github.com:sstephenson/rbenv.git ~/.rbenv
# modify $PATH and autoload rbenv
grep 'rbenv/bin' $PROFILE &>/dev/null || echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $PROFILE
grep 'rbenv init' $PROFILE &>/dev/null || echo 'eval "$(rbenv init -)"' >> $PROFILE
# reload shell
source $PROFILE

### Install ruby-build
test -d ~/ruby-build || git clone git@github.com:sstephenson/ruby-build.git ~/ruby-build
cd ~/ruby-build && sudo ./install.sh

### Install Ruby
rbenv install $RBVER --with-openssl-dir=/usr/local
# reload binaries
rbenv rehash
# set as default version
rbenv global $RBVER

ruby -v

# set some defaults
test -s ~/.gemrc || echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
echo 'Here is your ~/.gemrc:'
cat ~/.gemrc
echo '=== end of .gemrc ==='

# install bundler
gem install bundler
rbenv rehash

aptitude update: Segmentation Fault

In case i forget again…

Problem on Ubuntu 10.04 (Lucid Lynx) x64:

$ sudo aptitude update
Hit http://security.ubuntu.com lucid-security Release.gpg
Ign http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-en_US
...
Hit http://us.archive.ubuntu.com lucid-updates/multiverse Sources
Reading package lists... Done
Segmentation fault

Solution:

$ sudo rm /var/cache/apt/*.bin
$ sudo apt-get update

Aptitude should now work again.

“The MSI ” failed” when uninstalling VMware Workstation 8 on Windows 7

This has bugged me for 2 days now. There are many forum threads, KB articles and guides out there that point to the right direction, but none of them worked out for me. However, today I finally got rid of Workstation 8!

And here is what I did:

First I got the VMware installer from the VMware Homepage.
Then I opened a command prompt as a local administrator. I switched to the location of the installer, and started it in “Uninstall mode”.

C:\>cd C:\Downloads
C:\Downloads>VMware-workstation-full-8.0.1-528992.exe /x

On the dialogue I choose “Repair”. After the installer finished his work and my machine has rebooted, I was able to uninstall VMware Workstation. iWin!
Questions? Comments?

Keeping SSH-Connections open

while true; do date; sleep `rand -s $(date +%N) -M 30`; done

From `man rand`:

-s number
       the seed for the random numbers generator (default time(NULL))
-M, --max number
       the limit of the random numbers (default 32576)

By setting the seed to `date +%N` (nanoseconds) we can avoid getting multiple zeros out of rand.

How to play Minecraft via Proxy

If you google “Minecraft via proxy”, you’ll find this one:

java -Dhttp.proxyHost=yourproxyserver.com -Dhttp.proxyPort=1234 -jar minecraft.jar

However, this won’t work for current Versions. Reason: HTTPS. Solution:

java -Dhttp.proxyHost=yourproxyserver.com -Dhttp.proxyPort=1234 -Dhttps.proxyHost=yourproxyserver.com -Dhttps.proxyPort=1234 -jar minecraft.jar

Eh voila :D

(Substitute yourproxyserver.com and 1234 with your proxy server and port number)

Note for Windows Users: For Win, you have to type “Minecraft.exe” instead of “minecraft.jar” – the Rest is exactly the same!

Update: To pass proxy authentication, add this:

-Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword

Project schniin.ch: First Steps

(for the beginning of Project schniin.ch see here)

So I’ve set up a basic WordPress installation and showed her where to log in. From there she found her way on her own, has choosen a nice theme (well, it’s purple, but hey, way better than the default theme! ;-) ), customized the page a bit and has already written two blog posts. Not bad for a beginner!

There was an issue with the theme selection. Unfortunately, she picked an outdated one, which displayed some nasty error messages instead of her blog posts…. resulting in my girlfriend telling me “Oops… I think i already broke it :-(

So after half a week I’m pretty impressed how easy-to-use WordPress seems to be! It’s no big deal for geeks like me, but for people usually crafting pricing spreadsheets in Excel it’s not bad! ;-)

Update

It’s not WordPress being easy-to-use, it’s me bein intelligent! :-)

Oh sorry, should have known this! :-)

o Hai!

Oh lord, I should probably blog “a bit” more frequently!
So I’ve decided to write regular blog posts on projects I’m working on…

… speaking of Project, this might proove interesting: A friend of mine talked my girlfriend into starting her own homepage. So this morning, i quickly bought her a domain and installed it on my webserver.

But now… how do you tell a non-geek how to run her own homepage? And I don’t want to run the Site for her either!

So I decided to abuse WordPress as a content management system. I find it quite easy to work with, and she can even edit her Homepage with her iPhone.

Time will show how ingenious my idea was… I’ll keep you posted! ;-)

PS: In case you didn’t notice; for the sake of my engrish skills and broader audience (especially on tech-related topics) I’ve decided to switch to english… God, I think I’ve lost half my english grammar since my time in Vancouver :S