This way individual projects with specific perl requirements avoid
borking the global install.
## I'm going to use MediaWiki::API to load, so I'll install local::lib
## using cpanm.
## Step 1, install a local cpanm (and some deps)
curl -k -L http://cpanmin.us \
| perl - -l local-lib App::cpanminus
## Step 2, install local::lib
./local-lib/bin/cpanm \
-l local-lib local::lib
perl -Ilocal-lib/lib/perl5/ -Mlocal::lib=`pwd`/local-lib \
> local-lib.sh
source local-lib.sh
## Step 3, install MediaWiki::API
cpanm MediaWiki::API
## ENJOY
Showing posts with label tip. Show all posts
Showing posts with label tip. Show all posts
Wednesday, 14 December 2011
git remote for cvs... (Switching to a new CVS server)
See http://docs.moodle.org/20/en/CVS_for_Administrators#Switching_to_a_new_CVS_server
For me, its like this:
find . -type f -name Root | \
xargs perl -pi -e \
For me, its like this:
find . -type f -name Root | \
xargs perl -pi -e \
's/:pserver:cvsuser:\@cvs\.sanger\.ac\.uk:\/cvsroot\/ensembl/:ext:db14\@cvs.sanger.ac.uk:\/cvsroot\/ensembl/'
Tuesday, 22 November 2011
Portable shebang (for Perl)
What do you do when you have a Perl script that starts with:
#!/somewhere/stupid/perl
?
Just run the script with perl like this:
$ perl my_stupid_scipt.pl
How do you avoid writing scripts like that? Do the following:
#!/usr/bin/env perl
#!/somewhere/stupid/perl
?
Just run the script with perl like this:
$ perl my_stupid_scipt.pl
How do you avoid writing scripts like that? Do the following:
#!/usr/bin/env perl
Friday, 12 August 2011
Start skype on login in Ubuntu
See this post:
http://www.addictivetips.com/ubuntu-linux-tips/run-any-program-during-system-startup-in-ubuntu-linux/
And use System -> Preferences -> Startup Applications
Enter "/usr/bin/skype" (or use "which skype" to find the location of skype).
Monday, 8 August 2011
Learning pg
SHOW TABLES is
SELECT table_schema, table_name FROM information_schema.tables ;
SHOW DATABASES is
SELECT table_schema, COUNT(*) AS num_tables FROM information_schema.tables
GROUP BY table_schema;
use /? to find out how to do it properly.
Monday, 9 May 2011
You don't want to do that... do you? git svn git svn
git rm --cached -n -r `find ./ -type d -name .svn`
Monday, 1 November 2010
Problems with your local perl install?
Try the following uber 1337 commands (based on this):
mv ~/perl5 ~/notperl5
wget -O - http://cpanmin.us | perl - -L ~/perl5 --self-upgrade local::lib
ZOMG!
OK, now add your ~/perl5 dir into git...
cd ~/perl5/ ; git init ; git add . ; git commit -m 'initial import'
This will help you keep things in order over time.
Example:
cpanm Bio::DB::Sam
You can then use git to see exactly what you did, and commit if it worked OK. i.e.
git add . ; git commit -m 'BioPerl and Bio::DB::Sam installed'
(Once you have confirmed that it's working.)
Once your local::lib is in git, you can do lots of stuff like if something is breaking, just edit it in there to insert debugging or whatever and then just reset --hard to get rid of it after you figure out what is going on, etc.
Thanks to rbuels on irc://irc.freenode.net/#bioperl for helping with this!
(All the above is his doing).
mv ~/perl5 ~/notperl5
wget -O - http://cpanmin.us | perl - -L ~/perl5 --self-upgrade local::lib
ZOMG!
OK, now add your ~/perl5 dir into git...
cd ~/perl5/ ; git init ; git add . ; git commit -m 'initial import'
This will help you keep things in order over time.
Example:
cpanm Bio::DB::Sam
You can then use git to see exactly what you did, and commit if it worked OK. i.e.
git add . ; git commit -m 'BioPerl and Bio::DB::Sam installed'
(Once you have confirmed that it's working.)
Once your local::lib is in git, you can do lots of stuff like if something is breaking, just edit it in there to insert debugging or whatever and then just reset --hard to get rid of it after you figure out what is going on, etc.
Thanks to rbuels on irc://irc.freenode.net/#bioperl for helping with this!
(All the above is his doing).
Wednesday, 6 January 2010
Configure the ssh *client* to stay alive
http://embraceubuntu.com/2006/02/03/keeping-ssh-sessions-alive/
Friday, 27 November 2009
Resurrect screen?
You were just using screen, but now it says
dmb@dallas0 [~]# screen -r
There is no screen to be resumed.
Try this:
ps x | grep -i screen
Note the PID... and:
kill -CHLD screenpid
http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
dmb@dallas0 [~]# screen -r
There is no screen to be resumed.
Try this:
ps x | grep -i screen
Note the PID... and:
kill -CHLD screenpid
http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
Tuesday, 27 October 2009
"What links here" for symlinks?
Ever been frustrated by knowing that you have created a link to your `pwd` 'somewhere' on the file system, but you are unable to remember where?
Ever wished you could just hit "What links here" to discover the location of the symlink from the target?
Tough.
There is no good solution.
Here are some ugly hacks:
#!/bin/bash
for file in `find / -type l 2> /dev/null`; do
ls $file -l 2> /dev/null | grep "target" 2> /dev/null
done
or
find ./ -type l -exec ls -l '{}' \; | awk '{print $11}' | grep "target"
These 'hacks' will thrash your disk, but what are you going to do? Unless we can make a file system based on a wiki ... (imagine a history page for all your config files?) or a database ... (imagine querying for all the files greater than 1 Gb older than 1 year?) we are stuck with these... Unless you know better?
Ever wished you could just hit "What links here" to discover the location of the symlink from the target?
Tough.
There is no good solution.
Here are some ugly hacks:
#!/bin/bash
for file in `find / -type l 2> /dev/null`; do
ls $file -l 2> /dev/null | grep "target" 2> /dev/null
done
or
find ./ -type l -exec ls -l '{}' \; | awk '{print $11}' | grep "target"
These 'hacks' will thrash your disk, but what are you going to do? Unless we can make a file system based on a wiki ... (imagine a history page for all your config files?) or a database ... (imagine querying for all the files greater than 1 Gb older than 1 year?) we are stuck with these... Unless you know better?
Friday, 14 August 2009
vpnc timeout problem solved with Perl
Or ... EXPECT PAIN!!!
I've seen lots of people complaining about a time out problem with vpnc. This happens to me even if I'm ping-ing like crazy or not, so its nothing to do with activity on the connection (I think).
The problem with automatically re-connecting was the need to interactively type a password at prompt. Note that this was not my "Xauth password". For some reason my organisation requires an extra password (there are many ways a VPN can be configured).
If you just need to type one username and password, its probable that you can set up your config file to contain:
Xauth username meUserName
Xauth password meSekretPassword
With the above you could just automatically restart vpnc every time it drops out (i.e. using bash). I have this extra password to deal with though, so its a bit harder. Here is the solution achieved using Perl, Expect [1], and a lot of help from the friendly mst in irc://irc.freenode.net/#Perl
[1] http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod
Take care,
Dan.
I've seen lots of people complaining about a time out problem with vpnc. This happens to me even if I'm ping-ing like crazy or not, so its nothing to do with activity on the connection (I think).
The problem with automatically re-connecting was the need to interactively type a password at prompt. Note that this was not my "Xauth password". For some reason my organisation requires an extra password (there are many ways a VPN can be configured).
If you just need to type one username and password, its probable that you can set up your config file to contain:
Xauth username meUserName
Xauth password meSekretPassword
With the above you could just automatically restart vpnc every time it drops out (i.e. using bash). I have this extra password to deal with though, so its a bit harder. Here is the solution achieved using Perl, Expect [1], and a lot of help from the friendly mst in irc://irc.freenode.net/#Perl
[1] http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod
Take care,
Dan.
Subscribe to:
Posts (Atom)