Tech Tips

Things I do often enough to not want to look up again, but not often enough to have to look up every time:

Convert a dynamic VirtualBox VDI to a static one

Disconnect .vdi from any virtual machines it is attached to.
VBoxManage clonehd “c:\Users\You\VirtualBox VMS\VM Name\DiskName.vdi” “c:\Users\You\VirtualBox VMS\VM Name\DiskNameStatic.vdi” –format VDI –variant Fixed
Re-attach new hard drive.

Static HDs are faster when writing than dynamic ones!

Disabling Foreign Key Constraints on MySQL

SET foreign_key_checks = 0;

SSH tunneling

ssh -L [local_port]:localhost:[remote_port] [user]@[host]

SVN branching/tagging by hand

svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-m "Creating a private branch of /calc/trunk."

Symbolic links in Windows

mklink /D target source

Centered, dynamic-width div

In main CSS:

.centered {
margin-left: auto;
margin-right: auto;
display: table;
}

In IE-only CSS:

.centered-container {
text-align: center;
}

.centered {
text-align: left;
}

Markup:

<div class="centered-container">
    <div class="centered">
        Div stuff here.
    </div>
</div>

My Bitcoin Address

1216RrGGwdJBj5s7qD2zboQWWvm5izPZuJ

Tar & Gzip a Directory

tar -czvf archive.tgz .

Extract a .tgz archive

tar -xzvf archive.tgz

Remove .svn folders

find ./ -name ".svn" | xargs rm -Rf

Create a self-signed SSL certificate

(Common Name = www.servername.com)

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
cp server.crt /usr/local/apache/conf/ssl.crt
cp server.key /usr/local/apache/conf/ssl.key

In Apache SSL config:

SSLEngine on
SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Comments are closed.