Skip to content

Instantly share code, notes, and snippets.

View siroken3's full-sized avatar

Kenichi Sasaki siroken3

View GitHub Profile
https://riak.com/products/riak-kv/index.html
import collections
a = [1,1,2,3,3,3,5,5,5]
counter = collections.Counter(a)
[value for (value, count) in counter.items() if count > 1]
# [1, 3, 5]
@siroken3
siroken3 / sample.py
Created May 5, 2019 13:37
immutable_class.py
import collections
class Immutable (
collections.namedtuple('Immutable', [
'var1',
'var2',
'var3',
])
):
# Avoid using dict to store fields as namedtuple docs
@siroken3
siroken3 / gist:b750be8d079c8f7e48f7
Created February 16, 2016 06:49
How to get PullRequest object
'use strict';
var GitHubApi = require('github'),
Promise = require('bluebird'),
sprintf = require('sprintf');
var github = new GitHubApi({
version: '3.0.0',
protocol: 'https',
});
@siroken3
siroken3 / gist:4f3b381970052b563584
Last active January 4, 2016 14:59
RDS cloudwatch aws cli
aws cloudwatch get-metric-statistics --namespace AWS/RDS --metric-name FreeStorageSpace --start-time 2016-01-04T14:00:00 --end-time 2016-01-04T14:01:00 --period 60 --statistics Minimum --dimensions Name=DBInstanceIdentifier,Value=development
@siroken3
siroken3 / gist:86f94394ab2b72669ac4
Created June 25, 2015 02:46
tsvにschemaを付与するテスト
>>> org = '11:00:00 512 256'
>>> dict(zip([sce["name"] for sce in sc], org.split()))
{'time': '11:00:00', 'hoge': '512'}
>>> sc = [{"name":"time", "type":"INTEGER"},{"name":"hoge", "type":"INTEGER"},{"name":"fuga", "type":"STRING"}]
>>> dict(zip([sce["name"] for sce in sc], org.split()))
{'time': '11:00:00', 'fuga': '256', 'hoge': '512'}
@siroken3
siroken3 / client.js
Last active August 29, 2015 14:14 — forked from bcg/client.js
var zmq = require('zeromq');
s = zmq.createSocket('push');
s.connect('tcp://127.0.0.1:15000');
while (true) { // ZOMG he did it again!
s.send(new Buffer("test"));
}
@siroken3
siroken3 / gist:d7beb597b4f169a02bbe
Created January 18, 2015 15:21
asyncによる配列データからのシーケンシャル実行
var async = require('async');
var exec =require('child_process').exec
var plays = []
var datum = ["hello", "world"]
var cmd = function (msg, logger) {
var command = "echo " + msg + "; sleep 10"
var proc = exec(command,
{
@siroken3
siroken3 / gist:daa3723d867737358162
Created December 10, 2014 11:23
opensslによる証明書の有効期限確認方法
openssl x509 -noout -text -in (crtファイル)
@siroken3
siroken3 / gist:6d301a590290d484bb2b
Created November 9, 2014 13:40
How to install python 3.3.6 on Original CentOS6.5 (using pyenv)
# install pyenv using pyenv-installer
$ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
(vi ~/.bash_profile)
$ sudo yum install @Development
$ sudo yum install bzip2-devel openssl-devel readline-devel sqlite-devel