Skip to content

Instantly share code, notes, and snippets.

import com.lmax.disruptor.dsl.Disruptor
import java.util.concurrent.Executors
import com.lmax.disruptor._
case class ValueEvent(var value: Long)
case class ValueEventTranslator(value: Long) extends EventTranslator[ValueEvent] {
def translateTo(event: ValueEvent, sequence: Long) = {
event.value = value
event
@timoyuen
timoyuen / jsonval.sh
Created February 19, 2014 09:04 — forked from cjus/jsonval.sh
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
function OHLC(params) {
OHLC.prototype._init = function (params) {
this.height = params.height || 650;
this.width = params.width || 1300;
this.margin = params.margin || 50;
this.data = params.data;
this.movingAverageTypes = ['mov_avg_10d', 'mov_avg_50d', 'mov_avg_200d'];
this.dateFormat = d3.time.format("%Y-%m-%d");
#!/usr/bin/ruby
require 'rubygems'
require 'hipchat-api'
require 'getopt/long'
require 'socket'
require 'erb'
#Do not modify these constants! (after you set these up, of course)
HipApiKey='ABCDEFGHKJHKJHKJHKJH'
Room='Nagios'
public class ExodusWriter {
private JdbcTemplate jdbcTemplate;
private TransactionTemplate transactionTemplate;
public ExodusWriter(DataSource dataSource) {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);
jdbcTemplate = new JdbcTemplate(transactionManager.getDataSource());
transactionTemplate = new TransactionTemplate(transactionManager);
}
output {
# <SNIP> other outputs <SNIP>
#
# Ping me if anything is about to explode, or if any important massage pass by
#
xmpp {
tags => 'warn_me'
host => "ejabberd.example.io"
message => "time='%{@timestamp}', host='%{@source_host}', tags='%{@tags}',path='%{@source_path}', type='%{@type}', field='%{@fields}' message='%{@message}',"
@timoyuen
timoyuen / git1.php
Created April 24, 2014 04:55 — forked from urielm/git1.php
git pull
git push
git branch
git commit
git checkout
git status
git log
{
"checks": {
"mycheck": {
"pagerduty": {
"service": "oncall"
},
"sendgrid": {
"mail_to": "ops@myemail.com"
},
"runbook": "https://wiki.url.to.runbook",
#!/bin/bash
# Creates a bootable ISO from CoreOS' PXE images.
# Also adds a run script to the OEM partition and converts the ISO so it can boot from USB media.
# Based heavily off https://github.com/nyarla/coreos-live-iso - Thanks Naoki!
set -e
# Default configurations
SYSLINUX_VERSION="6.02"
#!/usr/bin/env node
// ./generatelookup -l lookupkey -p somekey* -a attribute
var redis = require('redis').createClient();
var async = require('async');
var opt = require('optimist');
opt.usage('$0 -l lookup -p pattern -a attribute');
opt.demand(['l', 'p', 'a']);
var argv = opt.argv;
var iter = '0';