Category Archives: Solutions

Imagemagick: use montage to proof images

The following command will create an image called montage.png that is a collection of all the .png files in the current directory. Images larger than 150px on a side will be resized, but aspect ratio is preserved. The images are separated by a 2px offset.
$ montage *.png -geometry 150×150\>+2+2 montage.png

Posted in Solutions | Tagged , | Leave a comment

Image Magick: Resize a batch of images so they all come out square, and preserve filenames

The following command will shrink all .jpg’s in the current directory that are larger than 500px and center them on a square 500×500px canvas. Since the aspect ratio of the original images will be preserved and not all of the originals are square, the left over space will be filled with an off-white color. [...]

Posted in Solutions | Tagged | Leave a comment

Image Magick: Resize a batch of images and preserve the original file names

The following command will resize any and all .jpg’s in the current directory that are larger than 500px on either side and put them in a file called ‘resized’. Aspect ratios will be respected, and the same filenames will be used for the modified images.
mogrify -path resized -resize 500>x500\> *.jpg
Yes, you have to use [...]

Posted in Solutions | Tagged | Leave a comment

Use source to import large .sql files

Its true, don’t waste your time with strange scripts and such if you’re trying to upload an .sql file that exceeds the limit. Just give up and use source. Note: don’t be confused that I don’t capitalise my MySQL commands. Its my silent protest against standard MySQL syntax: I think capitalising commands you [...]

Posted in Solutions | Leave a comment

The better way to install LAMP on Ubuntu Karmic 9.10

All this comes from here:
https://help.ubuntu.com/community/ApacheMySQLPHP
In the teminal:

$ sudo tasksel install lamp-server
$ sudo apt-get install phpmyadmin
$ sudo gedit /etc/apache2/apache2.conf

Add the following to the end of this file:  “Include /etc/phpmyadmin/apache.conf”

Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value. I used 64M, but that may be overkill.

Also posted in Apache, Linux, Ubuntu | Leave a comment

Bash aliases: create your own bash shortcuts!

When I’m building websites especially, I have to work with a lot of deeply nested files. But typing cd ~/public_html/websitename/wp-content/themes/themename/ in the terminal every time is giving me carpal tunnel, so I found a better way:
First open ~/.barshrc in a text editor and uncomment lines 73 through 75 so they look like this:
if [ [...]

Also posted in Linux, Ubuntu | Leave a comment

How to configure Apache virtual hosting in Ubuntu Karmic 9.10

Before you do anything, back up your original config files. I used to just create a copy of the files with the suffix “.bak” (sudo cp example.conf example.conf.bak), which works, but creates a lot of clutter. Now I use a great little utility called etckeeper which automatically places all files in /etc under [...]

Also posted in Apache, Ubuntu, Virtual Hosts | Leave a comment

Add Mootools to a Wordpress child theme

The following code, when included in the functions.php file in your Wordpress child theme, will correctly load Mootools and a custom script. This is the only way I am able make custom scripts work, but you hear a lot of stuff out there on the interweb…

<?php
function add_js() {
$stylesheet_dir = get_bloginfo(’stylesheet_directory’);
[...]

Also posted in Wordpress | Leave a comment

Ubuntu Karmic LAMP stack installation

In the terminal, type:

$ sudo apt-get install apache2
$ sudo apt-get install php5 libapache2-mod-php5 php5-mysql
$ sudo apt-get install mysql-server
$ sudo apt-get install phpmyadmin

Just agree when it asks you stuff.

Also posted in Ubuntu | Leave a comment

Use ’service’ to start, stop and restart Apache in Ubuntu Karmic

The service service_name command command can be used to start, stop, or restart anything in your /etc/init.d directory. From the command line, use it like this:

$ sudo service apache2 start
$ sudo service apache2 stop
$ sudo service apache2 restart

Also posted in Ubuntu | Leave a comment