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
/* | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# Version 2, December 2004 | |
# | |
# Copyright (C) 2013 Yoshihiro TSUBOI <ytsuboi-at-gmail.com> | |
# | |
# Everyone is permitted to copy and distribute verbatim or modified | |
# copies of this license document, and changing it is allowed as long | |
# as the name is changed. | |
# |
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 | |
""" | |
A pure python ping implementation using raw socket. | |
Note that ICMP messages can only be sent from processes running as root. | |
Derived from ping.c distributed in Linux's netkit. That code is |
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 whois(host, query): | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect((host, 43)) | |
sock.send(query + '\r\n'); | |
text = '' | |
while True: | |
t = sock.recv(1024) | |
if not t: |
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 | |
export PATH=/usr/sbin:/sbin:$PATH | |
export TZ=Asia/Tokyo | |
export LANG=en | |
SERVERHOST=mybackupserver.example.com | |
SERVERLOGIN=mybackup | |
SERVER="$SERVERLOGIN@$SERVERHOST" | |
WEEKDAY=$(date +%a) |
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
/* | |
* by Shigeru KANEMOTO at SWITCHSCIENCE. | |
*/ | |
import java.io.File; | |
import java.io.IOException; | |
class RelativePath { | |
// | |
// Compute relative path to "target" from a directory "origin". |
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
<? | |
# Add following line in ".htaccess". | |
# php_value auto_prepend_file compat.php | |
$HTTP_SERVER_VARS = $_SERVER; | |
$HTTP_COOKIE_VARS = $_COOKIE; | |
$HTTP_POST_VARS = $_POST; | |
$HTTP_GET_VARS = $_GET; |
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/python | |
# vim:set fileencoding=utf-8 sw=2 ai: | |
import sqlite3 | |
import datetime | |
import re | |
SQL = ''' | |
select | |
name, version, time, author, text |
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
# by sgk | |
import datetime | |
class TZ(datetime.tzinfo): | |
def __init__(self, name, offset): | |
self.name_ = name | |
self.offset_ = offset | |
def utcoffset(self, dt): | |
return datetime.timedelta(hours=self.offset_) |
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
#vim:fileencoding=utf-8 | |
# | |
# 古いMP3エンコードソフトを使った時、 | |
# ID3タグにSJIS文字列が入っているのを修正する。 | |
# | |
# エンコーディングがLatin-1なのにSJISらしき物を修正。 | |
# | |
# 2011-3-31 Shigeru KANEMOTO | |
# Public Domain | |
# |
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 xml.sax.handler | |
import xml.sax | |
class Node(object): | |
def __init__(self, name=None, attrs=None): | |
self.name_ = name | |
self.attrs_ = attrs | |
self.dict_ = {} | |
self.str_ = '' |