Skip to content

Instantly share code, notes, and snippets.

View jwreagor's full-sized avatar

J R jwreagor

  • New Gillington, WI
View GitHub Profile
@jwreagor
jwreagor / nginx.conf
Created April 9, 2016 21:15 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender). Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;
@jwreagor
jwreagor / install_provisioning_profile.sh
Created February 9, 2016 02:53 — forked from subdigital/install_provisioning_profile.sh
Script to install provisioning profiles on a build server
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
then
@jwreagor
jwreagor / Dockerfile
Last active August 29, 2015 14:27 — forked from kazu69/Dockerfile
docker + nginx_mruby
FROM ubuntu
RUN apt-get update
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository -y ppa:brightbox/ruby-ng
RUN apt-get -y update
RUN apt-get install -y git ruby2.2 rake curl wget gcc make bison libssl-dev libcurl4-openssl-dev libpcre3 libpcre3-dev
WORKDIR /usr/local/src/

ChefDK, Test Kitchen Driven NTP Cookbook

This gist uses TK+Berkshelf to drive creating a vagrant virts and converging a simple recipe to install and configure NTPd. This is a simple cookbook that has one recipe, one template (for ntp.conf) and one attribute file. It works on Ubuntu 12.04 and CentOS 6.4 (and derviatives) and the attribute file is used to support both distros.

This should work on Mac (where I developed it) and any chef-supported Linux that you can get Vagrant onto (Ubuntu/CentOS).

Because I use ChefDK and Test Kitchen, I can largely ignore setting up Vagrant and Berkshelf and can get right to work on writing recipe code.

NOTE: Modern (7/6/2014) Recipe Generation

#!/bin/bash
#
# Check package.json and npm install after git checkout.
# Put this to .git/hooks/post-checkout
#
PREVIOUS_HEAD=$1
NEW_HEAD=$2
BRANCH_SWITCH=$3
site "http://community.opscode.com/api/v1"
cookbook "apt"
cookbook "graphite"
cookbook "vim"
cookbook "statsd",
:git => "https://github.com/hectcastro/chef-statsd",
:ref => "v1.1.3"
:;exec emacs -batch -l "$0" -f nic-custom-self-install "$@"
;;; custom.el --- Nic's custom stuff for Emacs
;; Copyright (C) 2012 Nic Ferrier <[email protected]>
;; Author: Nic Ferrier <[email protected]>
;; Keywords: local
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
@jwreagor
jwreagor / application_controller.rb
Created December 20, 2011 19:54 — forked from aliang/application_controller.rb
Force SSL on Devise routes only, then redirect back
class ApplicationController < ActionController::Base
# Tell Devise to redirect after sign_in
def after_sign_in_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
# Tell Devise to redirect after sign_out
def after_sign_out_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
@jwreagor
jwreagor / mongodb
Created September 30, 2011 21:30 — forked from pasviegas/mongodb
Simple monit script for mongodb
check process mongodb with pidfile /db/path/mongod.lock
group database
start program = "/etc/init.d/mongodb start"
stop program = "/etc/init.d/mongodb stop"
if failed host 127.0.0.1 port 28017 protocol http
and request "/" with timeout 10 seconds then restart
if 5 restarts within 5 cycles then timeout
# Block Facebook
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.static.ak.fbcdn.net
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com