Saturday, February 19, 2011

Quickly rename files to lower case

Here is a simple bash oneliner to rename all folders/files in a directory to lower case

for old in * ; do new=`echo $old | tr "[[:upper:]]" "[[:lower:]"`; mv $old $new;  done;

Monday, February 14, 2011

Getting PHP's pcntl working on Snow Lepard

(make sure you've installed Apple's developer tools)


1. Check your version you have installed and download the PHP source code.

$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

$ curl -O http://us.php.net/distributions/php-5.3.3.tar.gz


2. unpack, phpize, configure, make, make install

$ tar -xzvf php-5.3.3.tar.gz
$ cd php-5.3.3/ext/pcntl/
$ phpize
$ ./configure
$ make
$ sudo make install


3. Add "extension=pcntl.so" to your /etc/php.ini

4. Confirm

$ php -i | grep pcntl
pcntl
pcntl support => enabled


Done

Friday, December 31, 2010

New Year's Resolutions: New Passwords for 2011

I'll admit it. I've been bad. I'm a password reuse addict. I just love the way the muscle memory makes it so easy to type. And yes, I have a couple variations on the theme, but I've known for a long time that I would have to get clean. The recent gawker compromise has given me the push I need.

A couple of years ago I've started using LastPass. LastPass offers many nifty security features, but I use it b/c I move between computers, and it fills my forms in for me. (lazy.) Well no more! Time to leverage LastPass to it's potential.

Tonight I'm going clean. No more password reuse for 2011.

Thursday, November 15, 2007

Windows Re-install

Whenever I have a fresh install of XP (twice this week) I have a set of software I need to install.

Sunday, October 14, 2007

WOL

http://ubuntuforums.org/showthread.php?t=234588

Monday, August 6, 2007

Recover / Reset Linux Password

Found these concise steps for reseting a password at: http://ubuntuforums.org/showthread.php?t=3609

Just thought I'd write it down for myself, instead of having google it up again.

Q: I am a complete moron and forgot my password. How can I get back into my system?
(Hey, YOU forgot it, I think that gives me the right to do some degrading before letting you back in!)

A:
1. Turn off your computer.
2. Tap it 3 times
3. Say your favorite magic word.
---- If that doesn't fix your problem, do the steps below... #-o
4. Turn your computer on.
5. Press ESC at the grub prompt.
6. Press e for edit.
7. Highlight the line that begins kernel ........., press e
8. Go to the very end of the line, add rw init=/bin/bash
9. press enter, then press b to boot your system.
10. Your system will boot up to a passwordless root shell.
CAUTION: This is a FULL ROOT SHELL! You can damage your system if not careful!
11. Type in passwd . Set your password.
12. Type in reboot.
NOTE: steps 1-3 may help at this point.
13. Bow down to me....

Tuesday, June 26, 2007

Initial Postgres Setup for Ubuntu

After installing postgresql, here are the first few things I usually do. I'm usually running Ubuntu, but these would be necessary for any postgres install.

  1. Create database users
    $ sudo su - postgres        # become the postgres user
    $ createuser -P lance       # I'm usually a super user
    $ exit                      # exit out of the postgres user
    $ createuser account1 ...   # Create the standard accounts

  2. Setup conf files
    $ sudo vi /etc/postgresql/8.2/main/pg_hba.conf
    $ sudo vi /etc/postgresql/8.2/main/postgresql.conf

  3. Move Data to separate partition (/data)
    $ sudo /etc/init.d/postgresql-8.2 stop
    $ sudo mv /var/lib/postgresql/8.2 /data/postgresql/8.2
    $ sudo ln -fs /data/postgresql/8.2/main /etc/postgresql/8.2/main/pgdata
    $ sudo /etc/init.d/postgresql-8.2 start

  4. Setup admin pack
    $ sudo -u postgres psql < /usr/share/postgresql/8.2/contrib/adminpack.sql