Skip to content

Instantly share code, notes, and snippets.

View alice1017's full-sized avatar

Alice1017 alice1017

  • Tokyo, Japan
View GitHub Profile
@alice1017
alice1017 / make html template
Created November 3, 2010 11:56
make html template.
#!/usr/bin/python
#coding:utf-8
import sys
import os
######################################
#
# sys.argv[1] - file name.
# sys.argv[2] - directory name.
@alice1017
alice1017 / Download image
Created December 4, 2010 06:15
aタグのhrefが画像拡張子のURLの場合、それをダウンロードするもの。
#!/usr/bin/python
#coding:utf-8
"""
This Module can Download image.
CopyRight Alice All Rights Reserved.
maked by 2010.12.01
Usage::python getimg.py [url] [directory]
Option::
@alice1017
alice1017 / gist test
Created December 6, 2010 03:38
.pycファイルを削除する
#!/usr/bin/python
#coding:utf-8
"""This Module is delete .pyc-files.
Usage::
python index.py
"""
import os
@alice1017
alice1017 / todict.py
Created December 16, 2010 10:04
リストの要素の中に=がついているものを、=の前の要素:=後の要素という形の辞書に変換するクラス。
#!/usr/bin/python
#coding:utf-8
class toDict():
"""
This class make dictionary from list.
if list have not '=' string, this class say error.
ex.)
>>> a = ['a=b','c=d']
>>> e = toDict(a)
@alice1017
alice1017 / AutomakeXML
Created December 21, 2010 09:40
辞書をXMLにします
#!/usr/bin/python
#coding:utf-8
import funcs
import types
import sys
import os
class MakeXML():
"""このモジュールは自分で項目をつくりながらXMLファイルを生成できるものです
@alice1017
alice1017 / randomstr
Created December 22, 2010 15:34
ランダムな文字列を生成する関数です
#!/usr/bin/python
#coding:utf-8
import random
def makestr(num):
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789[]{}!$%&'()-^¥:;*+><"
strist = list(s)
string = ""
for i in range(num):
@alice1017
alice1017 / getlink.py
Created December 29, 2010 15:30
ux.nuのAPIを使って引数に指定したURLを省略します
@alice1017
alice1017 / gist:764827
Created January 4, 2011 14:35
辞書を展開するexp関数
def exp(dictionary):
item = {}
item["keys"] = []
item["values"] = []
for i,j in dictionary.iteritems():
item["keys"].append(i)
item["values"].append(j)
return item
@alice1017
alice1017 / usefull.py
Created January 8, 2011 13:19
my usefull module
#!/usr/bin/python
#coding:utf-8
"""this is very usefull Modules.
CLASSES:
File -- Make file object as you want.
DictSearch -- Search a dictionary.
FUNCTIONS:
@alice1017
alice1017 / getlink.py
Created January 12, 2011 13:20
using google API.