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 | |
# -*- 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 | |
"""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
# -*- coding: utf-8 -*- | |
"""MoinMoin custom user authentication sample | |
""" | |
from MoinMoin import user | |
#User Database | |
_USER_MAP = {'user1,pass1':('user1@example.com',u'user1'),'user2,pass2':('user2@example.com','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 -*- | |
"""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 | |
//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 -*- | |
"""モジュラス10ウエイト3とISBNのチェックデジット計算。Python版。 | |
""" | |
def m10w31(code): | |
"""モジュラス10ウエイト3チェックデジットの計算 | |
""" | |
s = list(str(code)) | |
s.reverse() | |
sum = 0 |
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
<?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
function m10w31(code: string): integer; | |
/** | |
Delphi版 モジュラス10ウエィト3のチェックデジット計算。 | |
*/ | |
var | |
i,w,sum: integer; | |
begin | |
w := 3; | |
sum := 0; | |
for i := length(code) downto 1 do |
OlderNewer