# BEGIN WordPress

RewriteEngine On
RewriteBase /

# replace ITSME with your own string
# and yourdomain.com with well….

# Is this a request for wp-login?
RewriteCond %{REQUEST_URI} ^/wp\-login\..*

# Check for the secret word
RewriteCond %{QUERY_STRING} .*ITSME=.*

# Set a cookie, so that all future requests will be auto-authenticated
RewriteRule ^.* /wp-admin/ [cookie=ITSME:true:.yourdomain.com:3600:/,R,L]

# Is this a request to the admin?
# comment out this line and you will be able to reach wp-login.php, but not anything in /wp-admin/ until you authenticate
RewriteCond %{REQUEST_URI} ^/wp\-login\..* [OR]
RewriteCond %{REQUEST_URI} ^/wp\-admin/.*
RewriteCond %{HTTP_COOKIE} !\bITSME\b

# Unathenticated, redirect to homepage with a disallowed indicator
RewriteRule ^.* /404.php [R,L]

log in using:
#http://www.yourdomain.com/wp-login.php?ITSME=true

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

see: http://www.mawhorter.net/web-development/securing-wordpress-a-passive-method-for-preventing-unauthorized-requests-to-wp-admin-and-wp-login-php for complete instructions.

find /your/directory/here -mtime +90 -type f -exec rm -rf {} \;

This command will do a search in /var/log for all files that were last modified 90 or more days ago and executes a recursive forced (-rf) remove (rm).

The “{}” (curly braces) is the place holder for exec to use where it will put the name of the file, and the “\;” tells exec that’s the end of the statement. A a test replace the “rm -rf” with “ls -la” to get a list of all the files that would be removed.

But what if there is a directory you want to exclude from the search path?

find /your/directory/here -mtime +90 -type f ! -iwholename “*/Yo*” -exec rm -rf {} \;

In this case this I had a bunch of directories that were named Yo Bob, Yo Susie etc etc that needed to be skipped. That did it.

sftp for wordpress

Jun, 15 -- Categories: Linux

wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-1.0.tar.gz
tar -zxvf libssh2-1.0.tar.gz
cd libssh2-1.0/
(./configure, make all install)

After you install libssh, remember to install the PECL module:

pecl install -f ssh2
and modify your php.ini to include the following beneath Dynamic Extensions

extension=ssh2.so
You’ll probably need to restart Apache afterwards:

/etc/init.d/apache2 restart

Checking Your BIND Config

Jun, 9 -- Categories: Linux

There are several small programs that are in the BIND package that allow integrity checking of the named configuration and zone files. These are great tools to maintain your sanity for testing purposes, as named can be quite particular about problems in the configuration and zone files.

[bash]# named-checkconf /etc/

The most common errors for misconfiguration in the named file are missing semicolons “;” after parameter settings.
The zone file should be checked for format consistency, and should resemble the above example.com zone file (substitutions should be made for the domain and hosts being configured).

[bash]# named-checkzone -d example.com /var/named/data/master-example.com
loading “example.com” from “/var/named/master-example.com” class “IN”
zone example.com/IN: loaded serial 10
OK

The reverse zone file should also be checked for any errors.
[bash]# named-checkzone -d 1.168.192.in-addr.arpa /var/named/data/reverse-192.168.1
loading “1.168.192.in-addr.arpa” from “/var/named/data/reverse-192.168.1″ class “IN”
zone 1.168.192.in-addr.arpa/IN: loaded serial 10

taken from:

http://www.brennan.id.au/08-Domain_Name_System_BIND.html

PERL umask – get your 0777

Jun, 7 -- Categories: Linux

If perl is making your directories as 0755 even tho you’ve seriously told it 0777. Your umask is set to 0022.

Change it to 0 to get perl to obey…

my $umask = umask 0;

mkpath(“$home/$FORM{userDir}”, 0, 0777) unless -d “$home/$FORM{userDir}”;

rotate laptop screen

Jun, 7 -- Categories: Uncategorized

With “xrandr -o right” you can rotate the screen and hold the laptop like a book. On my laptop my thumb can sit nicely on the up/down arrows for page turning and it feels much more natural for prolonged periods of reading. Just run “xrand -o normal” to get back to the normal screen orientation.

reddit.com > foobster

Change mod date with touch

Jun, 2 -- Categories: Linux

touch -t 05070915 somefile.txt

The first four digits stand for May 7 (0507) and the last four (0915) the time, 9:15 in the morning.