I do a lot of pushing files around. I rely on ssh passwordless authentication for 99% of all of my activites like rsync, CVS, and of course scp. I wanted a way to be able to quickly ensure that I had a passwordless connection first before I fired off 30 rsyncs. So I wrote this little shell function..
Here it is: ssh_login
function ssh_login () {
# This function will get a passwordless authentication session setup for you.
# It is a resuble function in that you can use it at the top of any script
# prior to any ssh'ing to ensure you can do it passwordless. The goal was to
# simply have the user enter his password once.
if [ ! $1 ] ; then
print "Dork, I need an destination argument"
return 255
else
if [ ! -e ~/.ssh/id_rsa -o ! -e ~/.ssh/id_rsa.pub ] ; then
print "Dork, You need to make your keys.."
print "ssh-keygen -t rsa -b 1024 -f ~/.ssh/id_rsa -C \"My comment\""
return 254
fi
# print "Running with comments"
ssh -o RSAAuthentication=yes -o PasswordAuthentication=no \
-o kbdinteractiveauthentication=no -o challengeresponseauthentication=no \
-o StrictHostKeyChecking=no -o CheckHostIP=no $1 date 2>&1 > /dev/null
if [ $? -ne 0 ] ; then
# So we can't get there - let's fix the problem..
# print "Unable to use pawwordless authentication - pushing key now"
cat ${HOME}/.ssh/id_rsa.pub | ssh $1 \
'if [ ! -d ~/.ssh ] ; then
mkdir ~/.ssh/
fi
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
cat >> ~/.ssh/authorized_keys'
if [ $? -ne 0 ] ; then
print "Fatal error - must do this manually.."
return 1
else
# print "Pushed key successfull - testing function"
$0 $1 $2
fi
else
# We are good to go..
# print "Success"
return 0
fi
fi
}
So now if I have another function or script that does something like..
function push_dotfiles(){
rsync -avz --recursive -e ssh ~/.profile $1:~/
rsync -avz --recursive -e ssh ~/.zshenv $1:~/
rsync -avz --recursive -e ssh ~/.zshrc $1:~/
.
.
.
rsync -avz --recursive -e ssh ~/.cds/ $1:~/.cds/
}
I would modify it so it does this first..
function push_dotfiles(){
ssh_login $1
rsync -avz --recursive -e ssh ~/.profile $1:~/
rsync -avz --recursive -e ssh ~/.zshenv $1:~/
rsync -avz --recursive -e ssh ~/.zshrc $1:~/
.
.
.
rsync -avz --recursive -e ssh ~/.cds/ $1:~/.cds/
}
Have fun!!
Ok here is just a random place to put my favorite most used mathematica hints..
Clear all variables..
CleanSlate[]
Substitute
(x+y)(x-y)^2 /. {x->3, y->1-a}
Defining a functions..
f[x_]:x^2
f[2]
I really need a place to put these things..
Here I thought I had a problem with the configuration of my new email server. No I simply didn't have Mail.app configured correctly. You can define any mailbox to be one of the special ones ( Drafts, Sent, Outbox, Junk ) by simply selecting the Mailbox you wish to use ( example drafts ) in the Mailbox list, then go to Mailbox menu -> Use selected Mailbox for -> Drafts.
Pretty simple but it took me 30 minutes to find this one..
Thanks to Jason Cowart for this one.
Mummers Dance from the album "The Book of Secrets" by Loreena McKennitt
So the corporate culture has started warming to the idea of blogging. I was asked to join a beta group of bloggers inside of the place I receive my paycheck from. I don't know if I like the idea, but I am willing to participate...
It seems to me that blogging by definition is free. It's my thoughts not shadowed by anything other than my own self conscience. I don't know if idea of putting a blog into a corporation as a knowledge sharing and dissemination system will work. Because now my thoughts are shadowed. I must wear a politically correct hat when I post to the company to ensure that I do not offend anyone. Not that my stuff typically offends people - I hope it doesn't but I really don't put any emphasis on it either. Now I must.
It appears on the surface like a good idea, and sticking to techie stuff should remain pretty harmless. But now simply saying product xyz sucks ass won't fly either. Now I will be required to substantiate it a bit more. Ok fine, that will help me articulate my thoughts more clearly anyway.
So I'm in - I just hope the system they put in place gives me the freedom to modify and change it so works the way I want it to work.
Redemption (featuring Chemda) from the album "Conjure One" by Conjure One
As Arizona's winter ( heh heh heh ) starts chilling us down, Karen want's me to start looking at pond heaters for the winter time. They are a bit expensive..
So here is what I found..
There are several manufactures of these things..
- Hayward makes one. They are the pool people - but this should work
- Unknown Brand but would fit better with existing piping.
The Google search that turned these up!
Brandenburg Concerto no 5 in D major, BWV 1050 - Allegro from the album "Bach: The Brandenburg Concertos Nos 4, 5 & 6 / Marriner" by Academy of St. Martin-in-the-Fields / Neville Marriner
So I was trolling this morning, and I came across this page that shows some of the most worthwhile RSS feeds out there. Using NetNewsWire to look at RSS is such a nice way to get headlines without any of the crap advertising.
Hole in the Head from the album "Hole in the Head - EP" by Sugababes
In an attempt to remove the spammers from commenting my blog, I've added the need for you to be (semi-) human. A generated image will now appear before you can be allowed to post.
This is some really cool technology - although it's simple and has been around for years. It's pretty tough to break - Unless of course you're a looser and manually post spam to blogs..
Oh yeah - You can get SCode here
Sweet Lullaby [ Apollo Mix ] from the album "World Mix" by Deep Forest