leto.net
Google
 
blog
code
freebsd
gitweb
math
pics
travel
writing

del.icio.us
Digg!
share

Random FreeBSD Tips

My Wordpress plugin dies with a PHP Fatal error about simplexml_load_string() not existing!

You do not have the port textproc/php5-simplexml installed, which is as easy as cd /usr/ports/textproc/php5-simplexml make install clean

How do I delete unprintable characters?

This comes in handy when stripping html or some other text source that may have weird characters. Sed or Perl is perfect for this task. In Perl you can define a functions sub remove_unprintable { my $s = shift; $s=~s/[^ -~]//g; return $s; } and use it like so: my $string_with_bad_chars = `cat /bin/ls`; $goodstuff = remove_unprintable($string_with_bad_chars); print $goodstuff; To use this from the command line, define a one-liner in your ~/.bashrc file like so: alias remove_unprintable="sed -e 's/[^ -~][^ -~]*//g'" Make sure to type source .bashrc and your alias is ready to use, and can be used inside unix pipes like: cat /bin/ls | remove_unprintable > some file

.rar files

To look in .rar files that you downloaded, add the FreeBSD package as root with the pkg_add command # pkg_add -v -r unrar Then to expand the contents of a .rar file into the current directory type $ unrar e blah.rar

How do I mirror a site and ignore that pesky robots.txt file?

You may have found out that wget faithfully listens to robots.txt files which tell bots not to download certain portions of a website. To get around this try pavuk: # cd /usr/ports/ftp/pavuk # make install clean Now to ignore robots.txt just use the -noRobots command line flag $ pavuk -noRobots http://www.somesite.com


Jonathan Leto - jonathan at leto dot net

Generated Monday 06th of October 2008 07:28:51 AM
Clicky Web Analytics

Clicky