Skip to content

Instantly share code, notes, and snippets.

@esehara
esehara / gist:925422
Created April 18, 2011 14:09
Test pdf => text
#-*- coding:utf-8 -*-
import re
class textshredder:
def fileopen(self,fileopen):
self.textdata = open(fileopen,"r").read()
self.textsplit("hoge@gmail.com")
def textsplit(self,email):
self.textpage = []
self.textpage = re.split("This PDF is prepared for hoge@gmail.com, personal use only.\n",self.textdata)
@esehara
esehara / gist:1088146
Created July 17, 2011 22:12
社会学評論の過去掲載分を一気にダウンロードするスクリプト
# -*- coding:utf-8 -*-
# 社会学評論・過去アーカイヴ Downloader
# http://www.journalarchive.jst.go.jp/japanese/jnltop_ja.php?cdjournal=jsr1950
import urllib
import urllib2
from BeautifulSoup import BeautifulSoup
import re
class System_html(object):
@esehara
esehara / aozora_to_epub.py
Created July 23, 2011 05:29
Aozora Author to Epub
# -*- coding:utf-8 -*-
import urllib
import urllib2
from BeautifulSoup import BeautifulSoup
import re
import os
import zipfile
"""
@esehara
esehara / denki_video.py
Created July 25, 2011 09:57
VJ ROBOT KUN
# -*- coding:utf-8 -*-
import pygame
from pygame.locals import *
import random
import time
def main():
pygame.init()
screen = pygame.display.set_mode((640,480),pygame.FULLSCREEN)
pygame.display.set_caption("Denki")
@esehara
esehara / gist:1195356
Created September 5, 2011 16:09
ザ・インタビューズの未読1バグを引き起こした原因のソース
require "rubygems"
require "mechanize"
max_id = 50000
min_id = 1
account = "robot666"
password = "xxxx"
user_id = 1909
browser = Mechanize.new
print "Login... \n"
@esehara
esehara / gist:1225869
Created September 19, 2011 02:12
Nise Hack!!
var image_word = {
elem : "h1,h2,h3,h4,h5,h6,span,li,ul,img".split(","),
count : 0,
}
var tag_p_and_a = {
p : [],
p_count : 0,
a : [],
a_count : 0
@esehara
esehara / gist:1249125
Created September 28, 2011 20:14
L99 Problem solution (P01 - P11)
;;P01
;;command
(defn my-last [fseq] (list(last fseq)))
;;P02
(defn my-but-last [fseq] (list (last(butlast fseq)) (last fseq))
;;other
(take-last 2 '(a b c))
;;P03
--http://ameblo.jp/programming/entry-10001721422.html
cardlist::String -> Int -> [String]
cardlist cardset member = lines(getcard cardset member 0)
getcard::String -> Int -> Int -> [Char]
getcard cardset member start = if start == member
then ""
else returncard cardset (start + 1) member ++ "\n" ++ getcard cardset member (start + 1)
@esehara
esehara / gist:1257556
Created October 2, 2011 15:46
死ぬまでの時間
// ==UserScript==
// @name 死ぬまでの時間
// @namespace youdeathtime
// @description 貴方が2038年1月19日3時14分7秒になるまでに何秒かかるか
// @include http*://*
// @require http://jquery.com/src/jquery-latest.js
// ==/UserScript==
(function(){
if(window != unsafeWindow.top){
return;
@esehara
esehara / gist:1258836
Created October 3, 2011 10:25
Google Code Jam Skeleton for Python
import sys
class line_manager:
def __init__(self):
self.first_line = True
self.in_data = True
self.data_finish_line = 0
self.readline = 0
self.is_one_line = True