Skip to content

Instantly share code, notes, and snippets.

View 2020 東京都都知事選得票投票結果.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yamakk
yamakk / 0_reuse_code.js
Created Feb 15, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yamakk
yamakk / mygoogledocs.py
Created Dec 18, 2011
googledocsをcsvにエクスポート
View mygoogledocs.py
#coding:utf-8
import gdata.docs.data
import gdata.docs.client
import gdata.docs.service
import gdata.spreadsheet.service
"""
SpreadSheet
GoogleDocsからドキュメントをローカルにエクスポートするクラス
アカウント情報とdocumentid, そしてexportしたいファイルの名前が必要
View mymecab.scala
import java.text.Normalizer
import scala.collection.mutable.ArrayBuffer
import org.chasen.mecab.{MeCab, Tagger, Node}
/*
scalac mymecab.scala
scala MyMeCabTest
ArrayBuffer(サイト, リンクフリー, リンクフリー)
@yamakk
yamakk / ignoredecodetest.scala
Created Dec 6, 2011
ignoredecodetest.scala utf-8でdecodeできないファイルをscalaで扱う
View ignoredecodetest.scala
import java.io.{InputStreamReader, FileInputStream, BufferedReader}
import java.nio.charset.{Charset, CharsetDecoder, CodingErrorAction}
/*
通常 Source.fromFile("sample.txt")では
java.nio.charset.MalformedInputException: Input length = 1
エラーが出る場合使う.
*/
object IgnoreDecodeTest{
@yamakk
yamakk / mecab-java-0.98.Makefile
Created Dec 5, 2011
mecab-java-0.98 Makefile for MacOS10.6.8
View mecab-java-0.98.Makefile
JAVA_BASE=/System/Library/Frameworks/JavaVM.framework/Versions/1.6
JAVA_HOME=$(JAVA_BASE)/Home
TARGET=MeCab
JAVAC=$(JAVA_HOME)/bin/javac -encoding utf-8
JAVA=$(JAVA_HOME)/bin/java -Dfile.encoding=utf-8
JAR=$(JAVA_HOME)/bin/jar
CXX=g++
INCLUDE=/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
PACKAGE=org/chasen/mecab
@yamakk
yamakk / multiprocess_mongo.py
Created Dec 4, 2011
multiprocessing to mongodb single processと4processの比較
View multiprocess_mongo.py
#coding:utf-8
import os
import time
from multiprocessing import Process
import pymongo
def print_tweet(collection):
db = pymongo.Connection().twitter
pid = os.getpid()
@yamakk
yamakk / mymecab.py
Created Oct 15, 2011
mymecab.py MyMeCab().parse()
View mymecab.py
#coding:utf-8
import datetime
import time
import unicodedata
import MeCab
from HTMLParser import HTMLParser
import re
class MyMeCab(object):
'''
@yamakk
yamakk / mongodb_scala.scala
Created Oct 15, 2011
MongoDBにScalaで接続
View mongodb_scala.scala
import com.novus.casbah.mongodb
val con = mongodb.MongoConnection() // localhost に接続
val db = con("test")
val col = db("scala")
val item = mongodb.MongoDBObject("name"->"testtest", "age"->23)
col += item
println(col.find().toList)
@yamakk
yamakk / rotatelog.py
Created Oct 4, 2011
よく使うRotateLoggerの設定とtracebackの組み合わせ
View rotatelog.py
#coding:utf-8
import logging
import logging.handlers
import traceback
"""よく使うRotateLoggerの設定とtracebackの設定"""
def getRotateLogger(path, name='', level=logging.DEBUG, **kws):
maxBytes = kws.get('maxBytes', 1024*1024*50)