Tag: — tepezcuintle @ 15:25
A day will eventually come when your need to find and replace a string of text in your database. You don’t know which row, or which column, or which table. Heck, you may not even know which database. Your options are: spend the rest of the summer hunting down the elusive table cells, or use the weapon of mass replacement described below. Naturally and as usual, you absolutely must back up your database (or databases) before attempting any far-reaching scripted mumbo jumbo.
Continua”Search and Replace String MySQL”
Tag: — tepezcuintle @ 17:30
Linux create your own GnuPG private and public key
GNU gpg is encryption and signing tool.
The GNU Privacy Guard (GnuPG or GPG) is a free software replacement for the PGP suite of cryptographic software.
GnuPG encrypts messages using asymmetric keypairs individually generated by GnuPG users. The resulting public keys can be exchanged with other users in a variety of ways, such as Internet key servers. They must always be exchanged carefully to prevent identity spoofing by corrupting public key ? 'owner' identity correspondences. It is also possible to add a cryptographic digital signature to a message, so the message integrity and sender can be verified, if a particular correspondence relied upon has not been corrupted.
Continua”Create your own PGP Public Key”
Tag: — tepezcuintle @ 19:17

Let’s say you need to drop all tables in a mysql database. How do you do that?
You could use a gui, but that’s not fun.
You’re a shell jockey so you want a commandline:
mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | \
gawk '{print "drop table " $1 ";"}' | mysql -u uname dbname
(that’s all one line, but if I do it as a line then it screws up my theme - go figure).
This assumes that you are running in passwordless mode. See “man mysql” for tips on how to pass in passwords in another manner.
What this does is
1.connect to a specific mysql database and execute the command for showing tables
2.find lines that match “Tables_in” and not show them
3.find lines that match the + character and not show them
4.use gawk to print out the words “drop table” followed by the table name (which is in $1) and then a semicolon
5.pipe all of that back to the database you got the list from to drop those tables
Fun stuff and very handy!