Skip to content

Instantly share code, notes, and snippets.

Mike DeVita mikedevita

Block or report user

Report or block mikedevita

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .vimrc
"{{{Auto Commands
" Automatically cd into the directory that the file is in
autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
" Remove any trailing whitespace that is in the file
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
" Restore cursor position to where it was before
augroup JumpCursorOnEdit
View spaceship.zsh-theme
#
# Spaceship ZSH Theme
#
# Author: Denys Dovhan, denysdovhan.com
# License: MIT
# https://github.com/denysdovhan/spaceship-zsh-theme
# ------------------------------------------------------------------------------
# CONFIGURATION
# The default configuration that can be overridden in .zshrc
@mikedevita
mikedevita / wp.sh
Created Sep 16, 2017 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
View wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
View 1-macOS-10.12-sierra-setup.md

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

@mikedevita
mikedevita / AuthController.js
Created Oct 27, 2017
SailsJs + passport + passport-activedirectory - with ghaiklor/sails-generator-rest-api
View AuthController.js
"use strict";
/**
* AuthController
* @description :: Server-side logic for manage users' authorization
*/
const _ = require('lodash');
const passport = require('passport');
View backup-freenas-config.sh
#!/bin/bash
BACKUPDIR="/mnt/config-backup/backups/phxlp-stg01.devita.co"
DATE="$(date '+%s')"
MAJORVERSION="$(cat /etc/version | cut -d'-' -f2)"
MINORVERSION="$(cat /etc/version | cut -d'-' -f3 | cut -d ' ' -f1)"
BACKUPFILENAME="freenas-${MAJORVERSION}-${MINORVERSION}-${DATE}.db"
DELETEOLDERTHAN="14"
DELETEOLDFILES=true
if [ "$DELETEOLDFILES" = true ] ; then
@mikedevita
mikedevita / .zshrc
Created Dec 7, 2018
Swap Between Two SSH Configs. Proxy and Non Proxy.
View .zshrc
########
# First set your existing ~/.ssh/config how you like.
# Next create a second config called "config_proxy" in ~/.ssh
# Then run swapconf to swap between them.
#######
function swapconf {
PROXY_CONFIG_FILENAME="config_proxy";
CONFIG_FILENAME="config_noproxy":
SSH_PATH="/Users/mhdevita/.ssh";
if [ -f "${SSH_PATH}/${PROXY_CONFIG_FILENAME}" ]; then
View setup.sh
#!/bin/bash
HOMEDIR="/home/mike";
#setup user user
cd "${HOMEDIR}";
git clone git://github.com/robbyrussell/oh-my-zsh.git "${HOMEDIR}/.oh-my-zsh";
wget https://gist.githubusercontent.com/mikedevita/a0b039e56ff089acd1c0e91934041bc8/raw/298a8557e8a968d2810a3099912dcd0fbc4a99ab/.zshrc -O $HOMEDIR/.zshrc;
wget https://gist.githubusercontent.com/mikedevita/992a74c8e8276079f58e59d12db93dbc/raw/bdbf0308aa99e625093827b6ce17d8466ce9a20c/.vimrc -O $HOMEDIR/.vimrc;
You can’t perform that action at this time.