Skip to content

Instantly share code, notes, and snippets.

@yasuharu519
yasuharu519 / play_itunes_album_with_afplay.py
Created April 10, 2011 14:20
this script is to play itunes album using afplay
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ファイルとサブディレクトリのパスを表示
MUSIC_PATH = u"/Users/USERNAME/Music/iTunes/iTunes Media/Music"
import glob
import os
from unicodedata import normalize
from subprocess import call
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
API_KEY = ""
class GoogleURLShorter(object):
def __init__(self, target_url, api_key=""):
self.baseUrl = 'https://www.googleapis.com/urlshortener/v1/url'
@yasuharu519
yasuharu519 / TimeDuplicationCheck2.py
Created April 6, 2011 09:07
check if the time is duplicated. if it is duplicated, this code returns the part of the time which is duplicated. see -> http://d.hatena.ne.jp/fumokmm/20110329/1301403400#20110329f1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# お題: 時間帯重複チェック(応用編)
def CheckIfSyntax(*timeTuple):
for i in xrange(len(timeTuple)):
(timeStartHour, timeStartMin, timeEndHour, timeEndMin) = timeTuple[i]
# 時間の書式のチェック
if timeStartHour > 24 or timeEndHour > 24 \
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
N = 10000
def main():
numList = range(1, N + 1)
# 1を除く
numList.pop(0)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# お題: 時間帯重複チェック
def checkIfSyntax(time1, time2):
"""
>>> checkIfSyntax((-2,3,1,1,), (1,1,1,1))
Traceback (most recent call last):
...