Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
repo=$1
project=$2
curl -sL https://api.github.com/repos/$1/$2/issues | perl -e '$nc=0; while(<>) { if(/"comments": (\d+)/ && ($nc < ($c=int($1)))) { $nc=$c; } } print "$nc\n";'
javascript:(function(d){
var cls, ii, cl, ct = 0;
cls = d.getElementsByClassName('discussion-bubble');
for (ii = 0; ii < cls.length; ii++) {
cl = cls[ii];
if (/IETF/i.test(cl.innerHTML)) {
cl.style.display = 'none';
ct++;
}
}
@kiyoto
kiyoto / 140_bytes_not_chars
Created February 25, 2013 08:53
UTF-8 heavy languages like Japanese manage to pack in more meaning into 140 characters than English. Here is one farcical attempt to keep them honest: truncate the tweet after 140 bytes, not characters.
javascript:(function(d){
var tbox, text, len = 140, ii = 0;
tbox = d.getElementById('tweet-box-global');
if (!tbox) return;
if (!(tbox = tbox.firstChild)) return;
if (!(text = tbox.innerHTML)) return;
while (true) {
len -= encodeURI(text[ii]).replace(/%[A-F\d]{2}/g, 'U').length;
@kiyoto
kiyoto / fluentd-elasticsearch
Created August 2, 2013 21:06
fluentd configuration to gather data from Twitter and index them on Elastic Search
# Twitter input: See https://github.com/y-ken/fluent-plugin-twitter
<source>
type twitter
consumer_key YOU_CONSUTMER_KEY # Required
consumer_secret YOUR_CONSUMER_SECRET # Required
oauth_token YOUR_OAUTH_TOKEN # Required
oauth_token_secret YOUR_TOKEN_SECRET # Required
tag twitter.timeline # Required
timeline userstream # Required s(sampling or userstream)
#keyword SFGiants
C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_thread_alone()... yes
checking for rb_str_set_len()... yes
checking for clock_gettime() in -lrt... no
checking for sys/select.h... no
checking for poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... no
checking for port.h... no
@kiyoto
kiyoto / fluentd-kibana-elasticsearch.conf
Last active December 29, 2015 09:59
An example config for Fluentd + Kibana 3 + ElasticSearch
<source>
type embedded_elasticsearch
</source>
<source>
type kibana_server
bind 0.0.0.0
port 24300
mount /kibana/
access_log_path var/log/kibana/access.log
@kiyoto
kiyoto / gist:8131010
Created December 26, 2013 07:56
jls-grok error
2.0.0-p0 :006 > g = Grok.new
=> #<Grok:0x007f9b5aa85988>
2.0.0-p0 :007 > g.discover("hello")
NameError: uninitialized constant Grok::GrokDiscover
from /Users/owenestea/.rvm/gems/ruby-2.0.0-p0/gems/jls-grok-0.10.12/lib/grok.rb:127:in `init_discover'
from /Users/owenestea/.rvm/gems/ruby-2.0.0-p0/gems/jls-grok-0.10.12/lib/grok.rb:120:in `discover'
from (irb):7
from /Users/owenestea/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `<main>'
@kiyoto
kiyoto / sample.log
Created February 5, 2014 07:03
Testing multiline for Windows
2013-3-03 14:27:33 [main] INFO Main - Start
2013-3-03 14:27:33 [main] ERROR Main - Exception
javax.management.RuntimeErrorException: null
at Main.main(Main.java:16) ~[bin/:na]
2013-3-03 14:27:33 [main] INFO Main - End
@kiyoto
kiyoto / Fluentd1.sh
Last active August 29, 2015 13:56 — forked from agutow/Fluentd1.sh
<source>
type tail
format apache2
path /var/log/apache2/access_log
pos_file /var/log/fluentd/apache2.access_log.pos
tag riak.apache
</source>
<match riak.**>
type riak
@kiyoto
kiyoto / Dockerfile
Created February 19, 2014 15:51 — forked from repeatedly/Dockerfile
FROM base
MAINTAINER repeatedly "https://github.com/repeatedly"
RUN apt-get install -y --force-yes curl
RUN curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-precise.sh | sh
RUN sed -i 's/ulimit/# ulimit/g' /etc/init.d/td-agent
RUN echo "ulimit -n 8192" >> /etc/default/td-agent