Skip to content

Instantly share code, notes, and snippets.

View PyYoshi's full-sized avatar
🌍
Working from The World

MISAWA Yoshihiro PyYoshi

🌍
Working from The World
View GitHub Profile
#!/bin/sh
# cat /etc/init.d/test_app
SPAWNFCGI="/usr/bin/spawn-fcgi"
SPAWNAPP="/usr/local/bin/test_app/test.fcgi"
APPNAME="test"
IP="127.0.0.1"
PORT="9000"
PID="/var/run/spawn-fcgi-test.pid"
USER="www-data"
GROUP="www-data"
@PyYoshi
PyYoshi / enc.bat
Created August 17, 2011 20:18
avisynth経由でtsファイルをPS3で再生可能なmp4/avcに変換するためのバッチ。パスを適切に変更してください。
@echo off
rem Version:0.1
rem ###エラーメッセージ###
rem =====================================================
set error=ファイルが存在しないか、ファイル名・拡張子が間違っています
if not exist "%1" echo %error%
if not exist "%1" pause
rem ###映像・音声エンコード設定###
rem =====================================================
@PyYoshi
PyYoshi / anime_template_1280x720.avs
Created August 17, 2011 20:28
DGIndexでテンプレートとなるファイル。 ロゴデータ、スクリプトのパスを適切に変更すること。
########## 初期設定 ###########
# メモリ最大使用量
SetMemoryMax(512)
# MultiThreads対応
SetMTMode(2,0)
# MPEG読み込み
v=MPEG2Source("__vid__")
# WAVE読み込み
@PyYoshi
PyYoshi / context.patch
Created September 23, 2011 02:37
VS2010でMeCab64bit版のビルド用差分 "nmake -f Makefile.msvc"でビルド
*** src/common.h Fri Jan 23 13:16:00 1970
--- src/common.h Fri Jan 23 13:16:00 1970
***************
*** 16,21 ****
--- 16,22 ----
#include <algorithm>
#include <cmath>
#include <sstream>
+ #include <iterator>
@PyYoshi
PyYoshi / download.py
Created September 25, 2011 17:35
Python製ダウンローダー require:wxPython
# -*- coding:utf-8 -*-
#!/usr/bin/env python
# fork: http://snippets.dzone.com/posts/show/2887
# History:
# 0.1: first commit
# 0.2: add overwrite mode
#
__AUTHOR__ = 'PyYoshi'
__LICENCE__ = 'MIT'
__VERSION__ = '0.3'
@PyYoshi
PyYoshi / logger.py
Created September 28, 2011 01:31
カスタムLogger
# -*- coding:utf-8 -*-
__AUTHOR__ = 'PyYoshi'
__LICENCE__ = 'MIT'
__VERSION__ = '0.1'
# fork: http://www.ueblog.org/blog/entry/pythonlogging/
# History:
# 0.1: First commit and modified...
# ファイルへパスなのかディレクトリへのパスなのか紛らわしいのでlogfile_pathをlogfile_dirpathに変更した。
# enableがTrueかFalseで出力するか切り替えするように変更した。
# start(),end()以外の出力関数の引数messageを必須に変更した。
@PyYoshi
PyYoshi / contry_code.py
Created October 7, 2011 08:45
国識別コード
# -*- coding:utf-8 -*-
class CountryCode(object):
Afghanistan = 'AF'
Albania = 'AL'
Algeria = 'DZ'
AmericanSamoa = 'AS'
Andorra = 'AD'
Angola = 'AO'
Anguilla = 'AI'
@PyYoshi
PyYoshi / jawikicorpus.py
Created October 26, 2011 04:46
Gensim用のコーパス,TFIDF,LSIとLDAモデルの生成。Pythonによる実装なのでかなり遅い。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
import os.path
import bz2
from gensim import utils
from gensim.corpora import WikiCorpus, Dictionary
from gensim.corpora.mmcorpus import MmCorpus
@PyYoshi
PyYoshi / tor_urllib2.py
Created October 30, 2011 06:37
torを使ったレスポンスの取得
import urllib2
import socket
import socks
url = ''
_s = socket
s = _s.socket(socket.AF_INET, socket.SOCK_STREAM)
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
@PyYoshi
PyYoshi / BasicAuth.java
Created November 8, 2011 18:26
BasicAuthのサンプル
public class BasicAuth{
private String auth_type = "BASIC";
private String login_uri = "http://www.tumblr.com/api/authenticate";
private String username;
private String passwd;
BasicAuth(String email, String password){