Your shopping cart is empty.

Latest Posts

Linux Command Reference

Included below are some commands that I have found, created or tweaked to help make life easier along the way. I have collected them here so I can easily refer to them instead of buildling up the commands from scratch. Some are very simple, others are approaching "script" level. Hopefully others will find them useful as well.

Misc Linux Commands

Find and compress all PNG files under the apache web root:

Tags: 

SELinux

Getting SELinux working can be tough. Here are some commands I found useful.

Is SELinux enabled?

sestatus

Disable SELinux without reboot (and only until the next reboot):

setenforce Permissive

Disable SELinux persistent:

vi /etc/sysconfig/selinux
SELinux=disabled

Show the security context of a file:

ls -lZ

Copy the context from one file to another:

chcon --reference=<source> <destination>

SQL Command Reference

Deactivate all inactive users in the last year:

UPDATE `smf_members` SET `is_activated` = 0, `validation_code` = `dateRegistered`
WHERE (UNIX_TIMESTAMP() - `lastLogin`) / 86400 >= 365
AND (UNIX_TIMESTAMP() - `dateRegistered`) / 86400 >= 365;

Search and replace text in the "body" field (note that it must be updated in 2 places):

UPDATE smf_messages SET body = replace(body,'OLD','NEW');

Append a value to a field, if it's not already present:

Tags: 

Linux Package Management Commands

Yes, some distros still use rpm.

Extract files from an RPM:

rpm2cpio filename.rpm | cpio -idv

Unpack an RPM into /tmp/deleteme without installing it:

rpm -ivh -root /tmp/deleteme --nodeps --noscripts package.rpm

Install

rpm -ivh

Upgrade (use this except for kernels)

rpm -Uvh

Find out what's installed

rpm -qa

See which package a file belongs to

rpm -qf

List files provided by a package

Tags: 

The Joy of OpenSSL

Get into the correct directory:
cd /etc/pki/tls/certs

Generate key
openssl genrsa -des3 -out mike.key 4096
chmod 600 mike.key

Generate signing request
openssl req -new -key mike.key -out mike.csr
chmod 600 mike.csr

Get the CA to sign the request
openssl x509 -req -days 10000 -in mike.csr -out mike.cert \
-CA /etc/pki/tls/certs/army.ca/Army.ca_CA.cer \
-CAkey /etc/pki/tls/certs/army.ca/Army.ca_CA.key -CAcreateserial

Wireshark and tcpdump

Wireshark and tcpdump are extremely powerful network troubleshooting tools. Here are some command examples that may be useful.

Kids Quotes

...because sometimes kids say the darndest things.

Sarah

Age 1-2

"Look at all the STUFF!" (Said to Annette, while she was getting in the shower.)
- 1998

"Holy Jesus, it's beautiful!" (Said about a newly added Christmas decoration.)
- December 1999

Age 3

"Daddy knows all about cheese in my hand." (Said to DJ when I went to get Sarah a cheese slice.)
- July 2000

Tags: 

How to check for an open relay

To see if yourserver.com is an open relay, you can run through the following sequence on any box that has a telnet client:

telnet yourserver.com 25
HELO myserver.ca
MAIL FROM:
RCPT TO:
DATA
From: "Relay Test"
To: Mike
Subject: Open Relay Test
This is a relay test. A properly configured mail server
should decline to relay this message.
 
.
QUIT

Using a Linux Webcam

It's actually surprisingly easy. Install fswebcam (preferably via RPM) and then run this command:

/usr/bin/fswebcam --quiet --background --loop 120 --skip 40 \
--timestamp "%d-%m-%Y %H:%M:%S (%Z)" --png --palette png \
--font /usr/share/fonts/liberation/LiberationMono-Regular.ttf \
--resolution 640x480 --info "The Bobbitt Family" --top-banner \
--save /var/www/webcam/webcam.png

Tags: 

Adobe Photoshop Tips

Colouring Pages

  • Open the image
  • Image --> Image Size --> 720x540
  • Image --> Mode --> Grayscale
  • Filter --> Sketch --> Photocopy
  • Settings
    • Detail: 2
    • Darkness: 25
  • Blur More

Army.ca Intro Pics

  • Image --> Adjustments Gradient Map to #003300 --> 009900 (reverse)
  • Filter --> Sketch --> Photocopy
  • Settings
    • Detail: 12
    • Darkness: 50

Pages