If you have a document thats full of spaces or empty lines, edit it with Vim:
Eliminate empty lines:
:v/\S/d
Eliminate spaces at the beginning of each line:
:%s/^\s\+//
Eliminate spaces at the end of the each line:
:%s/\s\+$//
If you have a document thats full of spaces or empty lines, edit it with Vim:
Eliminate empty lines:
:v/\S/d
Eliminate spaces at the beginning of each line:
:%s/^\s\+//
Eliminate spaces at the end of the each line:
:%s/\s\+$//
Hi there,
i have written a small client for sau and frupic, it’s only a small bash script. Have a look at it:
#!/bin/bash
#--------------------------------------------------------------------
# $Id: frucln,v 1.7 2007/10/08 18:01:09 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------
# FUNCTIONS
function pause() {
i=0;
echo -n "- pause: "
while [ $i -le $count ]; do
echo -n "."
sleep 1
i=$[$i+1]
done
echo
}
# MAIN
echo "[ frucln - creative coding ]"
# $1: sau
# frupic
case $1 in
"sau")
if [[ $2 > 0 ]]; then
count=$2
pause $count
fi
osys=$(uname)
if [[ ${osys} == "Linux" ]]; then
$(import -window root -pause 0 -quality 100 /tmp/sau.tmp.png)
elif [[ ${osys} == "Darwin" ]]; then
$(screencapture -m /tmp/sau.tmp.png)
else
echo "- Error: Operating System not found"
exit
fi
if [[ -f /tmp/sau.tmp.png ]]; then
id=$(curl -s -F userfile=@/tmp/sau.tmp.png -F "shooter=$(whoami)" "http://sau.frubar.net/")
if [[ $id > 0 ]]; then
echo "- Successfull: SaU"
echo " http://sau.frubar.net/${id}"
else
echo "- Error: Upload failed"
fi
$(rm /tmp/sau.tmp.png)
else
echo "- Error: SaU file doesn't exists"
fi
;;
"frupic")
all=$(echo $2 | grep \*)
if [[ $all ]]; then
for f in $all; do
id=$(curl -s -F userfile=@$f -F "shooter=$(whoami)" "http://frupic.frubar.net/")
if [[ $id > 0 ]]; then
echo "- Successfull: frupic"
echo " http://frupic.frubar.net/${id}"
else
echo "- Error: Upload failed ($f)"
fi
done
exit
elif [[ $2 ]]; then
id=$(curl -s -F userfile=@$2 -F "shooter=$(whoami)" "http://frupic.frubar.net/")
if [[ $id < 0 ]]; then
echo "- Successfull: frupic"
echo " http://frupic.frubar.net/${id}"
else
echo "- Error: Upload failed"
fi
exit
else
echo "- Error: No Parameter given"
fi
;;
*)
echo "frucln:"
echo " - use: frucln "
;;
esac
echo $args
#curl -s -F userfile=@CIMG0885.JPG -F "shooter=`whoami`" "http://frupic.frubar.net/"
Das TShirt muss ich mir einfach noch kaufen:

I love screen, so here is my ~/.screenrc file:
#--------------------------------------------------------------------
# $Id: screenrc,v 1.7 2007/10/08 19:01:09 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------
# DEFAULT
shell bash
autodetach on
defutf8 on
deflogin off
startup_message off
nethack on
activity "activity in %n (%t)"
bell_msg "bell in %n (%t)"
defhstatus "screen: ^En (^Et)"
shelltitle "$ |sh:"
vbell on
vbell_msg "WHAT ??!!"
vbellwait 1
msgminwait 1
msgwait 3
#hardcopy_append on
#hardcopydir ~/.screen
windowlist title " Num%+3=| Fl%+3=| Name"
windowlist string " %3n%+3=| %f%+3=| %t"
zombie ^D^C
escape ^Aa
termcapinfo xterm|xterm-256color|xterms|xs|rxvt ti@:te@
#idle 600 blanker
#blankerprg nice -n 19 cmatrix -abu9
# BINDINGS
bind ^r source "${HOME}/.screenrc"
bind ^e escape ^Xx
bind ^y escape ^Aa
bind ^x lockscreen
bind o copy
bind p paste .
bind . number
bind l lastmsg
bind w windowlist -b
bind r resize
bind s select
bind > split
bind < remove
bind ^f focus down
bind = resize =
bind + resize +5
bind - resize -5
bind ~ resize max
# STATUSPANEL
hardstatus alwayslastline
hardstatus string '%{= kY}[ %{R}%H %{Y}][ %{g}load[%l] %{Y}][ %{B}%d/%m/%Y %c %{Y}][ %{r}%=%?%-w%?(%n%f %t)%?%+w%? %{Y}]'
Es gibt sicher einiges effektivere und bessere Scripte um ein System und MySQL Backup zu machen. Das ist jetzt auch nur die erste Version des ganzen und evtl. kann es jemand gebrauchen :)
#####################################################################
# srv-backup.sh - backup the system and the databases #
# @author: drscream@cyber-tec.org #
# @version: Thu Oct 4 11:35:39 CEST 2007 #
#####################################################################
# CONFIGURATION
#####################################################################
# crontab example:
# 21 4 * * * /opt/av-srv/av-srv-backup.sh mysql
# 2 3 1,15 * * /opt/av-srv/av-srv-backup.sh system
# 2 4 * * * /opt/av-srv/av-srv-backup.sh webroot
# 3 6 * * * /opt/av-srv/av-srv-backup.sh pgsql
## log information ##################################################
log_file="/local/backup/backup.log"
datetime=$(date +%Y%m%d-%H%M%S)
fqdn=$(hostname -f)
## select what to backup ############################################
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => sysdir.txt: text file with the directories to backup
# => rsync: rsync is set the file will rsynced to the backupsrv
system=(1 '/local/backup/system' 'system.$fqdn.$datetime.tar.gz' './systemdir.txt' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => /web: directory to backup
# => rsync: rsync is set the file will rsynced to the backupsrv
webroot=(1 '/local/backup/webroot' 'web.$fqdn.$datetime.tar.gz' '/web' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => user: sql user (root)
# => password: sql password
# => rsync: rsync is set the file will rsynced to the backupsrv
mysql=(1 '/local/backup/mysql' 'root' 'qwe123' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => user: sql user (root)
# => rsync: rsync is set the file will rsynced to the backupsrv
pgsql=(0 '/local/backup/pgsql' 'pgsql.$fqdn.$datetime.sql.gz' 'postgres' 'rsync')
# => 0/1: rsync to the specified server
# => username: username for rsync
# => hostname: specified backup server host
# => /path: path to save the backup ($fqdn is added)
rsync=(1 'username' 'hostname' '/backup')
rsync_args="--archive"
## delete the files after days #################################
delete_files=20
## global variables #################################################
export LANG="en_US.utf8"
PARAM=$1
# FUNCTIONS
#####################################################################
function delete() {
find $1 -type f -mtime +$delete_files | xargs rm 2>/dev/null
}
function log() {
echo $1 >> $log_file
}
function backuprsync() {
if [[ ${rsync[0]} == 1 && ${1} == "rsync" ]]; then
log "($datetime) rsync to server ---------------------------"
rsync ${rsync_args} $2 ${rsync[1]}@${rsync[2]}:${rsync[3]}/${fqdn} >> $log_file
log "end rsync to server -----------------------------------"
fi
}
# MAIN
#####################################################################
## system ###########################################################
if [[ ${system[0]} == 1 && ${PARAM} == "system" ]]; then
# cleanup system backup
delete ${system[1]}
# start system backup
log "($datetime) systembackup: ---------------------------------"
log "backup following files:"
dir_backup=$(cat ${system[3]})
log "$dir_backup"
# compress the files
cd /
tar cvpzf "${system[1]}/${system[2]}" $dir_backup
# rsync if it is set
backuprsync ${system[4]} ${system[1]}/${system[2]}
log "end systembackup ------------------------------------------"
fi
## webroot ##########################################################
if [[ ${webroot[0]} == 1 && ${PARAM} == "webroot" ]]; then
# cleanup webroot backup
delete ${webroot[1]}
# start webroot backup
log "($datetime) webrootbackup: --------------------------------"
log "backup following dir:"
dir_backup=$(ls -la ${webroot[3]})
log "$dir_backup"
# compress the files
cd ${webroot[3]}
tar cvpzf "${webroot[1]}/${webroot[2]}" *
# rsync if it is set
backuprsync ${webroot[4]} ${webroot[1]}/${webroot[2]}
log "end webrootbackup -----------------------------------------"
fi
## mysql ############################################################
if [[ ${mysql[0]} == 1 && ${PARAM} == "mysql" ]]; then
# cleanup mysql backup
delete ${mysql[1]}
# start mysql backup
log "($datetime) mysqlbackup -----------------------------------"
mysqlshow -u ${mysql[2]} --password=${mysql[3]} | tr -d '|' | tr -d '+' | tr -d ' ' | tr -d '-' > /tmp/sql-backup-list.tmp
list=/tmp/sql-backup-list.tmp
ig=3
xr_lines=$(wc -l $list | awk '{ print $1 }')
while [ "$ig" -le $xr_lines ]; do
ig=$(expr $ig + 1)
item=$(awk "NR == $ig {print}" $list)
mysqldump --add-drop-table --allow-keywords -q -a -c -u ${mysql[2]} --password=${mysql[3]} $item | gzip > ${mysql[1]}/$item.sql.gz
echo $item >> $dir_backup
done
# Remove a temp file
rm -f /tmp/sql-backup-list.tmp
# rsync if it is set
backuprsync ${mysql[4]} ${mysql[1]}
log "end mysqlbackup -------------------------------------------"
fi
## pgsql ############################################################
if [[ ${pgsql[0]} == 1 && ${PARAM} == "pgsql" ]]; then
# cleanup pgsql backup
delete ${pgsql[1]}
# start pgsql backup
log "($datetime) pgsqlbackup -----------------------------------"
pg_dumpall -U${pgsql[3]} | gzip > "${pgsql[1]}/${pgsql[2]}.gz"
# rsync if it is set
backuprsync ${pgsql[4]} ${pgsql[1]}
log "end pgsqlbackup -------------------------------------------"
fi
I hate the WYSIWYS (What you see is what you shit) editor in wordpress. So it’s simple to remove it, delete the following directory, nothing will break:
/wp-includes/js/tinymce/