Skip to content

Instantly share code, notes, and snippets.

@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 ; }'
@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 / 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 / customer-churn-ecdf.ipynb
Created May 25, 2018 11:56
Modelling Customer Churn
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / README.md
Last active July 2, 2016 16:01
Jupyter on Vagrant

Jupyter notebook on Vagrant

Boot vagrant box and login using ssh.

$ [ -d notebook ] || mkdir notebook
$ vagrant up
$ vagrant ssh
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@skitazaki
skitazaki / docker-compose.yml
Created June 11, 2016 13:59
web server to throw logs for S3
version: '2'
services:
web:
image: nginx:1.10
ports:
- "80:80"
- "443:443"
volumes:
- /opt/nginx/html:/usr/share/nginx/html
logspout:
@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 : 市民参加