Skip to content

Instantly share code, notes, and snippets.

@damonp
damonp / tinyback.sh
Created January 9, 2016 23:05
Backup configuration files before you break them.
#!/bin/bash
# $Id: tinyback.sh 33 2007-05-02 14:18:50Z damonp $
#
# Shell script to create backup of a list of files
#
# Copyright (c) 2007 Damon Parker < damonp@damonparker.org >
# Licensed under the GNU GPL. See http://www.gnu.org/licenses/gpl.html
# This script is not supported in any way. Use at your own risk.
@damonp
damonp / Vagrantfile
Last active November 10, 2015 16:10
Vagrant with Nancy / Mono on ubuntu/trusty64
# -*- mode: ruby -*-
# vi: set ft=ruby :
####
#
# Builds unbuntu/trusty64 box and installs Nancy/Mono and requirements.
# https://github.com/NancyFx/Nancy
#
####
@damonp
damonp / deploy_project.sh
Created November 28, 2014 17:38
Simple shell script to call deploy_git.yml.
#!/bin/sh
ansible-playbook ~/bin/deploy_git.yml --extra-vars="hosts=ANSIBLE_HOST_GROUP project=PROJECT releasedir=SRV_RELASE_PATH repo=ssh://git@github.com/damonp/PROJECT.git"
@damonp
damonp / check_ports.sh
Created November 4, 2014 18:57
Simple script to check open ports on a remote host and restart via ssh/ansible if down.
#!/bin/bash
# Simple script to check open ports on a remote host and restart via ssh/ansible if down.
# Assumes using unique hostnames configured in /etc/ansible/hosts
#
if [ "$1" = "" ]; then
echo "Host and port(s) to check required."
echo "`basename $0` <hostname> <portlist>"
echo "`basename $0` host.domain.com 22,80,443,8080"
exit;
@damonp
damonp / gp.sh
Created November 4, 2014 14:45
Git script to rebase local branch to remote master
#!/bin/bash
if [ "$1" = "" ]; then
echo Current branch name required
exit;
fi
if [ "$2" = "stash" ]; then
echo "Stashing current state..."
git stash
@damonp
damonp / tunnel_bitcoind.sh
Created October 13, 2014 21:07
Shell script to create ssh port forwarded tunnel to remote server for bitcoind rpc access.
#!/bin/bash
# $Id: tunnel_bitcoind.sh 13-Oct-14 16:02:39 $
#
# Shell script to create ssh port forwarded tunnel to remote server for
# localhost bitcoind rpc access.
#
# This script is not supported in any way. Use at your own risk.
#
@damonp
damonp / html5-invoice.php
Last active September 14, 2023 08:45
HTML5 Editable Invoice Example
<!--
Credit: http://www.jonathantneal.com/blog/the-html5-invoice/
Rolled into single file for transportability.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Invoice: #</title>
<style>
@damonp
damonp / deploy_git.yml
Created September 16, 2014 16:04
Simiple skeleton to checkout/update git app project on remote webserver, run composer if necessary and set webserver file permissions.
---
# file: deploy_git.yml
-
hosts: "{{ hosts }}"
user: root
vars:
- project: "{{ project }}"
- repo: "{{ repo }}"
- releasedir: "{{ releasedir }}"
- run_composer: "{{ composer | default(false) }}"
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@damonp
damonp / nginx.conf
Last active August 29, 2015 14:02
Nginx Conf For Wordpress
# http://codex.wordpress.org/Nginx
# nginx.conf
# Generic startup file.
user {user} {group};
#ususally equal to number of CPU's you have. run command "grep processor /proc/cpuinfo | wc -l" to find it
worker_processes 2;
error_log /var/log/nginx/error.log;