Skip to content

Instantly share code, notes, and snippets.

View eggplants's full-sized avatar
🏠
Working from home

eggplants

🏠
Working from home
View GitHub Profile
a.zip(b).map{|n,p| n*p}
#or
a.sort_by{ |b0, b1|b0}
Package Version
---------------------------------- ---------
alabaster 0.7.10
anaconda-client 1.6.14
anaconda-navigator 1.8.7
anaconda-project 0.8.2
asn1crypto 0.24.0
astroid 1.6.3
astropy 3.0.2
attrs 18.1.0
*** LOCAL GEMS ***
actioncable (5.2.1)
actionmailer (5.2.1)
actionpack (5.2.1, 4.2.6)
actionview (5.2.1, 4.2.6)
activejob (5.2.1)
activemodel (5.2.1)
activerecord (5.2.1)
alabaster==0.7.10
anaconda-client==1.6.14
anaconda-navigator==1.8.7
anaconda-project==0.8.2
asn1crypto==0.24.0
astroid==1.6.3
astropy==3.0.2
attrs==18.1.0
Babel==2.5.3
backcall==0.1.0
require 'open-uri'
open("https://futaba-only.net/list01.html"){|l|
$data=l.read.force_encoding("UTF-8")
}
c=Array.new(7).map{Array.new}
7.times{|i|
re=Regexp.compile(%Q(<td class="clist2-#{i+1}">(.*?)<\/td>))
c[i]<< $data.scan(re)
}
#c={:0->企画名orサークル名,:1->ハンドル,:2->板,:3->URL_1,:4->URL_2,:5->区分,:6->配置(サークル番号)}
#list(n-D) "data".flatten
sum(data,[])
#uniq
import numpy as np
np.unique(ans, axis=0)
#<<
data.append(line.split())
#chomp
str.strip()
#scan->list
#00
import numpy as np
data,ans=[],[]
with open("00-test-input.txt","r") as inp:
for line in [s.strip() for s in inp.readlines()]:
data.append(line.split())
data=sum(data,[])
for word in data:
ans.append([word,data.count(word)])
for a in np.unique(ans, axis=0):
id title episode
10001 とある魔術の禁書目録 24
10002 キノの旅-the Beautiful World- 13
10003 狼と香辛料 13
10004 乃木坂春香の秘密 12
10005 とらドラ! 25
10006 ケメコデラックス! 12
10007 狼と香辛料Ⅱ 12
10008 乃木坂春香の秘密 ぴゅあれっつぁ♪ 12
10009 デュラララ!! 24
@eggplants
eggplants / d_anime.rb
Last active April 28, 2019 17:43
retrieve list(work_id,title,num of episode) from d-anime store(https://anime.dmkt-sp.jp/animestore/)
require "open-uri"
require 'htmlentities'
require 'benchmark'
result = Benchmark.realtime do
data=[]
for i in 10000..25000
puts "now:#{i}"
printf "\e[1A"
STDOUT.flush
begin