who | awk '{name[n++]=$1};END{for(i=1;i<=n;i++){printf name[i]" "}; print ""}'
# List of unique logged in users
who|awk '{w[$1]=$1};END{for(n in w)printf" "n}'
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
who | awk '{name[n++]=$1};END{for(i=1;i<=n;i++){printf name[i]" "}; print ""}'
who|awk '{w[$1]=$1};END{for(n in w)printf" "n}'
DATE=$(date +'%y%m%d')
for VER in $(seq -f %02g 99)
do
if [ -f file_${DATE}-${VER}.tar -o -f file_${DATE}-${VER}.tar.gz ]
then
echo "file_${DATE}-${VER}.tar already exists..."
else
tar cvf file_${DATE}-${VER}.tar clean
gzip -9 file_${DATE}-${VER}.tar
break
fi
done
sed 's/^ *//g' | grep .
sed -n 's/^ *//g;/./p'
if(!condition1 | !condition2) equals if(!(condition1 & condition2))
And
if(!condition1 & !condition2) equals if(!(condition1 | condition2))
#!/usr/bin/perl
use warnings;
use strict;
local $/;
$_ = <DATA>;
$_ =~ s/<table>\n<tr>/<!-- TABLE START -->/i;
print;
__DATA__
<TABLE>
<TR>
<TD>
$_ =~ s/\s*]*>\n\s*/\n/ig
Wednesday, March 02, 2005
Missing header files...
$ make hello
cc hello.c -o hello
hello.c:1:19: stdio.h: No such file or directory
hello.c:2:20: unistd.h: No such file or directory
hello.c: In function `main':
hello.c:89: error: `stdout' undeclared (first use in this function)
hello.c:89: error: (Each undeclared identifier is reported only once
hello.c:89: error: for each function it appears in.)
make: *** [hello] Error 1
# apt-get install libc6-dev
Hello, world!
:o)
(humming "the stripper"):
#!/bin/bash
/usr/bin/strip --remove-section=.comment --remove-section=.note --strip-all $@
Thursday, February 24, 2005
Debian Administration :: Mounting remote filesystems using SSH
Debian Administration :: Mounting remote filesystems using SSH: "module-assistant install shfs"
Truely beautiful :o) and sooo easy!
Thursday, February 17, 2005
Need to update all of the CPAN modules on a server?
If you are using the CPAN module within Perl, you can update all of the installed modules on your system using the command:
perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'
This forces CPAN to produce a list of all of the outdated modules on the machine and install them in one hit...
Not recommended for your average joe. you'll have to go over all of your module dependecies and check to see if updates break any of your live code.. still though there are instances where this can be useful.
Something else to think about... have a look here:
lrwxrwxrwx 1 root root 5 Feb 5 21:36 /usr/lib/perl/5.8 -> 5.8.4
drwxr-xr-x 5 root root 4096 Jan 30 2004 /usr/lib/perl/5.8.2
drwxr-xr-x 4 root root 4096 May 4 2004 /usr/lib/perl/5.8.3
drwxr-xr-x 30 root root 4096 Feb 17 18:05 /usr/lib/perl/5.8.4
drwxrwsr-x 9 root staff 4096 Mar 7 2002 /usr/local/lib/perl/5.6.1
drwxrwsr-x 21 root staff 4096 Dec 5 2003 /usr/local/lib/perl/5.8.0
drwxrwsr-x 4 root staff 4096 Oct 30 2003 /usr/local/lib/perl/5.8.1
drwxrwsr-x 11 root staff 4096 Mar 25 2004 /usr/local/lib/perl/5.8.2
drwxrwsr-x 12 root staff 4096 Jan 23 10:59 /usr/local/lib/perl/5.8.3
drwxrwsr-x 27 root staff 4096 Feb 17 18:08 /usr/local/lib/perl/5.8.4
On a box where Perl has been upgraded a few times there will be lots of old dirs with modules in...
Wednesday, February 16, 2005
Don't need patch...
If you don't have patch installed on a machine it's OK...
You can still use diff to update files...
To update a file using diff & ed:
# (diff -e file1 file2 ; echo -e "w\nq" ) > diffs
# ed file1 < diffs
Bear in mind that it has no context, so it doesn't know where it is in a changed file, it just goes by absolute line number (which means you have to update the bottom of the file before you can update the start - if you're only taking across some of the changes then you need to start at the bottom of the file and work your way back, only updating a chunk at a time... also it's not reversable... patch can see if you're trying to run a patch in reverse... if you try running ed to apply a patch, but accidentally run it against the updated file... then you will really mess it up!
so... make a backup (easy for me to say!) and be CAREFUL!
Subscribe to:
Posts (Atom)