This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Encode; | |
| use Encode::JP::H2Z; | |
| use open ":utf8"; | |
| binmode STDOUT, ":utf8"; | |
| binmode STDIN, ":utf8"; | |
| my $euc = Encode::find_encoding("eucjp"); | |
| sub z2h { my $s = $euc->encode(shift); Encode::JP::H2Z::z2h(\$s); $s = $euc->decode($s); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -eu | |
| for i in bin_relay_log commands connections files_tables innodb_bpool innodb_bpool_act innodb_insert_buf innodb_io innodb_io_pend innodb_log innodb_rows innodb_semaphores innodb_tnx myisam_indexes network_traffic qcache qcache_mem replication select_types slow sorts table_locks tmp_tables; do | |
| echo "--- $i ---" | |
| rm -f /etc/munin/plugins/mysql_$i | |
| ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_$i | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ${packageName}; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.GenerationType; | |
| import javax.persistence.Id; | |
| import javax.persistence.Table; | |
| @Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ${packageName}; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.GenerationType; | |
| import javax.persistence.Id; | |
| import javax.persistence.Table; | |
| @Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package jp.ameba.picnic.orm.microbookmark.entity; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.GenerationType; | |
| import javax.persistence.Id; | |
| import javax.persistence.Table; | |
| import javax.persistence.metamodel.StaticMetamodel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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]+)$""") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -eux | |
| sudo apt-get -y install curl git-core bzip2 build-essential zlib1g-dev libssl-dev | |
| curl -L get.rvm.io | sudo bash -s stable | |
| sudo su - | |
| [ -f /etc/profile.d/rvm.sh ] && . /etc/profile.d/rvm.sh | |
| RUBY_VERSION=ruby-1.9.3-p194 | |
| rvm install $RUBY_VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cStringIO | |
| import sys | |
| class StdoutCapture(object): | |
| def __init__(self): | |
| self.captured = cStringIO.StringIO() | |
| def start(self): | |
| sys.stdout = self.captured | |
| return self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def f(**kwargs): | |
| for k, v in kwargs.iteritems(): | |
| print "%s => %s" % (k, v) | |
| f(**{ 'key1': 'value1', 'key2': 'value2' }) | |
| # output: | |
| # key2 => value2 | |
| # key1 => value1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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=+' |