Skip to content

Instantly share code, notes, and snippets.

@skitazaki
skitazaki / postgis-on-centos.rst
Last active September 9, 2016 02:56
CentOS に PostGIS/GDAL/Proj をインストールする手順。

PostGIS on CentOS

CentOS に PostGIS/GDAL/Proj をインストールする。

環境:

  • CentOS 6.4 (64bit)
  • PostgreSQL 9.3
  • PostGIS 2.1
@skitazaki
skitazaki / combined2tsv.py
Last active January 9, 2021 10:36
Convert Combined Log Format into TSV file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Convert Combined Log Format stream into TSV file.
To get known about access log, see Apache HTTP server official document.
* [`en <http://httpd.apache.org/docs/2.4/en/logs.html>`_]
* [`ja <http://httpd.apache.org/docs/2.4/ja/logs.html>`_]
@skitazaki
skitazaki / redmine-daily.py
Last active December 23, 2015 10:09
Get updated issues of Redmine by each day.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Get updated issues of Redmine by each day.
Setup & Usage
-------------
Python 2.7, ``virtualenv``, and ``pip`` are required.
@skitazaki
skitazaki / opendata.rst
Last active December 21, 2015 20:29
OpenData memo

Memo about OpenData and their utilization. [Wikipedia日本語]

オープン・ガバメント、透明でオープンな政府を実現する取り組み。市民参加を促進する。 WIRED vol.9 に詳しい。

  • Transparency : 透明性
  • Participation : 市民参加
@skitazaki
skitazaki / dbschema2rest.py
Created July 9, 2013 02:26
Dump database table schema as reST text.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Dump database table schema as reST text.
This script requires configuration file which include title text and database
connection string.
Example configuration file is defined below in JSON ::
@skitazaki
skitazaki / README.rst
Last active May 29, 2019 16:28
Backup Jenkins configuration XML files.

Backup Jenkins configuration XML files.

Setup

Python 2.7 and pip are required.

$ virtualenv --distribute $HOME/pyvenv/jenkins-backup
@skitazaki
skitazaki / amd-memo.rst
Last active December 10, 2015 19:58 — forked from anonymous/amd-memo.rst

AMD (Asynchronous Module Definition) のメモ

従来からの JavaScript の書き方だと「定義」するときにグルーバル環境を汚染してしまう課題があった。 window.Hoge みたいに書いてしまう問題。 回避策はたくさんあるけど、人によって書き方が異なると「使う」ときに大変。 特に複数のライブラリが依存し合うスクリプトの場合、読み込み順序に気を配る必要がある。 こうした "Definition" と "Dependency References" の課題を解決する方法のひとつとして AMD (Asynchronous Module Definition) がある。

@skitazaki
skitazaki / svnlog.py
Created August 22, 2012 15:47
Dump Subversion log and diff
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""%prog [options] svn-repository [svn-repository [ ... ]]
"""
import argparse
import codecs
import datetime
@skitazaki
skitazaki / layout.html
Created April 11, 2012 13:08
Sphinx template using Twitter Bootstrap
{#
default/layout.html
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Sphinx layout template for the default theme.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{% extends "basic/layout.html" %}
@skitazaki
skitazaki / gist:2359180
Created April 11, 2012 13:04
Simple access_log analysis
# Calculate by response status code.
cat /usr/local/nginx/latest/logs/access.log |
awk '$9 < 200 || $9 >= 600 { print $0 > "/dev/stderr"; }
$9 >= 200 && $9 < 600 { print $9; }' |
sort |
uniq -c
# Show raw lines of specific response status code line.
cat /usr/local/nginx/latest/logs/access.log |
awk '$9 == 301 { print $0 ; }'