Jeremy taught me how to do permalinks for this blog, that will be more meaningful then the ?=xxx I had been using. That is pretty cryptic!
Who knew?
Thanks Jeremy
Wayno
Just another WordPress site
21
Apr
Jeremy taught me how to do permalinks for this blog, that will be more meaningful then the ?=xxx I had been using. That is pretty cryptic!
Who knew?
Thanks Jeremy
Wayno
20
Apr
This is a really simple script, but it underscores some key concepts here. Variable assignments, while statements, checking for null input, reading input from the terminal, comparing strings, etc.
I tried to annotate this script so you could follow along the major concepts. This is pretty basic, and so are the concepts, but I hope it gives you enough to build upon.
Bash Pitfalls helps, but you need to be fairly familiar with Bash to begin with. This was over my head. YMMV applies.
Opera renders this page correctly, Chrome not so well.
Thanks Joe for the skill command/commentary
Wayno
#!/usr/bin/bash
#
#
# By. W. Guerrini 04/20/2011 V 1.0
#
# simple script to zap a user
#
#
# configuring parameters
#
# note a very common mistake is using a $ to assign a string a value
# here we are just defaulting all the string variables to null
#
# note that there is NO white noise around the equal (=) signs a very
# common mistake! (been there done that)
#
person="" # name of person we want to zap (string/not null)
ans="" # answer received from user (string/not null)
ok2nuke="Y" # the answer we expect if it's okay to zap user
#
# the echo command does just that. it echos the contents between the
# quote marks to the terminal
#
echo "Displaying Logged in Users"
#
# issue the who command to see who is logged in
#
who
#
# The who command listed all the people logged into the system.
# Choose one to terminate
echo "What person do you want to zap?"
#
# read waits for the person to enter some text on stdin, and puts
# the contents into the variable NOTE: person NOT $person
#
read person
#
# we are checking for a null string
# the while statement will loop, until the person string is NOT null
#
# the -z checks to see if the string is null. Notice here we use
# $string name ($person vs person) for the comparison
# the brackets [] are required because we are doing various type of
# operators
#
# also note the semi-colon ; at then end of the while statement --
# yup that's needed.
#
# so this while statement says, while the string $person is null
# echo hey the string is null and re-read the input
#
# once the condition is satifisfied (non null string) the while exits (done)
while [ -z "$person" ];
do
echo "Null string. Not permitted. Enter a person to zap: "
read person
done
echo "$person is NOT null."
#
# display to the user, the name of the person we want to zap.
# note again we want to display the contents of the string $person
echo "confirm you want to zap User" $person "(Y/N)"
read ans
echo "the answer is: " $ans
#
#
# again another while loop - the answer can't be a null (nothing) string
# keep prompting and waiting till the answer is not a null
#
while [ -z "$ans" ];
do
echo "$ans String is null."
read ans
done
#
#
#
echo "$ans is NOT null."
#
# now check the answer and make sure it is a CAPITAL Y
# remember we set ok2nuke to "Y" above
#
#
#
# again in the if statement note the $string names,
# the equal signs, the brackets [], and the semi-colon ;
#
# If we got a capital "Y" then execute the if statement (skill commented out)
#
# we want to compare the strings, so we enclose them in quotes (")
# NOTE: you could also use "Y" instead of $ok2nuke but this way
# it's easier to change the value
#
if [ "$ans" = "$ok2nuke" ];
then
echo "$ans was okay to zap"
# sudo skill -n -u $person
# where n is the signal you want to send
# (-1 is a graceful hangup, -15 is a termination, -9 is an immediate kill)
echo "He's Dead, Jim!"
fi
#
#
# if we didn't get a capital "Y" for the answer, it just falls through and
# exits.
#
echo "we are finished"
Script execution looks something like:
nwayno@Homer:~$ sh zap.sh
Displaying Logged in Users
nwayno tty7 2011-04-19 18:15 (:0)
nwayno pts/6 2011-04-20 14:25 (:0.0)
donuts tty9 2011-04-20 14:45 (:2)
nwayno pts/10 2011-04-20 16:16 (:0.0)
What person do you want to zap?
Null string. Not permitted. Enter a person to zap:
donuts
$person is NOT null.
confirm you want to zap User donuts (Y/N)
Y
the answer is: Y
$ans is NOT null.
$ans was okay to zap
He's Dead, Jim!
we are finished
nwayno@Homer:~$
17
Apr
It is interesting to show how Linux evolved and changed over the years.
Wayno
13
Apr
Pretty interesting. Wish I’d seen this when I was in school!
Sorting Algorithms as Dances
Wayno
6
Apr
4
Apr
Yeah!
Added: FD Feedburner Plugin for WordPress to the plugins, configured it, and it’s all good now.
Why this was so hard? Because I kept trying to just edit sidebar.php with the correct information. Nooooo. It needed the plugin to make the magic happen. Who knew?
Thanks Jeremy!
and so it goes….
Wayno
1
Apr
YOU MIGHT WANT TO READ: SECOND LOOK AT UNITY for Natty Narwhal FOR UPDATED INFORMATION.
=========
NOTE: ALL THE FOLLOWING ACTIONS ARE OFF THE UBUNTU 11.04 LIVECD (BETA1)
Wow! If you remember my First Review of Ubuntu’s Unity interface, I was very critical.
While it still needs some work, vast improvements have been made. As you can see from the image above, I was able to customise the background, and change am/pm, and put the buttons on the right hand side. NONE of which I could do in the 10.10 netbook remix. USB Flashdrives also mount correctly.
Remember we are running off the livecd here. So nothing we do here remains, once we reboot. But this is a way to look at Unity without installing.
Here’s the magic (courtesy of trism on #ubuntu+1 freenode irc channel) on how to enable Unity. (By default, you get gnome)
1. In the Synaptic Package Manager, under Settings/Repositories, I had to enable the universe repository.
2. Trying to get a terminal window was a little tricky. But if you click on the button top left, and search for “terminal” you will find it.
Alternate method: alt+f2 opens up a run window, and type in:
gnome-terminal
and you are all set.
3. Next get the updates, so:
sudo apt-get update
4. Install the Unity interface:
sudo apt-get install libgl1-mesa-dri-experimental
5. Logout/back in
and you will have the Unity interface.
6. Note that libreoffice (which IMHO is NOT ready for Primetime) comes installed standard, instead of Open Office. Firefox 4.0 is here. I could not get empathy to work, but that’s primarily due to my unfamiliarity.
This is vastly improved over what I saw. It will require a lot of patience to learn where things are. The Applications/Places/System is all gone. Instead you click on the Ubuntu Icon (top left) and navigate to the folder with the magnifying glass. NOT the magnifying glass with the square, the magnifying glass with a plus (+). There you will find most of the system/administration tasks. The one thing they did NOT change: the icons are still cryptic!
One of the most frustrating things I noticed with Unity is that the application menu: File/Edit/View/Search (see photo) is no longer a part of each application. That’s now moved to the top task bar. (you should be able to see the terminal window Menu in the photo). Not certain if I like that.
Still like they say: “There’s no place like gnome!”
Wayno
29
Mar
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
27
Mar
Sadly, this trick NO longer works. Even if it was previously installed.
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.
25
Mar
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
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.