Skip to content

Instantly share code, notes, and snippets.

View rufhausen's full-sized avatar

Gary Taylor rufhausen

View GitHub Profile
@rufhausen
rufhausen / gist:5114025
Last active December 14, 2015 16:19
This is my attempt to use Git to push to a remote server AND update a version.txt file that is then included and displayed in a web app with the most recent repository tag (1.0, etc.) and the abbreviated commit hash (i.e., the output of "git describe". Naming this file "push", you execute it while passing in the name of the git remote ("./push t…
#!/bin/bash
VERSION_FILE=version.txt
GIT_PATH=/usr/local/git/bin/git
REMOTE_PATH=[full remote path to application root]/$VERSION_FILE
LOCAL_PATH=[full local path to application root]/$VERSION_FILE
TEST_SERVER=[test ip/domain]
PROD_SERVER=[prod ip/domain]
if [ -z "$1" ]; then
@rufhausen
rufhausen / gist:5114133
Created March 8, 2013 04:02
Git post-receive script used by a remote repository to checkout the latest version of a web app to the web application root following a push from the local repository. Includes additional commands for the Laravel PHP framework
#!/bin/sh
WEBROOT=/var/www/vhosts/[application folder]
GIT_WORK_TREE=$WEBROOT git checkout -f
#/usr/bin/git log -1 --pretty=format:'%h' --abbrev-commit > $WEBROOT/version.txt
cd $WEBROOT
rm -f storage/cache/*
echo 'cache cleared\n'
rm -f storage/views/*
@rufhausen
rufhausen / dbbackup.sh
Last active September 16, 2015 19:04
Local MySQL backup with "hidden" credentials. Backups over 30 days old are removed.
#!/bin/bash
#MYSQL DATABASE BACKUP
#Author: Gary Taylor <gary.taylor@du.edu>
#Credentials are stored in a separate file that you can keep them out of your repository while including the dbbackup script itself.
#Credentials Location
source $PWD/.backup.vars
#BACKUP FILE NAMING
@rufhausen
rufhausen / Slack.php
Last active October 25, 2021 14:10
A simple class for sending a message to SlackHQ https://slack.com. Config settings in this example are coming from Laravel's Config facade. Requires Guzzle 4.x http://guzzlephp.org.
<?php
//This code is licensed under the terms of the MIT license
use GuzzleHttp\Client;
use Config; //using Laravel's Config facade
/*
|--------------------------------------------------------------------------
@rufhausen
rufhausen / homestead_extras.sh
Last active August 11, 2021 03:33
My script for adding some "extras" (LDAP, Oracle, MSSQL, Oh-My-Zsh, etc.) to a Laravel Homestead Vagrant VM.
#!/bin/bash
apt-get update
#Additional Packages
apt-get install -y cifs-utils winbind smbclient bindfs gvfs gvfs-bin keyutils unzip php5-ldap php5-mssql zsh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
chsh vagrant -s /bin/zsh
@rufhausen
rufhausen / Push.php
Last active August 10, 2021 08:13
Laravel Artisan command for pushing to remotes via git
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class Push extends Command {
/**
* The console command name.
@rufhausen
rufhausen / serve_function.sh
Created January 13, 2015 18:01
Laravel Homestead's serve function (bash) for oh-my-zsh. Just put it in your .zshrc file after installing Homestead if you are using oh-my-zsh.
function serve() {
if [[ -n $1 && -n $2 ]]
then
sudo dos2unix /vagrant/scripts/serve.sh
sudo bash /vagrant/scripts/serve.sh $1 $2
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve domain path"
fi
@rufhausen
rufhausen / gist:93c6041b033802e5fda4
Created May 21, 2015 00:51
Laravel custom logging with MonoLog
<?php namespace App\Services;
/*
*
* Credit and info about adding singleton to bootstrap/app.php on this thread on Laracasts:
* https://laracasts.com/discuss/channels/general-discussion/error-on-overriding-configurelogging-bootstrap-class?page=1#reply-42802
*
*/
use Illuminate\Contracts\Foundation\Application;
@rufhausen
rufhausen / phpci.yml
Last active December 28, 2017 17:42
Laravel 5.3 PHPCI config
build_settings:
verbose: false
prefer_symlink: false
ignore:
- "vendor"
# mysql:
# host: "localhost"
# user: "root"
# pass: ""
setup:
@rufhausen
rufhausen / .travis.yml
Created January 19, 2017 17:52
Laravel 5.3 Travis-CI config
language: php
php:
# - '5.6'
- '7.0'
# - '7.1'
sudo: false
before_script: