lamehacks

Stuff is fun

Archive for the ‘computer stuff’ Category

DIY – Computer screen rear view mirror

Wednesday, September 22nd, 2010

My spot at my workplace kind of sucks, a zillion people pass by and hang around right behind me all the time. Besides being a bit distracting, I was allways feeling like someone was looking over my shoulder. When I saw reflections on the shinny border of my screen, the idea of a rear view mirror came into my mind. I imedeatly google it and, as it turns out, such stuff exists and can be bought online.
All the waiting plus shipping and handling fees sort of turned me away from that option though.  So I decided to improvise a solution which turned out to work very well.

(more…)

perl sudoku revisited

Sunday, May 30th, 2010

My lame sudoku solving script can now be use in a more intuitive way through an html form. I kept it retro-compatible so the old url interface can still be used. I also implemented initial rule checking to prevent invalid puzzles from causing weird results.

Source is hosted at bitbucket.  Social code hosting is cool, from now on all my code bits will be pushed to bitbucket.

Javacus – A java abacus

Sunday, March 21st, 2010

I was in the middle of the process of making a toy abacus when my workshop got flooded, so I put together this lame electronic replacement (more…)

Beautify [Format] XML with PHP

Sunday, July 19th, 2009

There is a myriad of XML formating tools out there, some have reached a rather stable development state. Oddly enough, an XML file having elements with both content and child elements is all it takes for most  of them them [every single one i know of] to miserably fail.  Being that a basic XML feature, I decided to give it a go.

(more…)

Archive your tomboy notes

Sunday, December 7th, 2008

Tomboy is my favorite note taking application. It’s as close as it can get to paper and an pencil. It’s a relatively new application so new features are still popping up here and there written by many different people. This lame script is my small contribution to this awesome piece of software. (more…)

Secure command line chat using netcat and openssl

Wednesday, November 26th, 2008

Instant messaging networks are practical and simple to use. Though most of the people use them  without worries, they do in fact bring up a major concern, privacy. Not only your messages are transmitted in plain text over the internet so somebody in between can sniff them, they are not sent directly to the recipient. Instead, they are sent to the IM provider’s server and then delivered to the recipient. What this means is that you are trusting wharever you communicate over IM to your IM provider which can log all your messages and do whatever it wants with them.

If you use an UNIX based operative system, this little shell script implements a simple and secure way to chat. It’s more of a proof of concept than a every-day usable script. Despite that is fully functional and fun.
It works simply by sending encrypted text over a TCP socket created with netcat. The text is encrypted using openssh.

#!/bin/sh
 
#change this if your port is busy
port=3004
 
usage () {
	echo "******************** SSSLCHAT ********************"
	echo "U S A G E"
	echo "SERVER: ssslchat.sh server [password]"
	echo "CLIENT: ssslchat.sh client [password] [ip|hostname]"
	exit 1
}
 
mode=$1
pass=$2
ip_or_host=$3
 
encode(){
 
	password=$1
 
	while [ True ]
	do
		read userinput
		encodedmessage=`echo "$userinput" | openssl enc -rc4 -k $password | openssl enc -a`
		echo "$encodedmessage"
	done
}
 
decode(){
 
	password=$1
 
	while [ True ]
	do
		read encodedinput
		decodedmessage=`echo "$encodedinput" | openssl enc -d -a | openssl enc -d -rc4 -k $password`
		echo "+$decodedmessage"
	done
}
 
case $mode in
	"server") encode $pass | nc -l -p $port | decode $pass ;;
	"client") encode $pass | nc $ip_or_host $port | decode $pass ;;
	*) usage ;;
esac

Both the server and the client need to use the same password for it to work.

Download

Simple java socket client

Sunday, November 9th, 2008

Time for a really lame application.
I made this to try out the swing application framework. Putting together an application like this takes about five minutes and about 20 lines of code. You red right, 20.
First, I thought about making a peer-to-peer chat, but i ended up doing something even simpler, a guided socket client. It only supports text input and is not threaded, so don’t get surprised if the GUI gets unresponsive during a request.
(more…)

Solving sudoku puzzles with perl

Saturday, November 8th, 2008

Solving sudoku puzzles manually is quite a boring thing to do IMHO. Now writing a working solution to all 9×9 sudoku puzzles is pure fun! I wrote this script a while ago, it was a fun way to learn perl. Yes it was my very first contact with perl, so do not bash!

(more…)

Timestamped tarballs

Monday, November 3rd, 2008

There is a ton of version control software solutions out there. Personally I find them all overkill when it comes to provide version control to a project maintanined by one single person.
Simplicity is beautiful and efficient, for this purpose I can’t think of anything simpler than timestamped tarballs. Save this script, make it executable and place it somewhere where your environment can see it.

#!/bin/bash
#
# Author: Pedro
# Description: A quick timestamped.tar.gz archiver
# Date:19-09-2008
# License: I don't care.
# Check out http://lamehacks.net for more little tricks
#
if [[ "$1" = "" || "$1" = "--help" ]]; then
        echo "

        Usage: timestamptarball 

        "
        exit 1
fi

date "+%Y.%m.%d-%H.%m_" | xargs -I {} tar -cvvzf  {}`basename $1`.tar.gz  $1

Command line google translation tool

Wednesday, October 29th, 2008

Ok, time for a first lame [and stupid] hack.
Google recently improved its translation tool, it now supports a lot of new languages and its interface also went through some makeover. Effective as it might be, you’ll get quite annoyed if you use it often. It needs a ton of clicks before you get your text translated.

I put together a quick script so I can translate any text simply by typing it the command line and hit enter.

(more…)

. .

Entries (RSS) and Comments (RSS).