June 2006

Statistics With MySQL

by damonp on June 30, 2006

in Data Architecture,Snippets

Need a quick count of repeated occurences of matching rows for statistical analysis?

SELECT search_query, count( search_query ) AS total
FROM search_log
GROUP BY search_query
ORDER BY total DESC

Popularity: 1%

{ 0 comments }

OpenSSL Secure Certificate Tricks

by damonp on June 26, 2006

in Snippets

Create RSA private key

openssl genrsa -des3 -out host.domain.com.key 1024

Generate CSR

openssl req -new -key host.domain.com.key -out host.domain.com.csr

Verify data in CSR

openssl req -noout -text -in host.domain.com.csr

Generate a self-signed certificate (for testing only)

openssl req -new -x509 -nodes -out host.domain.com.crt -keyout host.domain.com.key

Remove passphrase from a key

openssl rsa -in host.domain.com.key -out host.domain.com.pem

Popularity: 1%

{ 0 comments }

Automating Screen Shots on Mac OSX

26 June 2006

MacWorld published a screenshot automation AppleScript which automatically names the file with the date and time and saves the screen shot in the Pictures folder then opens the image in Preview. The AppleScript works great, so I added an option to add my own names instead of the date and time. Download: ScreenShot.scpt

Read the full article →

MySQL Client Security on the Command Line

23 June 2006

The MySQL client allows specifying the database password on the command line using the following parameters: mysql -utheusername -pthepassword thedatabasename If you are in a habit of doing this… STOP NOW! If you are using a shell like Bash, the password is saved in the bash_history file. Should anyone into the server, they can easily [...]

Read the full article →

Hegemony

23 June 2006

Hegemony is the dominance of one group over other groups, with or without the threat of force, to the extent that, for instance, the dominant party can dictate the terms of trade to its advantage; more broadly, cultural perspectives become skewed to favor the dominant group. Hegemony controls the ways that ideas become “naturalized” in [...]

Read the full article →

MySQL RAND Function To Randomly Populate Table

20 June 2006

MySQL’s RAND() function can be used to set random values or fill a table with random data. The following SQL snippet will change column1 in all rows to a random number 0-50. UPDATE tablename SET column1 = (rand() * 50)

Read the full article →

iTunes and Links to Music Store

20 June 2006

Why don’t we have the option to switch this to a search of or sort to that artist or album in our own library? In this age of hyperliked everything, I can’t believe something so simple isn’t.

Read the full article →

Directory Shortcuts Using Bash Functions

15 June 2006

Modify this snippet to match the directory shortcuts you need on your system and add into your .bashrc file: www () { if [ $1 == "domain1" ]; then     cd /www/vhosts/domain1.com/htdocs elif [ $1 == "domain2" ]; then     cd /www/vhosts/domain2.com/htdocs       else     cd /www/vhosts/$1 ; fi echo [...]

Read the full article →

XSLT Transforms With Sablotron

13 June 2006

To transform the XML output of one application into nice looking html with Sablotron sabcmd XSL-STYLESHEET XML-INPUT-FILE HTML-OUTPUT-FILE This is cool for making reports of Nmap port scans. nmap -v -sV 127.0.0.1 -oX XML-OUTPUT-FILE -oX produces XML output Later versions of Nmap come with an XSL template (nmap.xsl). If you can’t find that one, try [...]

Read the full article →

ZenCart Simple Attributes Stock Tracking

12 June 2006

I developed a quantity by attribute modification for ZenCart for a client about six months ago. It has been working very well for them, but it only supports simple attributes. Size OR color OR fabric not size AND color or size AND fabric. The complexity and time involved with maintaining such a detailed inventory of [...]

Read the full article →