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 | |
# my absolute path on bash | |
echo $(cd $(dirname $0);pwd) |
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 | |
"""Python urllib2 proxy usage sample | |
""" | |
import urllib2 | |
#今回はプロキシ設定を空にしておく | |
#proxies = {'http': 'http://www.example.com:3128/'} | |
proxies = {} | |
#プロキシハンドラーを作成して |
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 -*- | |
"""月末、月初のdatetime.dateオブジェクトを返す。 | |
Oracleのadd_months互換の月加減。 | |
""" | |
import datetime | |
from calendar import monthrange | |
def first_day(date): | |
"""月初を返す""" |
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
# -*- coding: utf-8 -*- | |
"""MoinMoin custom user authentication sample | |
""" | |
from MoinMoin import user | |
#User Database | |
_USER_MAP = {'user1,pass1':('[email protected]',u'user1'),'user2,pass2':('[email protected]','user2')} | |
def login(request, **kw): | |
username = kw.get('name') | |
password = kw.get('password') |
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-*- | |
# python-ldapを使ってActiveDirectoryで認証してみる | |
# http://python-ldap.sourceforge.net/ | |
def ADAuth(username,password,host,port=389): | |
"""ActiveDirectoryのドメイコントローラにユーザ名とパスワードでbindしてみる。 | |
bindできれば認証OK。認証NGなら例外が起きる。 | |
""" | |
import ldap |
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 -*- | |
"""ISBN(国際標準図書番号)規格改定 | |
http://www.isbn-center.jp/whatsnew/kikaku.html | |
ISBNコードをいろいろするライブラリ。isbnlib.py | |
""" | |
import os,sys | |
#13桁ISBNの接頭文字 | |
ISBN13_PREFIX = ('978','979') |
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
<?php | |
// 全国郵便番号一覧 - 郵便専門ネット http://yubin.senmon.net/ | |
// PHP XML-RPCクライアントクラス yubin.class.php | |
// 使い方は一番下のテストを。 | |
// | |
// 2002.11.05 受け渡す郵便番号の型がintになっていたのをstringに修正。 | |
// 2002.11.06 見つからない場合にはfaultCode()が返るようになったのでそれに合わせて変更。 | |
// 2002.11.08 セルフテストのスペルミスを訂正。 | |
// 2002.11.09 仕様変更に対応。初期化関数の冗長な記述を削除。 | |
// 2002.11.11 Addressというクラス名は一般的するぎるのでYubinXMLRPC_Addressに変更。 |
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
<?php | |
//XML-RPC yubin.class.php 使用サンプル | |
if (isset($_GET['show_source'])) { | |
highlight_file('sample.php'); | |
exit; | |
} | |
?> | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> |
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
<?php | |
//XML-RPC IXR_Library.inc.php 使用サンプル | |
if (isset($_GET['show_source'])) { | |
highlight_file('sample2.php'); | |
exit; | |
} | |
?> | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> |
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 -*- | |
"""yurpc2.py | |
XML-RPCで郵便番号から住所を取得するPythonスクリプト | |
""" | |
import sys | |
import string | |
try: | |
from xmlrpc.client import ServerProxy | |
except ImportError: |
OlderNewer