Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
josegonzalez / app_controller.php
Created February 27, 2012 05:25
Custom response types in CakePHP. Must have debug mode to less than 2 in order for it to work properly
<?php
class AppController extends Controller {
/**
* Setup the RequestHandler component
*
* @var array
*/
var $components = array('RequestHandler');
@josegonzalez
josegonzalez / .bashrc
Created March 28, 2012 03:23
My ~/.bashrc
export PATH="$(brew --prefix)/bin:$(brew --prefix php)/bin:$(brew --prefix python)/bin:/usr/local/share/python:/usr/local/lib/node_modules:/usr/local/PEAR:$PATH"
export NODE_PATH=/usr/local/lib/node_modules
export GIT_EDITOR="subl -w" # Change to whatever you want your default git editor to be
export RUBYOPT=rubygems
# a crap-ton of ssh aliases
alias update='brew update && brew outdated | xargs brew upgrade'
alias ls='ls -alh'
alias ll='ls -alh'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{Title}</title>
<link rel="shortcut icon" href="{Favicon}">
<link rel="alternate" type="application/rss+xml" href="/rss">
<style type="text/css">
body {
@josegonzalez
josegonzalez / gist:2855592
Created June 1, 2012 22:50
Server monitoring

Now that SeatGeek is crushin it, it has become apparent that we need some sort of server/service monitoring beyond simple healthchecks with pingdom.

This should be split up into multiple parts, but the idea is thus:

Metric Collection

Collect metrics from various servers, including, but not limited to:

  • disk space
  • load average
@josegonzalez
josegonzalez / nginx-custom.rb
Created November 21, 2012 17:53
Customize your Nginx Installation via Homebrew
require 'formula'
class NginxCustom < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.4.tar.gz'
sha1 'e3de0b2b82095f26e96bdb461ba36472d3e7cdda'
devel do
url 'http://nginx.org/download/nginx-1.3.8.tar.gz'
sha1 '84ff39e3f76e9f496f4e05080885e04caf472bb9'
@josegonzalez
josegonzalez / nginx_release.sh
Created November 21, 2012 18:55
Make an nginx release for ubuntu
#!/bin/bash
#####
# Builds a custom nginx
#
# RELEASE_TAGS="+your+tags+here"
# RELEASE_MAINTAINER="Your Name Here"
# RELEASE_MAINTAINER_EMAIL="hi@example.com"
# RELEASE_MESSAGE="Some message"
#
@josegonzalez
josegonzalez / nginx_release.sh
Last active October 11, 2019 15:46
Make an nginx release for ubuntu
#!/bin/bash
#####
# Builds a custom nginx
#
# RELEASE_TAGS="+your+tags+here"
# RELEASE_MAINTAINER="Your Name Here"
# RELEASE_MAINTAINER_EMAIL="hi@example.com"
# RELEASE_MESSAGE="Some message"
#
@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@josegonzalez
josegonzalez / README.md
Last active December 16, 2015 11:39 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

<?php
class StatsD {
// StastD::timing("www.php.sql_query", 645);
public static function __callStatic($name, $arguments) {
if (!in_array($name, array('counter', 'gauge', 'timing'))) {
throw new Exception("Invalid function");
}
if (empty($arguments[0])) return false;