Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am josegonzalez on github.
  • I am savant (https://keybase.io/savant) on keybase.
  • I have a public key ASBouJt4s02dheQkrfrsCQNKqsaHzxuhBpjL1RxtoMoEjQo

To claim this, I am signing this object:

<?php
/**
* APC-based WordPress Database Access Abstraction Object
*
* Extends the wpdb class in order to cache queries in APC
*
* Falls back to non-APC database when requesting an admin resource or
* the query modifies the database.
*
* Using something like Memcached might be better as we can namespace
<?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;
@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.

@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 / 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
<!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 / .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'
@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 / control
Created April 10, 2011 22:53
cakepackages control file
Package: cakepackages
Source: git://github.com/josegonzalez/cakepackages.git
Type: application
Section: application
Description: An application that can be used
to index other cakephp applications and plugins
Pre-depends: CakePHP==1.3
Recommends:
Suggests:
Bugs: http://github.com/josegonzalez/cakepackages/issues