Geeky me in-front of my Xubuntu computer
my latest Twitter comments

25 RT @eatLocalGrown: Our #children may have a shorter life span than we do thanks to the highly processed, industrialized food they eat. S ...
2012-04-10 07:13:45

29 @vmcink impressive But ditch crappy Vista! I use Win7 in a vbox to test IE9, I'll be doing the same with Win8&IE10 @opera led me to hate Win
2012-03-21 10:00:31

28 @vmcink - I prefer SSH & cygwin if I want simplicity... Ever tried a dual-Windows Linux machine? - I have 2 taskbars, Debian 6 & Windows XP.
2012-03-21 09:48:03

Twitter feed provided by the
syronTwitter PHP Class

 rambling on

P2PU – A University of opportunity!

I’ve been overwhelmed with the cool classes happening at P2PU.org

After a short stint fixing a minor bug in the Title page of this project months ago, I decided to come back to it and see how things were getting along. And I must say I’m very impressed.

The community is vibrant, with a huge amount of new Classes, it’s also officially endorsed by Mozilla!

They use a badge system to encourage, and there are plenty of ways to get social on the site. You can even follow people!

The thing that really impresses me is the huge amount of work that has gone into thinking out Mentoring & setting up classes.

I’m wondering why Leslie Hawthorn has gotten involved a smidgeon of a bit, because I reckon that free taco’s might be on the menu for the team at P2PU.org! Keeping mentoring & learning fun is the hardest part of interaction for web enthusiasts.

My only qualm so far is the huge overhead that Django page refreshes are probably making on the server. So I’m hoping to get involved and help change that!

Look forward to seeing you on P2PU.org – A place where you and me can learn together to make the world a better place, and level the learning curve a bit between friends.

Posted in P2PU | 1 Comment

Setting up P2PU Lernanta on Debian 6

Today I wanted to do some development on an awesome project called Lernanta.

P2PU Lernanta are a awesome team of FOSWAPP developers who want to change this world for the better, I really wanted to fix some small bugs in Lernanta.

So first I had to get the git repo:
git clone git@github.com:/lernanta.git

Then we have to setup a bunch of things…

sudo apt-get install python-dev python-setuptools python-lxml python-imaging python-m2crypto gettext make sqlite3 python-pysqlite2

Setup pip and virtualenvwrapper & I couldn’t find python-8601 in debian, so I used easy install…

sudo easy_install virtualenv
sudo easy_install pip
sudo pip install virtualenvwrapper
sudo easy_install iso8601

I don’t like putting things in my .bashrc, to be run at every login, so…


export WORKON_HOME=/home/yourusername/.virtualenvs; export PIP_VIRTUALENV_BASE=$WORKON_HOME; export PIP_RESPECT_VIRTUALENV=true

then run…
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv lernanta

Make sure your in lernanta’s git repo and run…
workon lernanta
pip install -r lernanta/lernanta/requirements/prod.txt

Here is where I ran into more problems… debian sqeezy couldn’t find a swig!

I asked around then used some google fu and found it…

http://downloads.sourceforge.net/project/swig/

downloaded it and…

./configure && make && make install

oh no, another error! – no pcre!!
sudo apt-get install libpcre++-dev libpcre++0

./configure && make && make install

FIXED! – Whew!

pip install -r lernanta/lernanta/requirements/prod.txt
pip install -r lernanta/requirements/dev.txt
cp lernanta/settings_local.dist.py /lernanta/settings_local.py
cd lernanta
make syncdb

ERROR! — But thanks to the dev email list, we have a fix! – Yay!

pip install PIL --upgrade
make syncdb

Then it was plain sailing…

python manage.py runserver

Finally, a working lernanta install on debian sqeezy!!

Posted in P2PU, Python | Leave a comment

Opening last git commit files into vim

So, this is a little script to load up only the files that have changed in the last git commit.
(only works with php, py, js, css or html files)

$ /usr/local/sbin/gitved

#!/bin/bash 

newfiles=`git log -2 | grep commit | sed -ne '$!{h;n;G;}' -e p | sed 's#^.......##g;s/...........................$//g;' | sed '{:q;N;s/\n/../g}' | while read -r f; do git diff $f; done | grep "diff --git a/" | sed 's#^.............##g;s#b/*.*$##g' | while read -r n; do if [ ${n: -5} == ".html" ] || [ ${n: -3} == ".py" ] || [ ${n: -4} == ".php" ] || [ ${n: -3} == ".js" ] || [ ${n: -3} == ".css" ];then echo "$newn"; echo "$n"; fi; done | sed '{:q;N;s/\n//g}' | sed '{:q;N;s/\n/  /g}'`
vim -o $newfiles

A typical problem for me is editing files that I last committed awhile back in a git branch, so now I can run this command which will load up the files.

While in vim I reset that last commit

:! to git reset HEAD^

hack, hackity hack…

Then I check each change and stage them…

:! git add -p

and commit

:! git commit -m 'message'

I have another script that I use to run format-patch, though I might talk about that someday I did write this script based on it.

Posted in Bash, Git | 1 Comment

Learn Django and Python with OpenHatch

It just rocks when you know your doing something awesome.
For the last 5 to 8 weeks I’ve been contributing to an OpenSource project, called OpenHatch.

For me, OpenHatch was the sort of project that you might take a first preliminary look at, then decide that you just haven’t got the time for. If I had done that I wouldn’t have made some awesome friends, and learnt a whole heap more along the way.
Now that I’m reasonably comfortable with using git and playing with Django templates, I’m trying to stretch my legs a bit.
but I have found even the basics reasonably difficult, because I’ve had a total aversion to Django’s Documentation, for some reason it just doesn’t appeal to me.

I’ve have found getting into coding more difficult than most people, probably because when I first started work I chose a job that was design work, doing advertisements & commercial print for a newspaper/print shop.
I do remember doing some programming at my one year at Polytech (a form of tertiary study), but since I wasn’t using this day to day those skills didn’t get honed at all.

Dive in & Learn
Now that I’m enjoying doing things for OpenHatch I want more people to break their own barriers down to jumping in and getting things done!
Some of the issues that we have on OpenHatch’s bugtracker are labeled bitesize for a good reason, they are an excellent opportunity for newcomers like me to jump into OpenHatch’s code and hack out a solution, if you feel that you lack some of the skills that are required, do some of OpenHatch’s missions!!

There is a team of people who are contributing and helping new people at OpenHatch.
I now know some of their reasons for doing so. I really love helping people and being part of a team of people helping others is absolutely awesome!

Come on! Take a look! Maybe you’ll join in on the learning curve at OpenHatch.

Posted in OpenHatch | Comments Off

Make Opera the Debian 6 default browser

I have a program installed that calls xdg-open, I wanted it to use Opera instead of Iceweasel.
I tried running…

$ update-alternatives --config x-www-browser

But because I always install Opera using ./install from their tarball (to keep up-to-date with the latest builds) I couldn’t, debian 6 doesn’t even realise that I have got opera installed cause it’s not a .deb.The solution?
To edit the x-www-browser file, under the if
RUNTIME_ICEWEASEL test add a if for opera…

##
## Load system and user properties
##

if [ "${ICEWEASEL_DSP}" ] ; then
    RUNTIME_ICEWEASEL_DSP="${ICEWEASEL_DSP}"
fi

if [ -f "/usr/bin/opera" ]; then
    . /usr/bin/opera
    exit 0
fi

Posted in general | Leave a comment

Mobile Gmail in a Opera Panel

Need to check your gmail regularly?
Love the Opera browser and hardly ever leave it?
I placed m.gmail.com into a Panel right where I need it so that I can keep up with those important messages quicker and easier.

Here’s the steps:

  1. Enter m.gmail.com into your address bar & sign in if needed.
  2. Push F4 in Opera to open up your panels – Click the plus (+) sign
    > Then Click New Web Panel… tick Show in panel and give it a nickname
  3. Click on your newly recreated Gmail icon.

I find this extremely useful and you can use other Panels like this to include your Twitter and other mobile sites inside Opera.
Enjoy!

Posted in Opera | Leave a comment

Why is our world like it is?

View this video, I believe it has hit the nail on the head, and shows exactly why we are not having the influence on this world for Him that we should.

Posted in its-life | Leave a comment

Plowshare – Pretty much limited to download only

I looked through the documentation for Plowshare, and it does not support uploading through 4Shared and a lot of other file storage services. This puts a hogwash on using it for Backups.

Posted in Backups, Bash | Leave a comment

Plowshare – uploader/downloader

Plowshare is a command-line downloader/uploader for some of the most popular file-sharing websites.
It works on UNIX-like systems and presently supports Megaupload, Rapidshare, 2Shared, 4Shared, ZShare, Badongo, Divshare.com, Depositfiles, Mediafire etc.
I’m in the process of testing how good Plowshare supports uploading/downloading from my 4shared account.
Since I have a 15Gb account, I can see this as a good way to perform backups.
Will report my findings soon, stay tuned.

Posted in Backups, Bash | Leave a comment

Dropbox backups with Bash

I discovered I could backup important files on my system using crontab and dropbox today, it’s awesome. I had a small problem in the implementation of it, namely that the script I found by Andrea Fabrizi, was slightly broken when uploading directories.
I decided that it really wasn’t wise to send the files one by one up a pipe.
So I decided to archive them, then send that nice big archive, including a SQL database dump.
Here’s my final two scripts:

First the one that does the uploading….
# vim /usr/local/sbin/dropboxupload

#!/bin/bash
DROPBOX_USER="" # your dropbox user email address
DROPBOX_PASS="" # your dropbox password
	#
	# Code based on DropBox Uploader 0.7 from http://www.andreafabrizi.it/?dropbox_uploader
	LOGIN_URL="https://www.dropbox.com/login"
	HOME_URL="https://www.dropbox.com/home"
	UPLOAD_URL="https://dl-web.dropbox.com/upload"
	COOKIE_FILE="/tmp/du_cookie_$RANDOM"
	RESPONSE_FILE="/tmp/du_resp_$RANDOM"

    UPLOAD_FILE=$1
    DEST_FOLDER=$2

	# Login
	echo -ne " > Logging in..."
	curl- -s -i -c $COOKIE_FILE -o $RESPONSE_FILE --data "login_email=$DROPBOX_USER&login_password=$DROPBOX_PASS&t=$TOKEN" "$LOGIN_URL"
	grep "location: /home" $RESPONSE_FILE > /dev/null

	if [ $? -ne 0 ]; then
		echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
		exit 1
	else
		echo -e " OK"
	fi

	# Load home page
	echo -ne " > Loading Home..."
	curl- -s -i -b "$COOKIE_FILE" -o "$RESPONSE_FILE" "$HOME_URL"

	if [ $? -ne 0 ]; then
		echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
		exit 1
	else
		echo -e " OK"
	fi

	# Get token
	TOKEN=$(cat "$RESPONSE_FILE" | tr -d '\n' | sed 's/.*<form action="https:\/\/dl-web.dropbox.com\/upload"[^>]*>\s*<input type="hidden" name="t" value="\([a-z 0-9]*\)".*/\1/')

	# Upload file
	echo -ne " > Uploading '$UPLOAD_FILE' to 'DROPBOX$DEST_FOLDER/'..."
    curl- -s -i -b $COOKIE_FILE -o $RESPONSE_FILE -F "plain=yes" -F "dest=$DEST_FOLDER" -F "t=$TOKEN" -F "file=@$UPLOAD_FILE"  "$UPLOAD_URL"
    grep "HTTP/1.1 302 FOUND" "$RESPONSE_FILE" > /dev/null

    if [ $? -ne 0 ]; then
        echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
        exit 1
    else
        echo -e " OK"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
    fi

Ok, now for the script to backup everything and use the above script to send the tarball.
# vim /usr/local/sbin/dropbox_backup

DROPBOX_DIR="Backups" # where you want to save it in your Dropbox account
BACKUP_SRC="/var/www/ /etc/nginx/ /etc/php5/cgi/ /usr/local/sbin/" #anything else you can think of that is a critical setting file for you
BACKUP_DST="/tmp"
MYSQL_SERVER="127.0.0.1"
MYSQL_USER="root" # best to use the root account for this
MYSQL_PASS="somepassword" # Your msql password

#
# Stop editing here.
NOW="Backup-"$(date +"%Y.%m.%d")
DESTFILE="$BACKUP_DST/$NOW.tgz"

# Backup files.
mysqldump -u $MYSQL_USER -h $MYSQL_SERVER -p$MYSQL_PASS --all-databases > "$NOW-Databases.sql"
tar cfz "$DESTFILE" $BACKUP_SRC "$NOW-Databases.sql"

dropboxupload "$DESTFILE" "$DROPBOX_DIR"

rm -f "$DESTFILE" "$NOW-Databases.sql"

This fixes the problem of slow uploading & you have saved heaps of space on your dropbox account by archiving it.

Posted in Bash | Leave a comment