Skip to content

Instantly share code, notes, and snippets.

Avatar
👶

taiyoh taiyoh

👶
View GitHub Profile
View url_show.rb
Earthquake.init do
command :url_show do |m|
url = case m[1]
when /^\d+$/
"https://twitter.com/#{twitter.status(m[1])['user']['screen_name']}/status/#{m[1]}"
else
"https://twitter.com/#{m[1][/[^'"]+/]}"
end
ap url
end
View imkayac.rb
# -*- coding: utf-8 -*-
# notification of im.kayac.com
# im.kayac.com経由で通知する
require 'im-kayac'
username = "foobar"
sig = "abababababa"
View amesh_check.pl
#!perl
use strict;
use warnings;
use utf8;
use FindBin;
use File::Temp 'tempfile';
use LWP::UserAgent;
use Digest::SHA1 'sha1_hex';
View anomaly_detect_example.pl
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Data::AnomalyDetect;
View myoutput.rb
# -*- coding: utf-8 -*-
# my output settings
# 出力方法をこちらで決定する
Earthquake.init do
output :tweet do |item|
next unless item["text"]
info = []
@taiyoh
taiyoh / client.js
Last active Dec 17, 2015
lirc_webにつなぎっぱにしてイベントを待つプロセス
View client.js
//
// lirc_web
// v0.0.4
// Alex Bain <alex@alexba.in>
//
// Requirements
//
var lirc_node = require('lirc_node'),
consolidate = require('consolidate'),
@taiyoh
taiyoh / app.js
Last active Dec 17, 2015
lirc_webのapp.jsの一部をこんな感じで書き換えた
View app.js
app.get('/api/stream', function(req, res) {
console.log('connection catched');
var sock = req.socket;
conns[sock.fd] = sock;
res.on('close', function() {
delete conns[sock.fd];
console.log('disconnected: ' + Object.keys(conns).join(", "));
});
sock.on('close', function() {
delete conns[sock.fd];
View unazu_kun.coffee
# Description:
# 話しかけたら反応します.
#
# Commands:
# hubot 〜〜〜 - ask him!
#
# Notes:
# DON'T DELETE THIS SCRIPT!
rules = [
View socketio_watch.js
#!/usr/bin/env node
var io = require('socket.io-client')
, argv = require('optimist').argv
, w, c, h, u;
w = argv.w, c = argv.c, h = argv.h, u = argv.u;
w = w || 500; // value for "WARNING" notification
c = c || 4000; // value for "CRITICAL" notification
View Controller.pm
package MyApp::Util::Controller;
use strict;
use warnings;
use Class::Method::Modifiers ();
use Module::Functions;
my %FUNCTIONS;