Skip to content

Instantly share code, notes, and snippets.

View jasonhancock's full-sized avatar
meh

Jason Hancock jasonhancock

meh
View GitHub Profile
@jasonhancock
jasonhancock / main.go
Created October 20, 2022 16:27
Go YAML Unmarshal list of interfaces
package main
import (
"errors"
"fmt"
"log"
"math"
"gopkg.in/yaml.v3"
)
@jasonhancock
jasonhancock / tasseo.spec
Created August 2, 2012 22:40
.spec file for building Tasseo into an RPM
%define githash 46d8a8f
Name: tasseo
Summary: A lightweight, easily configurable, real-time dashboard for Graphite events.
Version: 0.0.1
Release: 1%{?dist}
License: 3-clause BSD
Group: Applications/System
URL: https://github.com/obfuscurity/tasseo
Source0: obfuscurity-tasseo-%{githash}.tar.gz
@jasonhancock
jasonhancock / VersionAssetManager.php
Created March 3, 2013 00:42
An asset manager for the Yii PHP framework to publish static assets with a hash that's load-balancer and development environment friendly.
<?php
/**
* CAssetManager class file.
*
* @author Jason Hancock <jsnbyh@gmail.com>
* @copyright Copyright &copy; 2013 Jason Hancock
* @license http://www.yiiframework.com/license/
*/
@jasonhancock
jasonhancock / main.go
Created November 29, 2018 19:28
bcrypt time cost at various difficulty factors
package main
import (
"fmt"
"log"
"time"
"golang.org/x/crypto/bcrypt"
)
@jasonhancock
jasonhancock / harvest_one_item.md
Created April 30, 2018 23:12
Harvesting a single item from s3 via the GrayMeta Platform API

How to initiate a harvest of a single asset in s3 that has not been previously indexed into the GrayMeta Platform

NOTE: my endpoint is http://localhost:7000. Your endpoint will be different.

Step 1:

You must know the name of the s3 bucket and the s3 key (the path within the bucket) to the asset.

For our example today, I want to harvest the key 5aba86635fc9cbec3a81839abc0fc2a9.jpg inside the hancocktest bucket in s3.

@jasonhancock
jasonhancock / README.md
Last active December 14, 2017 14:45
jenkins to statsd

A cheap way to get build events from jenkins into graphite via statsd:

/usr/local/bin/buildstats

#!/bin/bash
. /etc/default/buildstats
echo "$BUILD_PREFIX.$JOB_NAME:1|c" | nc -w 1 -u $STATSD_SERVER $STATSD_PORT

/etc/default/buildstats:

@jasonhancock
jasonhancock / redis_loading
Last active October 5, 2017 23:38
A script to generate a progress bar tracking Redis' progress loading the data files on startup
#!/usr/bin/perl
# Copyright (c) 2012 Jason Hancock <jsnbyh@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
@jasonhancock
jasonhancock / main.go
Created August 30, 2017 20:44
simple udp server to debug statsd stuff
package main
import (
"fmt"
"log"
"net"
)
func handleUDPConnection(conn *net.UDPConn) {
@jasonhancock
jasonhancock / puppet apache log analyzer
Created August 23, 2012 18:09
Analyze puppet's apache logs.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $file = $ARGV[0] or die('Must pass an apache access logfile');
open IN, "<$file" or die("Can't open $file");
package main
import (
"bufio"
"fmt"
"github.com/Azure/azure-sdk-for-go/storage"
"io"
"log"
"os"
)