Skip to content

Instantly share code, notes, and snippets.

rubocop |& grep ' has the wrong namespace - should be ' | \
sed 's/\(.*\)\: \(.*\)\/\(.*\) has the wrong namespace - should be \(.*\)/s#\2\/\3#\4\/\3# \1/' | \
xargs -L1 sed -i '' -e
rubocop |& grep ' cop has been \(renamed \(and moved \)\?to \|removed. Please use \)' | \
sed 's/The `\(.*\)\` .* `\(.*\)`\( instead\)\{0,1\}\./s#\1#\2#/' | \
xargs -I {} -L1 sed -i '' -e {} .rubocop.yml
@itochan
itochan / portal_attendance_count.rb
Last active January 21, 2018 10:39
出席集計くん
require 'csv'
meetings = %w[82 85 86 91 92 93 94 87 95 96 88 97 111 98]
attendances = {}
MeetingAttendance.where(meeting_id: meetings).map do |attend|
if attendances[attend.user.nickname]
attendances[attend.user.nickname][:count] += 1
else
attendances[attend.user.nickname] = {
diff --git a/externals/stratum b/externals/stratum
--- a/externals/stratum
+++ b/externals/stratum
@@ -1 +1 @@
-Subproject commit 8ba1b5fd8a802b981f31dace4cf920cfb4a3907c
+Subproject commit 8ba1b5fd8a802b981f31dace4cf920cfb4a3907c-dirty
diff --git a/lib/halfnode.py b/lib/halfnode.py
index 4ffc017..aca8cc8 100644
--- a/lib/halfnode.py
+++ b/lib/halfnode.py
require 'rexml/document'
require 'rexml/formatters/pretty'
# xspfjoiner.rb
# (C) itochan 2017
# License: MIT
# Usage: ruby xspfjoiner.rb [xspf_file ...]
# Output: Merged xspf file
URL_LENGTH = 2048
@itochan
itochan / README.md
Last active July 17, 2017 05:58
syspro17 final

ptrhost

DNSの正引きをして逆引きをするプログラムを書きました。 正引き→逆引きをすることで、逆引きホスト名から得られる情報によってどこでホスティングさ れているかといった情報を見ることができます。 (例: Amazon EC2のようなIaaSでは逆引きホストを設定している例は少なく、EC2でホストさ れていることがわかる) getaddrinfo(), getnameinfo() を使っているのでIPv4/v6両方に対応しています。

動作例

% ./ptrhost www.google.com
[v6] ::2404:6800:4004:807:0:0 -> not resolved
@itochan
itochan / ptrhost.zsh
Created May 4, 2017 13:43
ホスト名を正引きして逆引きする関数
ptrhost () {
host $1 | grep -v mail >&2 | rev | cut -d' ' -f1 | rev | xargs -I{} host {}
}
require 'date'
require 'mechanize'
require 'nokogiri'
require 'csv'
agent = Mechanize.new
start_date = DateTime.new(2010, 2, 1)
end_date = DateTime.new(2010, 2, -1)

Keybase proof

I hereby claim:

  • I am itochan on github.
  • I am itochan (https://keybase.io/itochan) on keybase.
  • I have a public key whose fingerprint is E38C 719B 6784 50D6 0CF7 CA71 2E38 9FCD 49D9 46F3

To claim this, I am signing this object:

@itochan
itochan / gist:752678
Created December 23, 2010 07:03
今入れてるFirefoxアドオンです。
作成日: Thu Dec 23 2010 16:03:35 GMT+0900
ユーザーエージェント: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E)
ビルドID: 20101203075014
拡張機能(有効): [49]
- Add-on Compatibility Reporter 0.7: http://www.google.com/search?q=Firefox%20Add-on%20Compatibility%20Reporter - Allows add-on compatibility issues to be reported to Mozilla
- AutoPagerize 0.6.6: http://www.google.com/search?q=Firefox%20AutoPagerize - A browser Extension for auto loading paginated web pages
- BarTab 2.0: https://addons.mozilla.org/firefox/addon/67651 - つけで飲む: タブを待機させとこう!
- CacheViewer 0.6.3: http://www.google.com/search?q=Firefox%20CacheViewer - キャッシュを一覧表示して、検索やソートができます。
- CloudMagic 1.22: http://www.cloudmagic.com/ - Super fast search for your online data
@itochan
itochan / LICENSE
Last active January 16, 2016 07:40
syspro_final
The MIT License (MIT)
Copyright (c) 2016 Kazunori Jo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: