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
@PyYoshi
PyYoshi / .bash_profile
Created June 13, 2012 10:23
日本語でMinttyを扱う時のもろもろの設定ファイル。 nkfを使用すると自動でUTF-8に変換してくれるので便利です。
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
@PyYoshi
PyYoshi / file0.txt
Created June 17, 2012 03:01
urlencodeされたqueryを連想配列に戻す関数 ref: http://qiita.com/items/115d1f3bff23bafb36a2
# coding:utf8
import urllib
def urldecode(s):
rdic = {}
for item in s.split('&'):
keyVal = item.split('=')
rdic[urllib.unquote_plus(keyVal[0])] = urllib.unquote_plus(keyVal[1])
return rdic
@PyYoshi
PyYoshi / bs4.1.0_cchardet_patch.diff
Created June 20, 2012 08:57
bs4.1.0にcchardetを適用
--- E:/bs4.orig/dammit.py Wed Jun 13 13:52:56 2012
+++ E:/bs4/dammit.py Wed Jun 20 17:30:47 2012
@@ -13,15 +13,11 @@
import warnings
# Autodetects character encodings. Very useful.
-# Download from http://chardet.feedparser.org/
-# or 'apt-get install python-chardet'
-# or 'easy_install chardet'
+# Download from https://github.com/PyYoshi/cChardet
@PyYoshi
PyYoshi / watchdog_example.py
Created July 17, 2012 08:39
ファイル監視コード
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import os
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
BASEDIR = os.path.abspath(os.path.dirname(__file__))
# coding: utf-8
# http://d.hatena.ne.jp/odz/20070821/1187682903
import string
import random
alphabets = string.digits + string.letters + "!#$%&()*+,-./:;<=>?@[]^_{|}~"
def randstr(n):
return ''.join(random.choice(alphabets) for i in xrange(n))
@PyYoshi
PyYoshi / android_device_acer_salsa.diff
Created August 1, 2012 03:18
Acer LiquidのCyanogenmod 10用のdiff。 repo用のdiff形式なので以下のURLよりスクリプトを取得の上適用させること。 android_device_acer_salsa.diffは普通のdiff形式 http://d.hatena.ne.jp/i_k_b/20110126/1296023304
diff --git a/device_salsa.mk b/device_salsa.mk
index 050dde6..40e70f5 100755
--- a/device_salsa.mk
+++ b/device_salsa.mk
@@ -58,7 +58,7 @@ PRODUCT_PACKAGES += \
# proprietary side of the device
$(call inherit-product-if-exists, vendor/acer/salsa/salsa-vendor.mk)
-$(call inherit-product, frameworks/base/build/phone-hdpi-512-dalvik-heap.mk)
+$(call inherit-product, frameworks/native/build/phone-hdpi-512-dalvik-heap.mk)
@PyYoshi
PyYoshi / Microsoft.PowerShell_profile.ps1
Created August 2, 2012 12:07
virtualenvwrapper-powershell用のプロファイル
# virtualenvwrapper用の設定
$WORKON_HOME = "$HOME\.virtualenvs"
$env:WORKON_HOME = $WORKON_HOME
# $WORKON_HOMEがない場合は作成する
if(-not(Test-Path -Path $WORKON_HOME)){
New-Item -Path $WORKON_HOME -itemType Directory | Out-Null
}
# virtualenvwrapper-powershellを起動時にロードする
== ConEmuとは? ==
ConEmuは複数のコンソールをさまざまな機能を持ち合わせたカスタマイズ可能な1つのウィンドウとして描画できる、Windowsコンソールエミュレータです。
Basic application - [http://www.farmanager.com/download.php?l=en Far Manager] ([http://en.wikipedia.org/wiki/FAR_Manager Far in Wikipedia])と共同利用。 Far (File and Archive) ManagerはファイルとアーカイブをWindowsOS上で管理できるコンソールプログラムです。
[[ReleaseList]]
[[RecentTickets(limit=5)]]
[http://code.google.com/p/conemu-maximus5/downloads/list プロジェクトページ]
から最新Versionをダウンロード
# virtualenvwrapper用の設定
$WORKON_HOME = "$HOME\.virtualenvs"
$env:WORKON_HOME = $WORKON_HOME
# $WORKON_HOMEがない場合は作成する
if(-not(Test-Path -Path $WORKON_HOME)){
New-Item -Path $WORKON_HOME -itemType Directory | Out-Null
}
# PowerTabのロード
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
class BinaryReader:
# based: http://code.activestate.com/recipes/577610-decoding-binary-files/
# http://www.python.jp/doc/nightly/library/struct.html
_TYPES = {