Skip to content

Instantly share code, notes, and snippets.

View ryansechrest's full-sized avatar
👨‍💻
Andiamo

Ryan Sechrest ryansechrest

👨‍💻
Andiamo
View GitHub Profile
@ryansechrest
ryansechrest / programs.md
Last active August 29, 2015 14:16
Useful programs for CentOS 7.

Programs

firewall-cmd

firewalld command line client

View firewall state
firewall-cmd --state
@ryansechrest
ryansechrest / rewritemap-sample.conf
Last active December 28, 2015 17:09
Virtual host file for port 80 that redirects 'www' alias to main domain, uses 'cronolog' to rotate error and access logs, redirects non-whitelisted hosts to main site, allows access to itself via URL-based cron jobs, and prompts users of permitted group for username and password via basic authentication. Also includes rewrite map to redirect dom…
<VirtualHost *:80>
ServerName domain.com
RewriteEngine On
RewriteMap redirect_map_master txt:vhosts.d/includes/redirect_map_master
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteCond ${redirect_map_master:%2|domain.com} ^(.+)$ [NC]
RewriteRule ^/$ http://%1 [L,R=301]
</VirtualHost>
@ryansechrest
ryansechrest / vagrantfile-default
Created December 22, 2013 08:34
Default Vagrant box file running CentOS 6.4 x64 with Puppet.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@ryansechrest
ryansechrest / post-receive.sh
Last active February 12, 2017 12:41
Git post-receive hook to deploy WordPress and plugins as submodules. It can also install Node.js modules with npm and vendor packages with Composer.
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"
@ryansechrest
ryansechrest / hello.py
Last active October 14, 2017 15:56
Create a Python command-line tool.
import click
@click.command()
def cli():
"""Example script."""
click.echo('Hello World!')
@ryansechrest
ryansechrest / vagrant.md
Last active January 27, 2019 22:18
Various cheat sheets for systems like Vagrant, Puppet, MySQL, etc.

Initialize

vagrant init [box-name] [box-url] — Add box and initialize VM

CentOS 6.5 box with Puppet:

vagrant init centos65p http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-puppet.box

CentOS 6.5 box without Puppet:

vagrant init centos65 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box

@ryansechrest
ryansechrest / post-receive-laravel.php
Last active November 14, 2019 15:28
Git post-receive hook to deploy a Laravel application.
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"
@ryansechrest
ryansechrest / bash-commands.sh
Last active April 20, 2020 18:15
New and enhanced bash commands for developers on Mac OS X.
#!/bin/bash
# ---------------------------------------------------------------------------
#
# File: .bash_commands
#
# Author: Ryan Sechrest
# Website: ryansechrest.com
#
# Description: New and enhanced bash commands for developers on Mac OS X.
@ryansechrest
ryansechrest / server-to-localhost.sh
Created December 23, 2013 07:40
Bash script to synchronize website directory and database between server and localhost or server and server.
#!/bin/bash
# Created on 10/8/13 by Ryan Sechrest
# site (localhost edition)
# Program to mirror a directory and database of a website between two servers.
### Program meta data
@ryansechrest
ryansechrest / httpd.conf
Created March 21, 2014 03:07
Default httpd configuration file.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding