Creating a Better Print Screen

How I created a print screen command that automatically uploaded a screenshot to Google's free Picasa Image Hosting Service.

Read more

Working on an Issue from the Drupal Issue Queue

How to set up a development environment with git for working on issues in the Drupal Issue Queue.

Read more
honey badger picture and git logo from wikipedia cc-share-alike

Git Log to the Rescue

A summary of the different options for viewing a project's commit history with git log.

Read more

Vim Tip: yanking or deleting a big chunk of text

Using Vim to separate database sections in a Large Database Dump.

Read more

Notes on Drupal Features

John Gould print image of Ornithorhynchus anatinus (platypus) and drupal.  From wikipedia.

One of the difficulties of keeping a Drupal website completely in version control, is that a lot of the configuration is stored in the database. Each change you make to a site via clicking and saving on a site administration page is saved in the database. It is difficult to keep a history of these changes without writing the entire database to a file and then checking that into version control. But you don't want to commit an entire database into git. This is where the Features module comes into play. It helps separate the site's configuration in the database from the site's content.

Working on an Issue from the Drupal Issue Queue

These are the steps, using git mostly, needed to work on an issue from the drupal issue queue.

First Time: Clone Drupal Core

cd into your development folder and git clone drupal core, (in this case, I'm working on a drupal 8 issue).

cd ~/projects/
git clone --branch 8.x drupal-8.x
cd drupal-8.x

Later, Refresh Repository with Git Pull

After you've already cloned a copy of drupal for testing and development, all you have to do is run "git refresh" to update your copy.

New Scuttle Developments

screenshot of scuttle save bookmark window

I am a big fan, user, and tinkerer of Scuttle: the Open Source Social Bookmarking System. In case you have never heard of it, Scuttle is similar to other social bookmarking web applications like Delicious and Pinboard. It allows you to save website bookmarks on a public site, so that other people can follow your bookmarks and you can follow other people with similar interests. Although unlike delicious and pinboard, most scuttle instances are decentralized with only a few users. So there is less of the social aspect. (That is until someone figures out how to federate all of the decentrailized installations.)

Git Log to the Rescue

honey badger picture and git logo from wikipedia cc-share-alike

Using Git Log

git log —stat

If you’d like to see the number of changes in each file, add the —stat option.

git log —since=“3 weeks ago” —until=“yesterday”

Git log also provides an intuitive way to provide a date range, with —since and —until options.

git log -p

With the -p option, git log will show patches of each of the commits.

git log —graph

Git log with the —graph option prints a graph along the left edge to show branches of the repository.


Notes on Using R for Statistics

R Notes

Common R Stuff

Start up the R command line interface

$ R
R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.u
Type 'contributors()' for more information and

Vim Tip: yanking or deleting a big chunk of text

I have a large mysqldump backup file of all databases on a server but I need a sql backup for a single database. So I wanted to break up the dump file into smaller pieces. This is one solution I came up with using vim.

  1. I opened the dump file and a newly created file for the single database:
vim db-dump.sql newdumpfile.sql
  1. I searched for the start of the database section by searching for:
/USE `databasename`

where "databasename" is the specific database I want to grab.

AWK one-liner

The Twa Corbies by Arthur Rackham

I was printing out the sizes of different databases and trying to sum them. The command I was using was:

$ du -s /var/lib/mysql/* | sort n
6040    u_labs2
7632    dnvtech3
7828    courtwatch1
19664   statusnet2
23044   drupaldbc1
84896   managingnews0
248056  ibdata1

This prints out a two column list of files sizes and file names. I wanted to turn this into a csv. What is the best way to do this? AWK of course.

AWK to the Rescue

This print just the file sizes:

$ du -s /var/lib/mysql/* | sort n | awk '{print $1}'

This prints the file name first, comma, file size:

Drush Commands

Basic Drush

// Download a module or theme
drush dl cck

// Enable module or theme
drush en cck

// clear cache all, don't need sudo
drush cc all

// Get help message on command
drush help pm-update

// List site aliases
drush sa

// Get status on particular site, via site-alias
drush @math status

Advanced Drush

Using Drush to sync a remote server

Sync Dev Server with Staging Server

// drush core-rsync <source> <destination>
drush core-rsync @dev @stage

Cool Things to do in Emacs' Dired Mode

Delete some files in the Downloads folder

My Downloads folder is always out of control. There are always a
ton of pdf files that I opened once in a browser but don't need to
save. It's a pain to open a GUI file navigator, like Nautilus, and
double click on each pdf file to view it and see if it should be
tossed. However with Emacs, trimming my Downloads directory of old
files is quick and easy.

Zombies, Emacs and Orgmode

Zombie Graph with Emacs and Graphviz

Zombie Apocalypse Digraph

I was playing around with Graphviz inside orgmode inside Emacs.

Come the Zombie Apocalypse I'll be prepared, thanks to Emacs and Orgmode.


Subscribe to Major Ursa RSS