Skip to content

Instantly share code, notes, and snippets.

@shirou
shirou / iSMS2android.py
Created January 3, 2013 13:24
convert iTunes SMS database to Android backup format(xml).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import sqlite3
def load(dbfile):
if not os.path.exists(dbfile):
raise Exception("file does not exists")
@shirou
shirou / make.py
Created November 2, 2012 13:43
Sphinx OS-independent make script written by Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen
import shlex
import sys
import os
SPHINXOPTS = ""
SPHINXBUILD = "sphinx-build"
@shirou
shirou / gist:3888607
Created October 14, 2012 13:35
erchef startup fail log
=====
===== LOGGING STARTED Sun Oct 14 13:21:06 UTC 2012
=====
Exec: /home/ubuntu/erchef/rel/erchef/erts-5.9.2/bin/erlexec -boot /home/ubuntu/erchef/rel/erchef/releases/1.0.0/erchef -embedded -config /home/ubuntu/erchef/rel/erchef/etc/app.config -args_file /home/ubuntu/erchef/rel/erchef/etc/vm.args -- console
Root: /home/ubuntu/erchef/rel/erchef
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [async-threads:5] [kernel-poll:true]
** Found 0 name clashes in code paths
=INFO REPORT==== 14-Oct-2012::13:21:06 ===
@shirou
shirou / gist:3848841
Created October 7, 2012 16:31
rebar make fail
$ erl --verion
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [async-threads:0] [kernel-poll:false]
Eshell V5.9.2 (abort with ^G)
$ pwd
/home/ubuntu/rebar.repo
$ ./bootstrap
Recompile: src/rebar
@shirou
shirou / error message
Created October 7, 2012 15:42
uname -a
==> Leaving directory /home/hoge/Works/erchef/deps/ibrowse'
==> Entering directory/home/hoge/Works/erchef/deps/mini_s3'
==> mini_s3 (compile)
==> Leaving directory /home/hoge/Works/erchef/deps/mini_s3'
==> Entering directory/home/hoge/Works/erchef/deps/depsolver'
==> depsolver (compile)
==> Leaving directory /home/hoge/Works/erchef/deps/depsolver'
==> Entering directory/home/hoge/Works/erchef/deps/erlware_commons'
==> erlware_commons (compile)
Dependency not available: neotoma- ({git,
@shirou
shirou / anything_setup.el
Created August 11, 2012 12:48
anything_setup.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; anything.el
;;
(require 'anything)
(require 'anything-config)
(require 'recentf)
(setq recentf-max-saved-items 1000)
(recentf-mode 1)
@shirou
shirou / gist:3037832
Created July 3, 2012 05:17
itertools
import itertools
globber = (glob.glob(d) for d in fontdirs)
for fontdir in sum(globber, []):
for (root, dirs, files), font in itertools.product(os.walk(fontdir),
fontfiles):
if font in files:
fontpath = os.path.join(root, font)
break
@shirou
shirou / out_sampling_filter.py
Created May 20, 2012 14:29
fluen.py plugin
# coding: utf-8
"""
fluenpy.plugins.out_sampling_filter
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by WAKAYAMA Shirou
:license: Apache v2
original author: tagomoris
https://github.com/tagomoris/fluent-plugin-sampling-filter
@shirou
shirou / commit.date
Created April 24, 2012 15:10
mercurial subversion convert report
convcmd.py copyメソッドの
commit = self.commitcache[rev]
直後に
print commit, type(commit)
した結果
月 1月 24 11:16:01 2011 +0000
<type 'str'>
hgext/convert/subversion.pyの、 _fetch_revisions メソッド、
812行目 for entry in stream:
@shirou
shirou / __init__.py
Created December 26, 2011 15:48
sphinx websupport with NGRAM search on heroku
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#### sphinx part. same as build.py
from sphinx.websupport import WebSupport
from sphinx.websupport.errors import DocumentNotFoundError
from sphinx.websupport.search import whooshsearch
from sphinx.websupport.storage.sqlalchemystorage import SQLAlchemyStorage