Skip to content

Instantly share code, notes, and snippets.

View seikichi's full-sized avatar
💭
社畜

Seiichi KONDO seikichi

💭
社畜
View GitHub Profile
@seikichi
seikichi / feedly-star-opener.user.js
Last active August 29, 2015 14:07
Feedly Star Opener (2014/10/13 Firefox 32.0.3 Greasemonkey 2.2)
// ==UserScript==
// @name Feedly Star Opener
// @namespace http://www.srcw.net/
// @description Open saved items in Feedly
// @include http://feedly.com/*
// @include https://feedly.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 1.0.2
// ==/UserScript==
access_token:
key: ひみつ
secret: ひみつ
credential:
user: !!python/unicode 'seikichi'
options:
ambiguous_width: 2
browser_command: screen w3m %s
full_status_area_height: 6
max_log: 200
#!/usr/bin/python
# -*- coding: utf-8 -*-
# PRML chapter 9
# Gaussian Mixture Model
import scipy as sp
from scipy.linalg import det, inv
@seikichi
seikichi / mydefs.py
Created October 19, 2010 20:21
Rで学ぶクラスタ解析のコードをpythonで書いただけ
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Rで学ぶクラスタ解析のパクり
import scipy as sp
def table(result, answer):
result, answer = sp.asarray(result), sp.asarray(answer)
@seikichi
seikichi / isbnfilename.sh
Created March 1, 2011 19:29
自炊したpdfから最初と最後の3ページの画像を確認してバーコードを探しファイル名を"<ISBN13>.pdf" に変換.
#!/bin/bash
rm -f .image*
CHECK=3
for file in *.pdf; do
pages=$(pdfinfo "$file" | grep -E '^Pages' | sed -e 's/^Pages:\s*//') &&
pdfimages -j -l $CHECK "$file" .image_h &&
pdfimages -j -f $(expr $pages - $CHECK) "$file" .image_t &&
title="$(zbarimg -q .image* | uniq | grep -E '^EAN-13:978' | sed -e 's/^EAN-13://').pdf" &&
@seikichi
seikichi / isbn2title.py
Created March 1, 2011 19:46
ISBNをAmazon APIに投げて自炊した本のタイトル向けの文字列を出力
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/
from sys import argv
from time import gmtime, strftime
from urllib import urlencode, urlopen
from xml.etree import ElementTree as ET
from base64 import b64encode
@seikichi
seikichi / kakan.cpp
Created May 9, 2011 03:38
サークルの講座用(2011/5/9)
/*
サークルの講座用に書いた何か.
`もう/もう 何/なに も/も 怖/コワ く/く な/な い/い 。/。`
という形式のコーパスを読み込んで仮名漢字変換っぽい何かをします.
未知語とか何も考えてない上にスムージングのパラメータも適当でこれはひどい.
「EUCだから1文字2バイトだろ」とか決め打ちでこれはひどい.
全体的に富豪気味でこれはひどい.
using namepsace std; もぐもぐ!
#ifndef LUAHELPER_HPP
#define LUAHELPER_HPP
#include <iostream>
#include <memory>
#include <string>
#include <tuple>
#include <lua.hpp>
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Example: python3 kasi_time.py 65532
import sys
from selenium import webdriver
if len(sys.argv) != 2:
print('Usage: kasi_time.py id', file=sys.stderr)
@seikichi
seikichi / title.py
Last active December 19, 2015 09:09
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://futaba.qs.cjb.net/nijiran/fCatalog_MAY.html のタイトル取得が
# うまく出来んと言われたのでやってみた (なげやり)
# lxml は charset 適当に見つけたら上手いこと decode してくれるので
# response.text じゃなくて response.content を lxml.html.fromstring に
# 渡せばいいよとかそんな話