Dumping MySQL Tables via a Wildcard

No Gravatar

I have been trying to figure out a way to do this for years! I’ve had customers ask to dump tables from a database that match a certain prefix, however mysqldump doesn’t understand how to use wildcards. I used to have to list each and every table by hand in order to create a dumpfile that matched the customer’s requirements. No longer!

The following example can be used to dump all tables that begin with “javier_” from the database called “bigdatabase“:

mysql -s -r -p bigdatabase -e 'SHOW TABLES LIKE "javier_%"' | grep -v Tables_in | xargs mysqldump -p --add-drop-table bigdatabase > javier_.sql

The “-s -r” options tell the mysql client to produce a silent and raw output. The “grep -v” gets rid of the header line, and finally the xargs portion tells mysqldump what to do.

Enjoy!



Posted from San Antonio, Texas, United States.

Javascript, JQuery, Passwords, Etc.

No Gravatar

(If you want to skip to the good part of this post, head to here!)

I have been busy the past few weeks! I decided that I wanted to try and learn a bit about Javascript and JQuery, so I took it upon myself to write a couple of Web Apps. The first was a little private Web App that I made for my wife and daughter. We’ve recently begun using a “Happy Ticket” reward system, where she accumulates the tickets based on her good behavior. What the Web App does is serve as a bank for her tickets so that we don’t have to keep track of paper tickets. The app provides the ability to:

  • Bank tickets by Laura and I. Banking tickets requires a user account and passcode that is entered to authenticate that it is either Laura or I banking the tickets. It also records the GeoLocation at the time for future use.
  • Spend Ticket by Andi. There is an interface for Andi to select the number of tickets that she wants to spend with a slider, and then she puts in her passcode to authorize the spending. I am also recording the GeoLocation information of these transactions so that in the future if she does not remember a transaction, I will not only be able to show here when it was made, but also where. Since she is the only one with the ability to spend tickets, she can’t claim that we spent them. :-)
  • Basic Reporting. Right now, the reporting is limited to an AJAX interface that shows you the transaction records in reverse chronological order. Each time you push the “Show more” button, it appends the next five entries to the display. Right now it only shows who made the transaction, the date/time and whether it was a debit (shows as green) or a credit (shows as red). In the future I would like to add a way to also see on a map where the transaction took place.

“I Can Haz PW?” Web App & Extension

The other app that I wrote is public and available for use. It started out as an iPhone web app for my “I Can Haz PW?” website. It ended up being a Web App for just about any modern mobile device, such as an iPhone, iPad, Android, etc. It also works in a normal desktop browser. If you are using an iPhone or iPad with Safari, you can visit http://icanhazpw.info/ and it will detect your browser and forward you to http://m.icanhazpw.info/. All other mobile browsers can try and going directly to http://m.icanhazpw.info/. If you install it on your iOS device as a Home Screen Web App, it should also be available to you when you are not connected to a network or the Internet.

I also took the code that I wrote, and bundled it into a Google Chrome extension. This allows you to quickly generate a random password from the Chrome web browser without having to leave the page that you are visiting. You can find the extension here: http://icanhazpw.info/chrome/ICanHazPW_v1.crx.

If anyone encounters any problems with either the WebApp or the Chrome Extension, send me an email at “javier dot g dot ayala at me dot com”.

Javier

I Can Haz Password?

No Gravatar

Last night, a site that I helped write in Python (prior to 2005) was moved to a new server. It came as a surprise to no one that the site broke as a result of the move. The old server was likely RHEL 2.1. The new server is likely RHEL 5 or 6. Python versions are different, and I don’t even know if they copied over the custom module stuff that we did back then.

In any case, the site itself was old and outdated, and hadn’t been updated in 6+ years. Who cares, right? Well, apparently, there were a large number of users that had been using a Javascript password generator that had been located on the site for whenever they needed to generate random passwords. (It’s actually the same Javascript used on this very site.)

This dilemma got me thinking about other easy ways to get a random password. So I decided to do something about it. My efforts have produced the site which I now announce to you!:

http://icanhazpw.info

The ICanHazPW site is a simple site that returns a randomly generated password when the site is accessed via a browser, or a command-line interface such as “curl” or “wget”. All passwords generated will contain a mixture of Uppercase and Lowercase letters, numbers, and special characters. By default, the site will return a password with a length of 8 characters. You can easily change the length requested by prepending either “12″ or “16″ as the sub-domain name:

12.icanhazpw.info returns 12 characters

16.icanhazpw.info returns 16 characters

If anyone has any comments, or questions about this site, please email admin icanhazpw.info.

Javier

My Morning Commute

No Gravatar

I decided that my first “project” to use my Flip UltraHD camera on would be a time-lapse video of my morning drive. I shot the video the morning of October 13, 2009. This morning was a bit atypical since it was raining, which has been rare this year in San Antonio. The rain led to a somewhat longer commute then usual (60 min. vs. the usual 40 min.)

I took the footage from the Flip and imported it into iMovie on my MacBook Pro. From there, I sped up the video by 800%. The resulting video was 9 minutes long as opposed to the original 60 minutes. I think that if I do this again, I may speed it up 1600% instead. Anyway….you can find it below.

J

Check out my new monitor!

No Gravatar

As a reward for some work that I did with my job, I was given a brand new 24″ Dell 2408WFP UltraSharp monitor.  It is now running as my main display off of my MacBook Pro.  I also have a 19″ Dell E196FP monitor connected to the MacBook Pro over USB via an IOGear GUC2015V External Video Card.  That’s right, count them…THREE displays running off of one MacBook Pro!  Jealous?

Want to know more about it?  Click here to be taken to the Flickr website where you can see the notes that I attached to the picture.

My new monitor setup

J

Cloud Files Test

No Gravatar

A few months back the company that I work for, Rackspace Hosting, began offering a product called “Cloud Files” through one of our subsidiaries, Rackspace Cloud.  It’s a CDN method for distributing files via the Internet.  You upload your files to the “Cloud Files Container” (I’m using Cyberduck to accomplish this), and it gets propagated into Limelight Network’s CDN.

A lot of my customers are asking questions about using Cloud Files, so I figured I’d give it a try and see how it works!  A few minutes ago, I uploaded my very first file to the Cloud.  It’s a 1.1MB high-resolution satellite image of Washington D.C. taken during President Obama’s inauguration.

(Clicking on the above thumbnail will open the high-resolution image in a new window.)

J