Monthly Archives: March 2011

2

lolbash.sh

by

lolcode.com

Just for fun!

The link for lolbash.sh doesn’t work so I copied it here:

In a previous article, we talked about enabling .bash_aliases. Now here’s some aliases you can use!


# LOL!!1
# additions to .bash_aliases for us lolcats lovers
#
alias wtf='dmesg'
alias onoz='cat /var/log/errors.log'
alias rtfm='man'
alias visible='echo'
alias invisible='cat'
alias moar='more'
alias icanhas='mkdir'
alias donotwant='rm'
alias dowant='cp'
alias gtfo='mv'
alias hai='cd'
alias plz='pwd'
alias inur='locate'
alias nomz='ps -aux'
alias nomnom='killall'
alias cya='reboot'
alias kthxbai='halt'

kthxbai

Wayno

0

How to add youtube to your Roku device

by

Sadly, this trick NO longer works. Even if it was previously installed.

Original Article here

W A R N I N G ! ! ! DANGER WILL ROBINSON!!! W A R N I N G !!!

NOTE: THIS IS AN UN-APPROVED PROCEDURE. I AM NOT RESPONSIBLE FOR ANY DAMAGE TO YOUR DEVICE.

1. go here and sign into your account.

2. Enter this code:

B8VVK

3.  As the above article says:

You may have to enter the channel store to sync your account and exit again for the channel to show up.

Limitations:

You MUST have an existing youtube account.

You can NOT search for videos. Only previous playlists and favourites are available. However, on your computer, you can add videos to playlists or favourites and view on youtube on your Roku device.

It will show all videos owned by YOU.

5

two ways to id a web server in Linux (or Telnet in Windows)

by

First I will show you the easy way to id a web server. Then I’ll show you how the magic works.

1. first the easy way (Linux):

You may need to install curl first.


sudo apt-get install curl

2. Then it’s easy!


curl -I www.old.pkill-9.com

(that’s a capital I (eye))

and you will get output that looks like:

HTTP/1.1 301 Moved Permanently
Date: Fri, 25 Mar 2011 22:33:35 GMT
Server: Apache
X-Powered-By: PHP/5.2.14
X-Pingback: http://www.pkill-9.com/xmlrpc.php
Location: http://www.pkill-9.com/
Content-Type: text/html; charset=UTF-8

so we know that old.pkill-9.com uses an Apache Server. (Thank you, Jeremy!)

3. Now the magic. First telnet to the web server address, port 80 This will work in Linux OR Windows. You can use the Putty Client in Windows.


telnet www.old.pkill-9.com 80

Next enter:


HEAD / HTTP/1.0
[enter] [enter]

Note the query MUST be capitalised, and you MUST hit enter TWICE.

You will get output that looks like:

nwayno@Homer:~$ telnet www.old.pkill-9.com 80
Trying 72.167.232.233…
Connected to old.pkill-9.com.
Escape character is ‘^]’.
HEAD / HTTP/1.0

HTTP/1.1 403 Forbidden
Date: Fri, 25 Mar 2011 22:39:31 GMT
Server: Apache
Connection: close
Content-Type: text/html; charset=iso-8859-1

Connection closed by foreign host.
nwayno@Homer:~$

And again, we know it’s Apache (Linux).

If it says Server: Microsoft-IIS/7.5

as does www.usatoday.com then it’s a Microsoft’s Internet Information Server.

Thanks Joe. I couldn’t remember the http goodness method!

Wayno

4

How to enable .bash_aliases

by

This is one of those things, I sort of take for granted. It was asked on #ubuntu (irc.freenode.net)

bash aliases

What’s an alias you say? An alias is a short form of a long command string for the bash terminal.

so how do you make it work?

1. edit the file .bashrc (using like gedit)

Remember that anything with a number sign (# or octothorpe) is a comment, and does NOT need to be coded.


cp .bashrc .bashrc.bkup # make a backup copy first!
gedit .bashrc

yes the peroid (.) at the beginning fo the file, is significant! The period (.) at the beginning of the file, tells us it is a hidden file.

2. find and uncomment the lines:


#
# enable bash_aliases by uncom the next 3 lines GU 12/1/2008
#
#
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

That will enable you to put user written aliases into a separate file called: .bash_aliases. Save and exit.

3. My .bash_aliases looks like this (again created .bash_aliases with the editor of your choice)

Note that if you already have a .bash_aliases file, you should backup that up first.


cp .bash_aliases .bash_aliases.bkup # make a backup copy first


gedit .bash_aliases

#
# note that when you see the # in a command it is a comment and
# does NOT need to be coded
#
alias ltr=’ls -l -t -r’ # ls command: long, sort by mod date, rev order
alias logc=’tail -150 /var/log/messages | more’ # tail last 150 lines of log
alias logdebug=’tail -f /var/log/messages’ # opens log in debug mode
alias ftplog=’sudo tail -150 /var/log/vsftpd.log | more’ # look at ftp log
alias sshmnd=’ssh -X lou@annlou’ # ssh into folks computer
alias clr=’clear’ # clear the screen
alias startvnc=’x11vnc -usepw -display :0′ # start vnc server

NOTE THAT YOU NEED TO LOGOUT/IN TO GET CHANGES MADE TO .bashrc or .bash_aliases TO WORK!

you can see typing those commands are pretty long.

the format is always:

alias (alias name)=’command strong’

the single quote marks ARE important.

So if I wanted to start my vnc server, instead of a long string, i’d just type:


startvnc

and everything after the equal sign (=) is then substituted.

Pretty neat!

1

Subnet masks explained

by

Subnet masks are absolutely one of the most confusing things I have ever encountered. It is likely, you have also experienced a considerable amount of confusion as well.

Subnet Mask Explained

So let’s define: What is a subnet mask?

I liked this definition which I will use from wikipedia.org on subnet masks.

A subnetwork, or subnet, is a logically visible subdivision of an IP network.[1] The practice of dividing a network into subnetworks is called subnetting.

It breaks a larger network, into smaller subnets. A logical, visible subdivion….Well let’s see how they work.

Key Concepts

1. In order to understand subnet masks, we have to think Binary (base 2)

and NOT decimal (base 10).

2. IPv4 addresses are given in octets. Meaning that we have one byte or 8 binary digits (bits) to represent a number. Lowest number we can represent in 8 bits is zero (0), highest (HIGH VALUE or ALL BITS ON) is 255 (base 10.) Numbering starts at zero (0) and not one (1). So we have 256 choices!

Light Switch on -- can NOT change

Light Switch Off -- CAN change

3. Subnet masks are identified with a / or slash after the IP address:

4. 192.168.0.0/30

30 bits CAN’T change. only gives us 2 bit that can change. So it would allow 4 subnet hosts. Remember the 1 bit (on,) means it can NOT change. A zero bit (off,) means it CAN change. BUT one bit is reserved for broadcast, and one bit for network (we can’t use those so we have to subtract that!)

 3    2    2    2    1    1             
 2    8    4    0    6    2    8    4   
 1111 1111 1111 1111 1111 1111 1111 1100 (binary)

(32 – 30) = 2 bits allowed to change. (2^2) -2 = 2 choices.

NOTE: ^ means raised to the power of. So 2 raised to the power of 2 (2 squared) = 4.

So a subnet mask of 30 allows us to control two (2) subnet hosts.

5. A subnet mask of 20 i.e.

 3    2    2    2    1    1             
 2    8    4    0    6    2    8    4   
 1111 1111 1111 1111 1111 0000 0000 0000 (binary)

192.168.0.0/20, means (32-20) = 12 bits allowed to changed. (2^12) -2 = 4094.

Again, 2 raised to the 12th power (2x2x2x2x2x2x2x2x2x2x2x2) = 4096.

6. A /24 sub network 192.168.0.0/24

 3    2    2    2    1    1             
 2    8    4    0    6    2    8    4   
 1111 1111 1111 1111 1111 1111 0000 0000 (binary)

Means 24 bits CAN’T change. (32 – 24) = 8 (2^8) – 2 = 254.

Allows 254 subnet hosts, since we have masked OFF 24 bits, only 8 can change! (minus one bit for broadcast, one bit for network)

—–

Thanks Loni, for looking over my shoulder.

Remember. Bits, nibbles, and bytes can hurt you! Be careful out there!

Wayno

1

how to install and configure the locate command to find files

by

In the previous post I showed you how to use the find command. Find works on any Linux system. But it does require some effort.

I’ll show you another way to find files by name, with the locate command.

The first thing we have to do, is to install the command. It does not come standard on most Linux distributions. As always ymmv applies.

1. Let’s get started! First thing we want to do is install locate.


sudo apt-get install locate

This will install the locate command. But we are not quite finished. Locate uses a database, so we must first build the database. The database is updated daily. So additions you make during the day, won’t show up until the next day usually.

2. Here’s how to build the database:


sudo updatedb

This is going to take sometime, as it has to index every file. So be patient.

Made a lot of changes, and want to update the database now? You can run updatedb ad hoc (as needed). Just follow the step above.

Using our potato example from the previous post:

nwayno@Homer:~$ locate potato
/home/misc/oldwindows/wp51/recipes/leekpotato.txt
/home/misc/oldwindows/wp51/recipes/potato.txt
/home/misc/oldwindows/wp51/recipes/potato.wp
/home/misc/oldwindows/wp51/recipes/stuffed baked potatoes.wp
/home/nwayno/potato_head.jpg
/home/nwayno/recipes/leekpotato.txt
/home/nwayno/recipes/potato.txt
/home/nwayno/recipes/potato.wp
/home/nwayno/recipes/stuffed baked potatoes.wp
/home/nwayno/wp51/recipes/leekpotato.txt
/home/nwayno/wp51/recipes/potato.txt
/home/nwayno/wp51/recipes/potato.wp
/home/nwayno/wp51/recipes/stuffed baked potatoes.wp

Notice that it found ALL files that contained potato somewhere in the file. No wild cards needed. Neat, huh?

If you want any of the recipes, let me know!

3

how to find files in Linux

by

This is a n00b question I am asked a lot.

Several ways to do this.

Easy way is to use the find command (search your directory)

The general format is: find path -name expression


find -name 'potato*'

Yields:

./potato_head.jpg
./recipes/potato.txt
./recipes/potato.wp
./wp51/recipes/potato.txt
./wp51/recipes/potato.wp

The period (dot) at the beginning says the file is located in the currently logged in account.

You may be wondering about a couple of things:

1. Why does the search expression have SINGLE quotes?

That’s so we can search for a string with special characters in it.

2. Why do you have an asterisk (*) at the end of the search string?

That’s so it will match ANYTHING that starts with the word BEFORE the asterisk (*)

3. What if I want to search the entire hard drive?


sudo find / -name 'potato*'

/ indicates the root directory.

Now this does search the entire hard drive. The sudo is necessary because you have to have permission to read other directories other then your own.

Another method is to use locate. We’ll discuss that in another post.

How did you do? Did you find the file you were looking for?

3

How to enable Closed Captioning in Hulu Plus with Roku Box

by

Again NOT Linux

How to enable Closed Captioning in Hulu Plus on a Roku Box

It isn’t immediately obvious on just how to enable closed captioning content with Hulu Plus, on a Roku Box.

Let’s use the latest episode of House MD (Season 7 Episode 14 Recession Proof.)

You will only have about 2 seconds to do this, so MOVE quickly.

1. Once the episode is playing, hit the DOWN arrow.

2. A sub-menu will come up with: Stop / CC is OFF / Autoplay is OFF

3. Use the RIGHT arrow key to highlight: CC is OFF

4. Hit the OK button. CC is now turned on, and captioning information should display in the next few moments! This toggles off/on closed captioning.

Next on my list of things to figure out: How to do subscribing, and what does it gain me?

0

HDMI connections and Analogue (analog) Closed Captioning

by

Nothing to do with Linux!

This information will be useful to those of us that are in the deaf/hard-of-hearing community:

At this link:

Find a DVD Recorder that does Closed Captioning

I learned that Analogue closed captioning is NOT necessarily passed along an HDMI connection. Although analogue captioning seems to function fine with my TIVO HD and an HDMI connection.

I bought this DVD recorder from Wally’s World (aka Walmart)

Magnavox MDR515H

And sure enough. No captioning!

I switched to component output instead of the HDMI cable, and I now have Analogue Closed Captioning goodness! Records and plays back as advertised!

This little tidbit was enough to make all the difference!

and so it goes….

Wayno