replace first character of mysql string
To replace a question mark with a blank string:
UPDATE node SET title = CONCAT('', TRIM(LEADING '?' FROM title)) WHERE title LIKE '?%';
ssh keys & iptables
Here are some pleasantly simple instructions for setting up ssh keys and iptables:
http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1
mysql to list cache and content tables for drupal
select table_name from information_schema.tables where table_schema='DB_NAME' and table_name like 'content%' or table_name like 'cache%';recursive sed excluding svn files
replace string1 with string2, recursively:
find ./ -path '*/.svn' -prune -o -type f -exec sed -i "s/string1/string2/g" {} \;temporarily redirecting all traffic except images to static page
Here's an .htaccess file that does the trick nicely, even providing a 302 temporary redirect:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png)$
RewriteRule !^site_maintenance\.html$ /site_maintenance.html [L,R=302]
</IfModule>batch converting Nikon .NEF images to greyscale JPG
Run this in a directory of .NEF files to
* create a directory "mkdir bw-jpg-greyscale-lightness"
* convert each image to black and white with auto exposure, colors, white-balence, etc.
* save each image as a JPG to the "mkdir bw-jpg-greyscale-lightness" directory
Written by yours truly
#!/bin/sh
mkdir bw-jpg-greyscale-lightness;
for file in *.NEF;
do ufraw-batch $file --out-path=bw-jpg-greyscale-lightness --wb=auto --exposure=auto --black-point=auto --color-smoothing --grayscale=lightness --out-type=jpg;
donedrupal: deleting all content via drush
# in drush 3, "generate content" should be "generate-content", hence --allow-spaces-in-commands=true
# 0 0 means create no new nodes /comments
# --kill=true actually does the delete
drush --allow-spaces-in-commands=true generate content 0 0 --kill=truedetecting empty string in mysql
It's this easy: ... WHERE ASCII(field_name) = 0
linux tar simple example
OK, this is really simple, but I'm always forgetting the exact syntax, and man pages are overkill for this.
Tar a directory "dir" into a gzip'd tarball:
tar -zcvf dir.tar.gz dirAnd extract it:
tar -zxvf dir.tar.gzlucid eclipse autocomplete doesn't appear right: solved
Go to System > Preferences > Appearance, choose the theme you want, click "customize", and change the background and text colors for tooltips. You can do it real-time and see your changes, which is great.
Seems like this is a core ubuntu bug, in my book.