Skip to content

Instantly share code, notes, and snippets.

@dexterbt1
dexterbt1 / coop-push-status.sql
Last active December 11, 2015 03:29
quick overview of the coop push status
select
pcd.push_date, pci.priority, pci.content_automediaid, sum(pcir.started) run_started, sum(pcir.completed) run_completed,
pci.max_runs, stats_base, sum(pcir.stats_billed) stats_billed
from
push_cycle_day pcd inner
join push_cycle_item pci on (pcd.id=pci.push_cycle_day_id)
left outer join push_cycle_item_run pcir on (pci.id=pcir.push_cycle_item_id)
where
pcd.push_date=date(now())
group by pci.id
@dexterbt1
dexterbt1 / create_libvirt_lxc_guest.sh
Last active December 11, 2015 09:49
Centos 6.3 script to automate creation of the LXC rootfs and libvirt definition
#!/bin/bash
# vim: set ts=4 sw=4 et nu
set -e
usage="Usage: $0 <name>"
name=$1
if [ -z "$name" ]; then
echo $usage
exit 1;
fi
@dexterbt1
dexterbt1 / .vimrc
Last active December 11, 2015 11:38
vim Config
" ==============================================
" Basics
set nocompatible " vi compatibility not a priority
set encoding=utf8
set fileencoding=utf8
set expandtab " foce convert tabs to spaces
set ts=4 " tabs are 4-space aparts
@dexterbt1
dexterbt1 / signed_client_cli.php
Created April 11, 2013 10:01
Basic CLI wyrls REST API client implemented in PHP.
#!/usr/bin/env php
<?php
# dependencies:
# php curl extension
$usage = "USAGE: {$argv[0]} --client_id=... --privkey=... --url=... --method=... --ctype=... --body=...\n";
$options = getopt('', array('client_id:', 'privkey:', 'url:', 'method:', 'ctype:', 'body:'));
$timeout = 60;
@dexterbt1
dexterbt1 / gibson
Created May 19, 2013 13:25
gibson font css
@font-face {
font-family: 'gibsonregular';
src: url('font/gibson-webfont.eot');
src: url('font/gibson-webfont.eot?#iefix') format('embedded-opentype'),
url('font/gibson-webfont.woff') format('woff'),
url('font/gibson-webfont.ttf') format('truetype'),
url('font/gibson-webfont.svg#gibsonregular') format('svg');
font-weight: normal;
font-style: normal;
@dexterbt1
dexterbt1 / homebrew.mxcl.lighttpd.plist
Created May 23, 2013 17:22
homebrew lighttpd plist - works in Mountain Lion - place this in /Library/LaunchDaemons/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.lighttpd</string>
<key>ProgramArguments</key>
<array>
@dexterbt1
dexterbt1 / generate_unique_sequence_chars.pl
Created June 4, 2013 04:28
Generate a sequence of unique characters e.g. 3333, 3334 ... YYYX, YYYY
#!/usr/bin/env perl
use strict;
my $chars_str = '3456789ABCDEFGHJKMNPRSTUVWXY';
my @chars = split //, $chars_str;
# a b c d
my $template = [ 0, 0, 0, 0, 0 ];
my $dead_end = 0;
@dexterbt1
dexterbt1 / rest-api-design.md
Created August 1, 2013 07:26
REST API Design Checklist

Inputs:

  • State requirements
  • Number of clients
  • Security classification of data in the API request or response
  • Peak volumes
  • Service level distinctions for clients
  • Availability requirements
  • Latency expectations
  • Business metrics
  • Transactionality
@dexterbt1
dexterbt1 / mobile-dev-web-resources.md
Last active December 20, 2015 17:59
Mobile Development Web Resources - links to tools, frameworks, tutorials
@dexterbt1
dexterbt1 / bench.dict.insert.py
Last active May 7, 2021 06:23
Perl Hash vs Python Dictionary - a micro benchmark we want to benchmark the performance of populating a hash, mapping a fixed-length 10-byte key to the same value
#!/usr/bin/env python
import timeit
REPEATS= 10
using_forloop_total = timeit.timeit(
"""
d={}
for n in range(1000000):
d["%10d" % n] = "%10d" % n
""", number=REPEATS)