This file contains 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 Getopt::Compact; | |
use Data::Dumper; | |
my $getopt = Getopt::Compact->new( | |
name => 'mygzip', | |
modes => [ qw(verbose) ], |
This file contains 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 -*- | |
# INSTALL ==================== | |
# $ sudo easy_install argparse | |
# $ sudo easy_install mysql-python | |
import argparse | |
import MySQLdb | |
import os |
This file contains 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 net.lampetty.samples; | |
/** | |
* StringBulder V.S. String.format to concat strings. | |
*/ | |
public class StringBuilder_VS_StringFormat { | |
public static void main(String[] args) { | |
new StringBuilder_VS_StringFormat().run(args); | |
} |
This file contains 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=+' |
This file contains 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 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 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 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 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 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 |
OlderNewer