Skip to content

Instantly share code, notes, and snippets.

View oinume's full-sized avatar
🏠
Working from home

oinume oinume

🏠
Working from home
View GitHub Profile
@oinume
oinume / my.cnf
Created June 15, 2014 12:04
my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
@oinume
oinume / capture.py
Created April 20, 2013 13:26
Capture stdout/stderr in Python
import cStringIO
import sys
class IOCapture(object):
def __init__(self, stdout = True, stderr = True):
self.captured_stdout = None
self.captured_stderr = None
if stdout:
self.captured_stdout = cStringIO.StringIO()
if stderr:
@oinume
oinume / config.py
Created September 10, 2011 15:59
Flask + python-oauth2 + python-twitter sample
# app/config.py
# -*- coding: utf-8 -*-
import os
class Config(object):
DEBUG = False
SQLALCHEMY_ECHO = False
SECRET_KEY = 'dev_key_h8hfne89vm'
CSRF_ENABLED = True
CSRF_SESSION_LKEY = 'dev_key_h8asSNJ9s9=+'
@oinume
oinume / visualization.ipynb
Created June 2, 2017 01:08
Visualization MySQL data in Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oinume
oinume / keybase.md
Created August 22, 2020 22:05
keybase.md

Keybase proof

I hereby claim:

  • I am oinume on github.
  • I am oinume (https://keybase.io/oinume) on keybase.
  • I have a public key ASAbPtN4USOtjo2JaIwHRQK1s1URLiDsQsA6-M8DMjs0rAo

To claim this, I am signing this object:

@oinume
oinume / main.go
Last active October 13, 2016 11:02
agouti page.GetCookies() returns error
package main
import (
"github.com/sclevine/agouti"
"net/http"
"net/http/httptest"
"fmt"
"time"
"log"
)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: tail -10000 <access_log> | ./parse-nginx-log.py
import os
import re
import sys
class LogParser(object):
@oinume
oinume / parse-apache-log.py
Last active December 24, 2015 17:39
Usage: tail -10000 <access_log> | ./parse-apache-log.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: tail -10000 <access_log> | ./parse-apache-log.py
import os
import re
import sys
class LogParser(object):
LOG_PATTERN = re.compile(r"""^(?P<remote_host>[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}) (?P<ident>[^ ]{1,}) (?P<remote_user>[^ ]{1,}|\-) \[(?P<datetime>[0-9]{2}\/[A-Za-z]{3}\/[0-9]{1,4}:[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [+\-][0-9]{4})\] "(?P<method>[A-Z ]+) (?P<uri>[^"]*) (?P<protocol>[^"]*)" (?P<status>[0-9]{3}) (?P<bytes>[0-9]{1,}|\-) "(?P<referer>[^"]*|\-)" "(?P<user_agent>[^"]+)" (?P<elapsed>[\d]+)$""")

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: tail -10000 <access_log> | ./parse-apache-log.py
import os
import re
import sys
class LogParser(object):
LOG_PATTERN = re.compile(r"""^(?P<remote_host>[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}) (?P<ident>[^ ]{1,}) (?P<remote_user>[^ ]{1,}|\-) \[(?P<datetime>[0-9]{2}\/[A-Za-z]{3}\/[0-9]{1,4}:[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [+\-][0-9]{4})\] "(?P<method>[A-Z ]+) (?P<uri>[^"]*) (?P<protocol>[^"]*)" (?P<status>[0-9]{3}) (?P<bytes>[0-9]{1,}|\-) "(?P<referer>[^"]*|\-)" "(?P<user_agent>[^"]+)" (?P<elapsed>[\d]+)$""")