Archive for Uncategorized

Add a user to .htpasswd

echo -e “myuser:`perl -le ‘print crypt(“mypassword”,”abc12345abc”)’`” > ./.htpasswd

Comments

Delete all files matching a pattern within a directory recursively

find . | grep -r -e “SomeFilePrefix.*\.php” | xargs rm

Comments

Backup a folder

I usually keep this script in the
“/usr/bin/archive” file and make it executable.

#!/bin/bash

FOLDER=$1
NOW=$(date +"%Y-%m-%d")

OUTPUT="tar -cjf $FOLDER-$NOW.tar.bz $FOLDER"
echo $OUTPUT
$OUTPUT

Usage:

$ archive folder_name

Will create a file “folder_name-2010-07-18.tar.bz” in the current directory. Then you can rm -rf the folder and copy the archive to your archived location.

This goes well with “/usr/bin/archive_all”

#!/bin/bash

for file in *;
do
if [ -d "$file" ]; then
archive "$file";
fi

done;

This will create archives of all the subdirectories in the current directory. This is good for archiving old projects that don’t need to be uncompressed anymore.

Comments

Programming Considerations

Performance (the universal currency of software)

Maintainability
– modularity

Resources
– Network
– Memory

Financial Cost
– Programmer Time
– Hardware Cost
– Licenses Cost
– Electricity Cost

Human Resources
– Programmer Time

Time to Market

Correctness

Simplicity

User Friendliness (usability)

Stability

Scalability

Feature Set

Security

Business Integration
– Coordination and Alignment with Domain Knowledge Experts
– Marketing
– Product Management

Feasibility

Comments

Keep an Ubuntu server’s time up to date

Install rdate

apt-get install rdate

Edit the cron table
crontab -e

Add this entry

30 5 * * * /usr/bin/rdate -s time-a.nist.gov

Comments