Skip to content

Instantly share code, notes, and snippets.

View 1syo's full-sized avatar

Kazunari Takahashi 1syo

View GitHub Profile
def data
[
{x: :list, y:2, z: []},
{x: :item, y:3},
{x: :item, y:4},
{x: :list, y:5, z:[]},
{x: :item, y: 6},
{x: :item, y: 7},
{x: :banner, y: 8},
{x: :banner, y: 9}
require 'active_support/all'
data = [
{x: :list, y:2, z: []},
{x: :item, y:3},
{x: :item, y:4},
{x: :list, y:5, z:[]},
{x: :item, y: 6},
{x: :item, y: 7},
{x: :banner, y: 8},
id=12345678900987654321
zcat action.log.gz | awk -v uid="$id" 'BEGIN{count=0;} {if($7 == "Kind:Mission" && $8 == "Action:Start" && $12 == "AccountID:uid") {count++;;}} END{print count}'
#!/bin/bash
version=`bundle --version | awk '{print $3}'`
result=`echo "$version" |env ruby -n -e'puts Gem::Version.create("#{$_}") <=> Gem::Version.create("1.5.2")'`
if [ $result -ge 0 ]; then
echo true
else
echo false
fi
require 'bundler/setup'
Bundler.require
now = Time.parse('2014-02-04')
file="action.#{now.strftime("%Y-%m-%d")}.log.gz"
r = {}
Zlib::GzipReader.open(file) do |gz|
gz.each do|line|
h = LTSV.parse(line.gsub(/\t\t/, "\t")).first
Net::HTTP.post_form(URI.parse('http://127.0.0.1:8888/td.debug.account'), {'json'=> h.to_json})
CSV.foreach(file, "CP932:UTF-8")
CSV.open(file, "r", "CP932:UTF-8") #=> TypeError: no implicit conversion of String into Integer
CSV.open(file, "r", encoding: "CP932:UTF-8") #=> OK
@1syo
1syo / Gemfile
Last active February 25, 2019 08:17
druby + jruby-poi を利用してパスワードエクセルを突破する
source "https://rubygems.org"
gem "jruby-poi", github: "kameeoze/jruby-poi", require: "poi"
gem "pry"
gem "bundler", require: ['drb/drb', 'stringio']
cronJob = require('cron').CronJob
module.exports = (robot) ->
# *(sec) *(min) *(hour) *(day) *(month) *(day of the week)
new cronJob('0 */10 * * * *', () ->
robot.send {room: process.env.HUBOT_CAMPFIRE_ROOMS}, "current time is #{new Date()}."
).start()
module.exports = (robot) ->
robot.hear /デプロイします/, (msg) ->
msg.send "OKです"
@1syo
1syo / Gemfile
Last active August 29, 2015 14:00
clockworkを利用してhipchatに定期的に発言する
# A sample Gemfile
source "https://rubygems.org"
gem "clockwork"
gem "hipchat"