Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Davor Babic

« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS 

Multiply two values

This will multiply two values.
Written in Brainfuck.

Multiply program
Written by Davor Babic
davorb@gmailDOTcom

Multiply 6x5
++++++[>+++++<-]>

Move to values

This code will move two values.
Written in Brainfuck.

Move two values
Written by Davor Babic 2006
davorb@gmail DOT com

>,[>+<]>.

Copy a value

This will copy a value. Written in Brainfuck.

Simple copy routine
Written by Davor Babic
davorb@gmailDOTcom

,[>>+<<-]>>[<+<+>>-]<.>>>++++++++++

Console keyboard scheme switcher

Switches between us and swedish (or any other)
keyboard-scheme in the console. Default is US.

#!/bin/sh
# Keyboard switcher script
# Written in 2006 by Davor Babic <davorb@gmail.com>
# This software is realeased into public domain

case $1 in
sv)
    echo "Switching to swedish keyboard layout."
    loadkeys /usr/share/keymaps/i386/qwerty/se-latin1.kmap.gz
    ;;
us)
    echo "Switching to US keyboard layout."
    loadkeys /usr/share/keymaps/i386/qwerty/us.kmap.gz
    ;;
default)
    echo "None selected. Loading US..."
    loadkeys /usr/share/keymaps/i386/qwerty/us.kmap.gz
    ;;
esac

Digg/RSS Reader

Grabs the RSS-feed from digg.com and reads it out
loud using festival.

#!/bin/sh
# Copyright (c) 2005 Davor Babic <davorb@gmail.com>
# All rights reserved.
# Usage of the works is permitted provided that this
# instrument is retained with the works, so that any
# entity that uses the works is notified of this
# instrument.
# DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

url="http://digg.com/rss/index.xml"

echo "Parsing RSS..."
curl --silent "$url" | grep -E '(title>|description>)' | \
        sed -n '4,$p' | \
	sed -e 's/<title>//' -e 's/<\/title>//' -e 's/<description>/  /' \
	    -e 's/<\/description>//' | head -5 > digg 
echo "Reading..."
festival --tts digg
rm -rf ./digg
echo "Done."
« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS