Skip to content

Instantly share code, notes, and snippets.

View briceburg's full-sized avatar

Brice Burgess briceburg

  • toil over toil
  • albuquerque, nm
View GitHub Profile
@briceburg
briceburg / MultiFormMultiStep.php
Last active August 29, 2015 14:01
MultiFormMultiStep > A SilverStripe MultiForm Step allowing for a dynamic number of questions/answers. Useful for CMS generated surveys &c.
<?php
/**
* MultiFormMultiStep allows answers to be collected for a dynamic number of
* questions as a single MultiFormStep. This is useful if you have an unknown
* amount of questions (e.g. dynamically generated by a CMS based survey maker).
*
* Define the next and previous steps as usual -- but to get to the next step,
* isLastQuestion must return true. Similarly, to get to the previous step
* isLastQuestion must return true.
@briceburg
briceburg / lxc-centos
Created August 10, 2014 02:10 — forked from hagix9/lxc-centos
CentOS 6.5 LXC Template for Debian Wheezy / Ubuntu ( release 6.5-11.1 / final )
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@briceburg
briceburg / python pageloadtimes
Last active August 29, 2015 14:05
reporting pageload times to librato with python ; useful for monitoring responsiveness and triggering error situations via thresholds
#!/apps/pageloadtimes/venv/bin/python
#
# librato-pageloadtimes.py
# / Brice Burgess @iceburg_net
#
# Reports the load time (in milliseconds) of URLs from url_list
# as a metric named "pageloadtimes.<hostname>" to librato.
#
# For easy instrumentation, the URL is reported as the metric's "source"
@briceburg
briceburg / _etc_init.d_nullmailer
Created August 15, 2014 07:11
CentOS / RedHat LSB init script for nullmailer MTA
#!/bin/bash
#
# nullmailer MTA
#
# chkconfig: - 85 15
# description: nullmailer centos init @iceburg_net
### BEGIN INIT INFO
# Provides: smtpdaemon
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
@briceburg
briceburg / SodiumFreePasswordEncryptor.php
Created November 14, 2014 23:36
SodiumFreePasswordEncryptor ( Salt-less MD5, SHA, &c ) - The necessary evil for seamlessly migrating accounts/passwords into SilverStripe 3.1 + projects
<?php
/**
* Sodium Free Password Encryptor -- for importing legacy passwords
* into SilverSripe 3.1+ projects
*
* 1. Register via mysite/_config/encryptors.yml, e.g.
**
---
@briceburg
briceburg / gist:9a11858be7bc34fe128d
Created November 26, 2014 07:31
overriding GridFieldAddNewMultiClass ItemRequestClass to set some default ManyMany values
<?php
class GridFieldConfig_FlexiForm extends GridFieldConfig {
public static function include_requirements() {
$moduleDir = self::get_module_dir();
Requirements::css($moduleDir.'/css/flexiforms.css');
}
public static function get_module_dir() {
@briceburg
briceburg / gist:231e8c4feeea986ed2be
Created August 10, 2015 21:45
portable realpath with gnu readlink / coreutils
type greadlink >/dev/null 2>&1 && CWD="$(dirname "$(greadlink -f "$0")")" || \
CWD="$(dirname "$(readlink -f "$0")")"
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 30s;
.first_byte_timeout = 30s;
}
sub vcl_recv {
@briceburg
briceburg / app.js
Created September 30, 2015 03:47
expressjs + passport + github oauth2 + github membership verification
// app
var passport = require('passport');
var GitHubStrategy = require('passport-github').Strategy;
var request = require('request');
// middleware
passport.use(new GitHubStrategy({
clientID: app.locals.GITHUB_CLIENT_ID,
clientSecret: app.locals.GITHUB_CLIENT_SECRET,
callbackURL: "http://localhost:8888/login/github/callback",
@briceburg
briceburg / default.conf
Created November 6, 2015 20:59
nginx | test configurations in docker
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;