Skip to content

Instantly share code, notes, and snippets.

@dhoss
dhoss / gist:298877
Created February 9, 2010 03:03 — forked from semifor/gist:297169
### The model ####
package MyApp::Model::Twitter;
use Moose;
use Carp;
use Net::Twitter;
use namespace::autoclean;
extends 'Catalyst::Component';
__PACKAGE__->config(
package TestApp::Controller::Namespace;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' }
sub main :Local {
my ($self, $c) = @_;
$c->stash( name => 'Bob' );
}
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@dhoss
dhoss / puppet NFS
Created December 24, 2010 04:56 — forked from eqhmcow/puppet NFS
# modules/nfs/manifests/init.pp
class nfs_server {
file { "destroy_exports":
path => "/etc/exports.puppet",
ensure => present,
source => "puppet://$servername/modules/nfs/empty",
}
package { "portmap":
@dhoss
dhoss / check_postgres_replication.py
Created September 6, 2011 17:57 — forked from jacobian/check_postgres_replication.py
Nagios plugin to check PostgreSQL 9 streaming replication lag.
#!/usr/bin/env python
"""
Nagios plugin to check PostgreSQL 9 streaming replication lag.
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install).
MIT licensed:
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved.
@dhoss
dhoss / gist:1223383
Created September 16, 2011 23:12 — forked from jshirley/gist:1223273
package MyApp::Web::Model::DataManager;
use Moose;
use Email::Valid;
extends 'Catalyst::Model';
with 'Catalyst::Component::InstancePerContext';
my $email_filter = sub {
@dhoss
dhoss / Model
Created September 19, 2011 18:36 — forked from anonymous/gist:1227212
package PerlFu::Web::Model::Validator;
use Moose;
use namespace::autoclean;
use Data::Manager;
use Data::Verifier;
use Data::Dumper;
use Carp qw( croak );
extends 'Catalyst::Model';
with 'Catalyst::Component::InstancePerContext';
package PerlFu::Web::Model::Validator::Post;
use Moose;
use namespace::autoclean;
extends 'PerlFu::Web::Model::Validator';
sub _build_profiles {
my $self = shift;
return {
title => {
Resume/CV
Devin Austin
devin.austin@gmail.com
970-290-6669
Summary: I am a web software developer.