Skip to content

Instantly share code, notes, and snippets.

@navitronic
Last active December 14, 2015 23:29
Show Gist options
  • Save navitronic/5165971 to your computer and use it in GitHub Desktop.
Save navitronic/5165971 to your computer and use it in GitHub Desktop.

Code Snippets


Show the changed files between two folders

Create a text file showing the differences between two sets of files.

diff -qr foldera folderb | grep -v -e 'DS_Store' -e 'Thumbs' | sort > diffs.txt

Remove certain file types

Remove only files:

find . -name "._*" -type f -exec rm -vf {} \;

Remove only folders:

find . -name ".svn" -type d -exec rm -vrf {} \;

Remove either:

find . -name ".svn" -exec rm -vrf {} \;

Process for cleaning word content

  1. Convert entities to characters excluding tags
  2. Strip trailing spaces.
  3. Find/Replace "\.\ +" with ". " to remove stupid period and double spaces.
  4. Find/Replace "\n{3,}" with "\n\n" to remove places with multiple linebreaks, eg more than one.
  5. Find/Replace "^&#?[A-Za-z0-9]+;\s" with "- " to make bullets from entities.

Sensible File Permissions

For Folders:

find ./ -type d -exec chmod 755 {} \;

For Files:

find ./ -type f -exec chmod 644 {} \;

Both at Once:

find ./ -type d -exec chmod -v 755 {} \; && find ./ -type f -exec chmod -v 644 {} \;

Initialise git in a folder of existing files

touch .gitignore && git init && git add . && git commit -m "initial commit"

Remove wordpress admin bar

function my_function_admin_bar(){
    return false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

##� Process for Purchasing and Setting up an SSL on Site5

  1. Generate the CSR (ref)
    1. SSH into server and generate an RSA private key
      openssl genrsa -out domainname.key 2048
    2. Create CSR with following command
      req -new -key domainname.key -out domainname.csr
      You will be asked various information, refer to CSR legend here
    3. You will be prompted for extra attributes (i.e., a challenge password and optional company name); we recommend you leave these attributes empty (just hit Enter).
    4. Verify the contents of your CSR by using the following command:
      openssl req -noout -text -in domainname.csr
    5. Save a copy of your CSR. The CSR will be needed during the online order process.
  2. Purchase the SSL using the CSR
    http://www.geocerts.com/order/
    You will need to coordinate the ability to send an email to an address at the domain that you are setting the ssl up for. To approve the SSL setup
  3. Login to site5 backstage
  4. Download ssl files from geocerts
  5. Visit ssl request page
  6. Paste in relevant details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment