Archive

Archive for the ‘Ubuntu’ Category

3 Favorite Geek Tips/Tricks

September 28th, 2009 No comments

Every geek should have at least a few tips or tricks that they don’t have to reference documentation or google for, here’s a few of my favorites that I use daily.

1) SSH Tunnels – Each and every time I’ve used this to cut half the time off a task I remember just how great SSH is.

When to use: Anytime you need internal access to a remote network. Or perhaps your company filters your internet usage and you need to check your gmail, this allows you to TUNNEL to your internet back at the house and ask it to do all the talking for you.

Example: I’m working from home, but I really need to access a ‘local’ resource on the remote network, it could be something as simple as connecting to the router on-site that doesn’t have remote access setup.

Howto Linux: If you’re a linux user, use the “-D” option with your standard ssh command. IE: ssh -l username -D 54321 sub.domain.com

Howto Windows: Get PuTTY. You’ll likely want to save this configuration so, open PuTTY, type in the hostname, give the session a name, on the left hand panel navigate to Connection->SSH->Tunnels. Under “Add New Forwarded Port” pick a port number, I like to use something high in the range, 54321 or you can pick your own. There are two rows of radio buttons, on the top choose “Dynamic” and leave the other as “Auto”, click “Add”. Now before connecting, on the left hand panel goto Sessions and click “Save”, now click “Open”

Utilizing the tunnel: What this essentially does is creates a secure SOCKS proxy for you to use. In Firefox, goto Preferences->Advanced->Network->Settings and set the SOCKS proxy address to “127.0.0.1″, that’s right, localhost (but don’t use ‘localhost’), then enter the port you chose earlier. Click “Ok” and you’re now surfing securely through SSH.

2) Converting movies to pocket size (linux only):
I have a simple Creative Zen 8GB Mp3 Player, it was cheap and works exactly as expected. It plays video of the same quality popular cell phones use, occasionally I want to watch a TV episode so I pieced together a simple little alias to make it quick and painless, you’ll need mencoder for this, if your on debian/ubuntu it’s as simple as ‘apt-get install mencoder’

Code (I put in ~/.bashrc): alias encode=’mencoder -ovc xvid -oac mp3lame -vf scale=320:240 -xvidencopts fixed_quant=4 -o ${args[0]} ${args[1]}’

Usage: encode outputFile.avi /path/to/file/to/convert.flv|avi|mpg

3) Using axel for super fast downloads
Situation: You’re remotely connected to a server you adminster, you’re crunched for time and need to download a file, maybe an ISO or perhaps a service pack, but you need it fast. You have no problem finding links to get it, but which do you use, which will be faster? The solution, grab 3 or 4 of those links and use axel.

Usage: axel -n X url1 url2 url3…
Replacing ‘X’ with the number of connections you want to use, passing as many URLs in as you’d like. In most cases, 3 or 4 seem to be enough to max out my 2MB/s.

Share

CLI Usefullness

August 30th, 2009 No comments

For the past year and a half I’ve been doing developement in a linux based enviroment, these tools and particularly these commands have become used frequently. If anyone has something useful, post it up!

Mercurial is a cross-platform, distributed revision control tool for software developers.

Easy way to view most recent changes:
Command: hg export tip | colordiff | less -R

Useful for: Quick code reviews, or just to peek at what you’ve recently done

Manipulating text files:

SED: (stream editor) is a Unix utility that (a) parses text files and (b) implements a programming language which can apply textual transformations to such files.

Command: sed ‘s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ > filename.csv
In action: mysql -uuser -ppass DBNAME -e “SELECT foo FROM bar WHERE baz = ‘world’” | sed .. > output.csv

Explanation:

  • “s/\t/”,”/g;” – Search for tabs, replace with commas
  • “s/$/”/;” – Replace last of line with quote
  • “s/\n//g” – Remove newlines

Useful for: This is specifically used for converting MySQL results to csv. I build lots of mailing lists for my employer.

AWK: is a programming language that is designed for processing text-based data, either in files or data streams, and was created at Bell Labs in the 1970s

Command: awk ‘BEGIN {OFS=”|” FS=”|”}; {print $1, $3, $5}’ file.csv
Explanation:

  • OFS – Output field separator
  • FS – Field separator
  • Printing fields 1, 3, and 5

Useful For: Pulling text out of delimited list and re-organizing the data, quickly and gui-free

Share

Avimark and linux, finally can dump windows server

July 9th, 2009 10 comments

There’s probably not that many people that actually care about this, but it’s taken me a long time to get to this point, so if your a tech guy at a vet’s office, enjoy! I’ve been running this successfully for almost a year now.

WARNING: If you choose to do this, that’s your choice, read this through before even thinking of diving in. In other words, I am not responsible for ANYTHING that happens as a result of what YOU choose to do. I also assume your familiar with linux and the distro of your choosing, really, I won’t be explaining some things as this is already going to be lengthy.

Note: This may not be the most secure way to do things, but I feel it’s stronger than windows, I have better backups (flyback for gnome, and a few scripts I’ve written), and no one has “Administrator” access, except me of course.

For the past 2 years or so I’ve been the ‘Tech Guy’ at two vet offices in my “free” time.  I’ve had one Windows 2000 server, which was actually the most reliable, compared to the Windows Small Business Server 2003.  I’ve experienced more problems than I care to recall, let’s suffice it to say, the workstations in the larger office were unreliable on network, even after a network rebuild (replace and tested all cable, made sure machines were clean, running the server on a gigabit network connection, all fun stuff).  Finally it got to the point where I was spending all my free time there, no good.  I am far more comfortable on any linux box than a windows machine, so I decided to take the plunge and make it work, installing linux servers that is. It may sound easy, but even since the switch I’ve had many unexpected surprises.  

Read more…

Share

X10 Scheduling

December 13th, 2007 1 comment

In the last entry we just did some basics of the X10 system, now we’ll go over using them efficiently. The CM11A device allows you to upload a schedule to it that it will store in it’s own memory, so even if your computer is off, your X10 still works without missing a beat. All it takes is a small config file stored in /etc/heyu (or in ~/.heyu) called x10.sched . Heyu comes with a sample file, it’s very lengthy and can be confusing to some people.

Read more…

Share
Categories: Software, Ubuntu, X10 Tags:

$50 Home Automation

November 27th, 2007 10 comments

So who wouldn’t love to pull up to your house, get out of your car, walk in your house and all the lights and devices you love are already on? Or maybe your just want to save on your electric bill, either way with about 50 bucks you’ll be on your way to home automation paradise. This guide is not exactly intended from someone not at least kinda familiar with linux, and you should have at least used a screwdriver once or twice.

This requires:

  1. Linux computer (I’m using Ubuntu 7.10, also works with CentOS5)
  2. WS467 Modules – Their either 7 bucks a piece off eBay or 3 for 15 – Replacement wall switches
  3. CM11a – About 10 bucks, runs the computer interface for the x10 control, stores macros. Uses a serial port, make sure you got one still!
  4. Optional – Remotes -
    1. KR19A - This keychain remote control two devices, On/Off/Dim – Simple & small
    2. UR73A – This remote will do it all, don’t get up from your lazy boy just to turn off lights!
  5. Very little experience with wiring.
  6. 1 Flat-head & 1 Phillips screwdriver
  7. A volt-meter is a GREAT investment, not necessary, but can eliminate questions and problems very quickly.

Read more…

Share
Categories: Software, Ubuntu, X10 Tags: