wesley tanaka

Tech

Drop all tables in a MySQL Database

()

echo DROP TABLE `echo 'SHOW TABLES;' | mysql -u USER -p DATABASE | tail -n +2 | sed -e 's/$/,/'` | sed -e 's/,$/;/'

will output the necessary DROP TABLE command. If you have a my.cnf file (in the current directory) you can run the DROP at the same time with:

echo DROP TABLE `echo 'SHOW TABLES;' | mysql --defaults-file=my.cnf | tail -n +2 | sed -e 's/$/,/'` | sed -e 's/,$/;/' | mysql --defaults-file=my.cnf

Fedora 8 sopcast rpm

()

My gsopcast binary from ftp.fedora.cn/pub/fedora-cn/linux/7/i386/gsopcast-0.2.10-1.fc7.fcn.y1.i386.rpm was crashing in Fedora 8.

There's a qsopcast rpm that works with Fedora 8 at http://apt.magiclinux.org/magic/2.1/unstable/RPMS.os/, as well as some other useful rpms like an rpm for the BlueDJ games client.

Join multiple adjacent lines into one line in UNIX, Linux

()

I'm looking for the opposite or the converse of GNU fold — a command line program that would join word-wrapped text into a single line per paragraph. In other words, something that would take input containing adjacent lines of text like this:

now is
the time for
all good men

to come to the
aid of their
country

where adjacent paragraphs were separated with blank lines, and produce output with one line per paragraph, like this:

Nokia N82

()

I owned a Mainland Chinese Nokia N82 for two days, which I purchased for 4180 yuan ($575.84) from a Zhongyu Telecom embedded inside the Kunming Jin Ma Fang (金马坊) Park & Shop.

Authentication in China

()

Many documents in China need to have a company seal affixed to them (盖章) to make them official. From what I can tell, this involves a normal rubber stamp with the name of the company, and a normal red rubber stamp ink pad that you can buy anywhere.

Drupal Search Single Result Redirect

()

A snippet of code that will automatically redirect searches that would display only one search result so that they do not show the search results page but instead immediately and automatically redirect to the first result.

To use it, add it to your active theme's template.php file and replace themename with the name of your theme.

China Telecom Auto-blocker

()

About a month ago, the China Telecom here started blocking my DSL account from downloading web pages. One of their network techs told me they stopped allowing the

Spammer-Powered Distributed Denial of Service

()

Don't stuff beans up your nose, and I definitely do not condone anyone trying anything like this, but it seems like you could use the

Y Combinator Interview Result

()

Dev interviewed for us at Y Combinator today, but they declined to invest. It sounded like they wanted us to reposition more toward technology, which makes sense because they invest in a lot of technology solutions for technology users -- that's where their expertise is. I'm glad we got the (binary) feedback that our story could still use work, but my internal jury is still out on their particular suggestion.

tinyurl command line tool

()
Create an executable file called "tinyurl" in your executable path which contains something like:
#!/bin/sh
wget -q -O - \
-U "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8" \
--header="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1" \
--header="Accept-Language: en" \
--header="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \
Syndicate content
by Wesley Tanaka