Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Tracy Floyd http://www.coalescedesign.com

Misc. terminal command reference


# Creating symlink
ln -s   [destination file/dir]    [link name]

# Import svn 
svn import -m "initial import" . http://svn.cdnm.com/repo

# Untar all .tar files in current directory:
for i in *.tar; do tar -xvzf $i; done

# Creating an archive
$ tar cjf outputfile.tar.bz2 inputs
Extract said archive to the current directory. For a compressed archive, you’ll again need to add the z for a .tar.gz, or j for .tar.bz2.
$ tar xf inputfile.tar
$ tar xjf inputfile.tar.bz2

Helpful localhosting terminal commands

// description of your code here


# Adding vhosts
mate /etc/httpd/httpd.conf
mate /etc/hosts

# Restart Apache
sudo apachectl graceful

# Recursively remove .svn folders
rm -rf `find . -type d -name .svn`

Force traffic over HTTPS

// Force traffic over HTTPS to avoid weird session dropping issues, Also handles addition or removal of www prefix as needed for your security cert,


<IfModule mod_rewrite.c>

RewriteEngine On

  # Force removal of www
  RewriteCond %{HTTP_HOST} ^www\.(.+)$
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  # (Or force addition of www depending on your cert)
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

  # Now Force traffic to use HTTPS
  RewriteCond %{SERVER_PORT} !443
  RewriteRule ^(.*)$ https://securesiteurl.com/$1 [R=301,L]

</IfModule>