Posts from a Lotus Notes Client and Domino programmer from Sydney.
Tuesday, 21 December 2010
Break Reminder/Stretch Program
http://sourceforge.net/projects/workrave/files/workrave/1.9.3/workrave-win32-v1.9.3-installer.exe/download
Sunday, 5 December 2010
Code to sort your Linux downloads directory. I run this every day.
#!/bin/bash
# Set these two variables to the full pathname
# of your holding and storage directories
downloads=/home/akendrick451/Downloads
cd $downloads
#make sure we have our directories created
mkdir -p Music
mkdir -p Zips
mkdir -p Applications
mkdir -p Documents
mkdir -p Images
mkdir -p Scripts
mkdir -p Other
ls | while read file
do
filetype=$(file -ib "$file")
#echo $file $filetype
# echo "$filetype"
if [ "$filetype" = "application/octet-stream; charset=binary" ]; then
echo "music" $file $filetype
blMove=true
strFolder="Music"
elif [ "$filetype" = "application/x-directory; charset=binary" ]; then
blMove=false
elif [ "$filetype" = "application/zip; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "application/x-gzip; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "application/x-bzip2; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "image/jpeg; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/png; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/x-ico; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/gif; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "application/pdf; charset=binary" ]; then
blMove=true
strFolder="Documents"
elif [ "$filetype" = "text/html; charset=utf-8" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/plain; charset=us-ascii" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "application/msword; charset=binary" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "application/vnd.oasis.opendocument.text; charset=binary" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/html; charset=us-ascii" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/x-shellscript; charset=us-ascii" ]; then
strFolder="Scripts"
blMove=true
elif [ "$filetype" = "text/x-php; charset=us-ascii" ]; then
strFolder="Scripts"
blMove=true
elif [ "$filetype" = "application/vnd.ms-office; charset=binary" ]; then
blMove=true
strFolder="Documents"
else
blMove=true
strFolder="Other"
#echo "doc?" $file $filetype
fi
if [ $blMove = true ]; then
echo Moving... $file to $strFolder
blMove=false
mv "$file" $strFolder/"$file"
fi
done
# Set these two variables to the full pathname
# of your holding and storage directories
downloads=/home/akendrick451/Downloads
cd $downloads
#make sure we have our directories created
mkdir -p Music
mkdir -p Zips
mkdir -p Applications
mkdir -p Documents
mkdir -p Images
mkdir -p Scripts
mkdir -p Other
ls | while read file
do
filetype=$(file -ib "$file")
#echo $file $filetype
# echo "$filetype"
if [ "$filetype" = "application/octet-stream; charset=binary" ]; then
echo "music" $file $filetype
blMove=true
strFolder="Music"
elif [ "$filetype" = "application/x-directory; charset=binary" ]; then
blMove=false
elif [ "$filetype" = "application/zip; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "application/x-gzip; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "application/x-bzip2; charset=binary" ]; then
blMove=true
strFolder="Zips"
elif [ "$filetype" = "image/jpeg; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/png; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/x-ico; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "image/gif; charset=binary" ]; then
blMove=true
strFolder="Images"
elif [ "$filetype" = "application/pdf; charset=binary" ]; then
blMove=true
strFolder="Documents"
elif [ "$filetype" = "text/html; charset=utf-8" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/plain; charset=us-ascii" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "application/msword; charset=binary" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "application/vnd.oasis.opendocument.text; charset=binary" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/html; charset=us-ascii" ]; then
strFolder="Documents"
blMove=true
elif [ "$filetype" = "text/x-shellscript; charset=us-ascii" ]; then
strFolder="Scripts"
blMove=true
elif [ "$filetype" = "text/x-php; charset=us-ascii" ]; then
strFolder="Scripts"
blMove=true
elif [ "$filetype" = "application/vnd.ms-office; charset=binary" ]; then
blMove=true
strFolder="Documents"
else
blMove=true
strFolder="Other"
#echo "doc?" $file $filetype
fi
if [ $blMove = true ]; then
echo Moving... $file to $strFolder
blMove=false
mv "$file" $strFolder/"$file"
fi
done
Thursday, 28 October 2010
Diagnosing linux problems using strace....
from : http://www.serverwatch.com/tutorials/article.php/3909856/Using-Strace-to-Trace-Problems.htm
Using Strace to Trace Problems
October 25, 2010
By Joe Brockmeier
Having trouble figuring out why Apache isn't starting, or another program is crashing and burning, and the logfiles are giving no clue? Time to reach for strace.
What's strace? The strace utility is used to run a command and display its system calls, so you can see exactly what the program is doing until it exits. Experienced users can work with strace to do performance testing and so on, but even beginners can use strace as a diagnostic tool to see why a program is crashing.
Here's what you do. First, simply start your application or service using Strace, like so:
strace commandname
Using Strace to Trace Problems
October 25, 2010
By Joe Brockmeier
Having trouble figuring out why Apache isn't starting, or another program is crashing and burning, and the logfiles are giving no clue? Time to reach for strace.
What's strace? The strace utility is used to run a command and display its system calls, so you can see exactly what the program is doing until it exits. Experienced users can work with strace to do performance testing and so on, but even beginners can use strace as a diagnostic tool to see why a program is crashing.
Here's what you do. First, simply start your application or service using Strace, like so:
strace commandname
Friday, 27 August 2010
Subscribe to:
Posts (Atom)