Skip to content

Instantly share code, notes, and snippets.

@brandonsimpson
brandonsimpson / ssh_login_private_keys.md
Last active August 29, 2015 14:02
Passwordless SSH logins with private key authentication

###Passwordless SSH logins with private key authentication

  1. On local machine, create your ssh key files

    Run ssh-keygen -t rsa as your local user, and allow all defaults and no password. This will create your private key associated with your computer and a public key (~/.ssh/id_rsa.pub) file to be shared later.

  2. Login to remote server and make sure RSA Authentication and Public Key Authentication is on

$ ssh user@remotehost

@brandonsimpson
brandonsimpson / rsync_server_backup.sh
Last active April 24, 2018 03:57
Backup linux server via rsync to remote backup NAS drive
#!/bin/sh
# Backup linux server via rsync to remote backup NAS drive
#
# Run this from a root cronjob at whatever intervals you need
#
# example:
# # backup server at 4am
# 0 4 * * * sh /root/rsync_server_backup.sh > /dev/null;
#
@brandonsimpson
brandonsimpson / vmware_tools_centos.md
Last active August 29, 2015 14:02
Install / Update VMware Tools on CentOS

Install / Update VMware Tools on CentOS

  1. Create yum repo config file

    sudo vi /etc/yum.repos.d/vmware-tools.repo
    

    Add these config settings, and save file.

@brandonsimpson
brandonsimpson / jira_cacert.md
Created June 8, 2014 17:53
Add ssl cacert for a secure mail server to Jira

Add ssl cacert for a secure mail server to Jira

  1. Login as root and create directory for mail server files to be created. Rename "mail.mailserver.com" for your mail server you're trying to connect to.

    mkdir ~/mail.mailserver.com
    cd ~/mail.mailserver.com
    
  2. Get certificate file contents from mail server on port 995:

@brandonsimpson
brandonsimpson / reinstall_git_brew.md
Last active November 21, 2023 09:45
Re-installing Git on Mac OSX with Brew

Re-installing Git on Mac OSX with Brew

This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

  1. Check which git you're running:
    which git
    
@brandonsimpson
brandonsimpson / py_git_updater.py
Created June 8, 2014 18:24
Python git auto pull for multiple development site virtual hosts
#!/usr/bin/env python
import os
import grp
import pwd
import subprocess
# update these settings to match your server settings
vhost_directory = '/home/' # cpanel uses /home - most linux servers use a variation of /var/www/vhosts
git_pull_command = 'git pull origin dev --quiet' # set to your preferred git pull command, and what branch to pull
show_all_output = True
@brandonsimpson
brandonsimpson / sync_mysql.sh
Created June 8, 2014 20:41
Quickly Dump + Backup + Sync MySQL tables between servers via command line
#!/bin/bash
# sync mysql tables from dev server to production server quickly via command line
# specify the list of tables to sync below
dev_host="127.0.0.1"
dev_user="root"
dev_pass="K#oDAk6AF@GumR7"
dev_db_name="local_dev"
@brandonsimpson
brandonsimpson / osx_uninstall_mysql_install_mariadb_homebrew.md
Last active August 19, 2023 22:55
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@brandonsimpson
brandonsimpson / osx_cleardns_alias.md
Last active August 29, 2015 14:19
Flush and Reset All DNS Caches in OS X Yosemite

###Flush and Reset All DNS Caches in OS X Yosemite

Quickly clear all dns caches in OS X Yosemite with this bash alias.

  1. Edit your local ~/.bash_profile and add the following alias:
alias cleardns="sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches; sudo discoveryutil udnscachestats; sudo discoveryutil mdnscachestats;"
  1. Make sure to reload your bash profile (or restart your terminal):
@brandonsimpson
brandonsimpson / nginx_timed_combined.md
Created April 23, 2015 05:04
Nginx multi-host combined access log format

###Nginx multi-host combined access log format

Log multiple hosts with gzip compression and request time data.

From /etc/nginx/nginx.conf:

log_format timed_combined '$remote_addr - $remote_user [$time_local]  '
	'$host "$request" $status $body_bytes_sent '
	'"$http_referer" "$http_user_agent" "$gzip_ratio" ($request_time)';