• Connecting to OSX VPN from Windows XP to 10

    In an environment that is 95% MAC, we leverage OSX server for a lot of things as it is a simple server to deploy and manage. The most useful tool for us is the VPN which allows us to access the file shares and other services on the local network at the office when working remotely. Recently we have been introducing Windows PC’s back into the workflow and connecting natively from these to the OSX VPN posed a number of issues.

    Our OSX server VPN sits behind the router that the office so NAT traversal needs to be taken into consideration. The following are the steps provided by both Apple and Microsoft for editing the registry to allow this.
    Read the rest of this entry »

    Share
  • Shell script to get all WordPress databases and URL’s

    Below you will find a simple script that you can use to find all the databases and URL’s associated to wordpress sites in a shared database. This script requires a SQL user with the ability to ‘show databases’ and access to the DB’s you want to query.

    The script grabs a list of all the databases on the server then loops through them all retrieving the URL from the wp_options table. The script also takes into consideration the fact the the table might not actually be wp_options (could contain some random characters) so we use a wildcard there.





    Read the rest of this entry »

    Share
  • Useful commands to run in a terminal

    With the 1000’s of commands used over the years I sometimes forget what I have run. This post is a collection of commands that have been useful for me in the past and might be useful to others too. All commands are set to run from local(.).

    CREATE AN SSH TUNNEL (remember -i if using pem):

    ssh -C2qTnN -D 8080 user@location

    FIND ALL FILES/DIRECTORIES WITH XXX PERMS AND CHANGE IT TO XXX:
    Files:

    find . -type d -perm 0XXX -exec sudo chmod XXX {} \;

    Directories:

    find . -type f -perm 0XXX -exec sudo chmod XXX {} \;

    Read the rest of this entry »

    Share
  • 301 redirect all subdomains to new domain on apache

    While trying to consolidate many subdomains under one new domain on apache we had to add the following into the sites configuration file to redirect the multiple subdomains to one. This could be added into the .htaccess as well.

    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^newdomain.com$ [NC]
    RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301]
    

    Read the rest of this entry »

    Share
  • Merging 100+K Gzipped Files Together

    In order to open a large volume of cloudfront logs in a spreadsheet, we needed to merge over 100K .gz files on OS X Maverick into a single file. Trying to use the following command resulted in a /usr/bin/cat: Argument list too long error:

    cat logs/*.gz >> combined_logs.gz 

    The reason this error occurs is because bash expands the asterisk to all matching files, producing a very long command line. To circumvent this problem the xargs command needs to be used to split up the list:




    Read the rest of this entry »

    Share