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
# coding: utf-8 | |
from optparse import OptionParser | |
import smtplib | |
from email.MIMEText import MIMEText | |
from email.Utils import formatdate | |
ENCODING = 'iso-2022-jp' | |
class GMailConnection(object): | |
def __init__(self, username, password): |
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
# coding: utf-8 | |
from google.appengine.ext.webapp import util | |
cachevar = None # キャッシュ用変数 | |
def application(environ, start_response): | |
global cachevar | |
if cachevar is None: | |
msg = '%s' | |
cachevar = [] | |
for i in range(10): |
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
# coding: utf-8 | |
import time | |
from datetime import datetime | |
from logging.handlers import TimedRotatingFileHandler | |
def get_next_month_first_day(now=None): | |
if not now: | |
now = datetime.now() | |
year = now.year |
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
AUTH_RESPONSE_BODY = """<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> | |
<html lang="ja"> | |
<head> | |
<title>401 Authorization Required</title> | |
</head> | |
<body>401 Authorization Required</body> | |
</html>""" | |
def auth_required_app(environ, start_response, relm): | |
start_response('401 Authorization Required', [ |
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
_comp_scaffold() { | |
local cur prev lst | |
cur=${COMP_WORDS[COMP_CWORD]} | |
prev=${COMP_WORDS[COMP_CWORD-1]} | |
lst=`scaffold list|xargs echo` | |
COMPREPLY=() | |
if [[ "$prev" == create* ]]; then | |
COMPREPLY=( $(compgen -W '${lst}' $cur) ); | |
return 0; | |
fi |
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:utf8 | |
import os | |
import sys | |
FILE_HOSTNAME = '/etc/hostname' | |
FILE_HOSTS = '/etc/hosts' | |
FILE_NETWORK = '/etc/network/interfaces' | |
CMD_RESTART_NETWORK = 'ifdown eth0&&ifup eth0' |
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 socket | |
def get_host_name(s): | |
for line in s.splitlines(): | |
if line.startswith('Host:'): | |
return line[6:] | |
def host_to_ip(s): | |
return socket.getaddrinfo(s, 80)[0][4][0] |
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 socket | |
def get_host_name(s): | |
for line in s.splitlines(): | |
if line.startswith('Host:'): | |
return line[6:] | |
def host_to_ip(s): | |
return socket.getaddrinfo(s, 80)[0][4][0] |
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
ほげは「真」 | |
もし、ほげが「真」ならば | |
「こんちには世界」と表示 |
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 socket | |
def get_host_name(s): | |
for line in s.splitlines(): | |
if line.startswith('Host:'): | |
return line[6:] | |
def host_to_ip(s): | |
return socket.getaddrinfo(s, 80)[0][4][0] |
OlderNewer