Skip to content

Instantly share code, notes, and snippets.

Avatar
🙈
Taking care of my kid

Matt Wright mattupstate

🙈
Taking care of my kid
View GitHub Profile
@mattupstate
mattupstate / oat.py
Last active Aug 29, 2015
Naive attempt at porting Oat (https://github.com/ismasan/oat) to Python
View oat.py
import warnings
from collections import OrderedDict
from itertools import chain
from inflection import pluralize
class Adapter(object):
View logstash.conf
input {
file {
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
start_position => "beginning"
}
}
output {
elasticsearch_http {
host => "elasticsearch.company.internal"
@mattupstate
mattupstate / docker-regsitry.conf
Created Nov 6, 2014
An example Nginx config for a private Docker registry to enable unauthenticated, read-only access on non-volatile HTTP methods
View docker-regsitry.conf
upstream docker-registry {
leastconn;
server hostname1:port;
server hostname2:port;
}
server {
listen 80;
server_name docker.your.domain;
rewrite ^ https://$server_name$request_uri? permanent;
@mattupstate
mattupstate / nginx_status_decoder.lua
Last active Aug 29, 2015
heka Nginx status decoder and filter
View nginx_status_decoder.lua
--[[
Parses a payload containing the contents of the output from the Nginx `stub_status`
module. See: http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
Config:
- payload_keep (bool, optional, default false)
Always preserve the original log line in the message payload.
@mattupstate
mattupstate / linux_netstats.lua
Created Nov 13, 2014
A heka decoder for data available in /proc/net/dev
View linux_netstats.lua
--[[
Parses a payload containing the contents of a `cat /proc/net/dev | tail -n +3` call into a Heka
message.
Config:
- payload_keep (bool, optional, default false)
Always preserve the original log line in the message payload.
@mattupstate
mattupstate / output.rst
Created May 19, 2015
uWSGI heka.statmetric message
View output.rst
Timestamp:2015-05-19 23:11:38.372266224 +0000 UTC
Type:heka.statmetric
Hostname:machine1
Pid:18895
Uuid:f58719a6-999f-465b-8790-13fae230c0ca
Logger:users-frontend-stat-accum
Payload:users-frontend-machine1.counters.uwsgi.worker.1.delta_requests.rate 0.000000 1432077098

users-frontend-machine1.counters.uwsgi.worker.1.delta_requests.count 0 1432077098 users-frontend-machine1.counters.uwsgi.worker.2.delta_requests.rate 0.000000 1432077098 users-frontend-machine1.counters.uwsgi.worker.2.delta_requests.count 0 1432077098

View getTimeCode.as
/**
* Converts the amount of milliseconds into a string based time code.
* @param milliseconds
* @param delimiter
* @param withHours
* @return The time code as a string.
*/
function getTimeCode( milliseconds:Number, delimeter:String = ":", withHours:Boolean = false ):String
{
var posHours:Number = Math.floor( milliseconds / 1000 / 60 / 60 );
View PseudoAntProcess.as
function run( buildFile:File, targetName:String, parameters:Array = null ):void
{
var file:File = new File( "C:/windows/system32/cmd.exe" );
var args:Vector.<String> = new Vector.<String>();
args.push( "/c" );
args.push( "ant" );
if( parameters )
{
View gist:458254
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
public class CenteredImage extends Sprite
{
private var _image:Bitmap;
public function CenteredImage( image:Bitmap )
View gist:464799
<target name="compile">
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${basedir}/src/Project.swf" />
<arg value="-output=${basedir}/bin/Project.swf" />
<arg value="-source-path=${basedir}/src" />
<arg value="-library-path+=${basedir}/lib" />
</java>
</target>
You can’t perform that action at this time.