Skip to content

Instantly share code, notes, and snippets.

View ian-kent's full-sized avatar

Ian Kent ian-kent

View GitHub Profile
@ian-kent
ian-kent / rpmclean.sh
Created March 10, 2014 18:47
RPM removal script by Mike harris
#!/bin/sh
#
## this script originated from a one-liner posted to #centos-social
## by Mike Harris; mharris on irc.freenode.net. Script used with
## permission.
#
for each in $(rpm -qa |sort)
do
@ian-kent
ian-kent / function_obj.pl
Created April 7, 2014 22:33
Doing weird things with objects in Perl
#!/usr/bin/env perl
package Foo {
use Mojo::Base '-base';
sub new {
my $class = shift;
my $store = {};
bless sub {
my $opt = shift;
$store->{base} //= $class->SUPER::new;
@ian-kent
ian-kent / subargs.pl
Created June 30, 2014 16:51
Perl subroutine arguments test
#!/usr/bin/env perl
use strict;
use warnings;
use Time::HiRes qw/ gettimeofday tv_interval /;
my $iters = 50000000;
package panda {
use Mojo::Base -base;
@ian-kent
ian-kent / subargs2.pl
Created July 1, 2014 09:14
Perl subroutine arguments test
#!/usr/bin/env perl
use strict;
use warnings;
use Time::HiRes qw/ gettimeofday tv_interval /;
my $iters = 50000000;
package panda {
use Mojo::Base -base;
@ian-kent
ian-kent / index.html
Last active August 29, 2015 14:06
Composure demo
<!doctype html>
<html lang="en">
<head>
<title>Composure demo</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.js"></script>
@ian-kent
ian-kent / composure.html
Last active August 29, 2015 14:06
Composure demo content
<h1>Welcome to Composure</h1>
<img src="https://docs.google.com/drawings/d/1tppdtr7noODf_1qJYOORdFmnmSaRh4mwZZxMiTkDBqQ/pub?w=465&amp;h=341">
@ian-kent
ian-kent / navbar.html
Last active August 29, 2015 14:06
Composure demo navbar
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@ian-kent
ian-kent / spec.json
Created September 22, 2014 06:21
Composure demo spec
{
"/": {
"Methods": [ "GET" ],
"Template": {
"Type": "URL",
"Request": [ "https://gist.githubusercontent.com/ian-kent/ead9f381a2ff2463d9ef/raw/ce1a2e033ccf8e4804ba40fdd1412055ad0b95de/index.html" ]
},
"Postflight": {
"Type": "URL",
"Response": [{
@ian-kent
ian-kent / gist:93e7d33dd413d85876ae
Created November 13, 2014 17:57
crowdmob countscan
diff --git a/dynamodb/scan.go b/dynamodb/scan.go
index 8e08eb9..3c46933 100644
--- a/dynamodb/scan.go
+++ b/dynamodb/scan.go
@@ -109,6 +109,48 @@ func (t *Table) Scan(attributeComparisons []AttributeComparison) ([]map[string]*
return t.FetchResults(q)
}
+func (t *Table) CountScan() (int64, error) {
+ var lastEvaluatedKey *Key
@ian-kent
ian-kent / elasticache.go
Created December 9, 2014 15:28
elasticache.go
package main
import (
"fmt"
"log"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/elasticache"
)