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 -*- | |
import os.path | |
from urlparse import urlparse | |
import arrow | |
from scrapy.http import HtmlResponse | |
from selenium.webdriver import Firefox |
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
# Decorator | |
@decorator | |
def check_db_connection(func, *args, **kwargs): | |
try: | |
db.get_conn().ping(True) | |
except: | |
logging.error(traceback.format_exc()) | |
return func(*args, **kwargs) |
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 -*- | |
""" | |
convert_tableは、文字のリスト。 | |
このリストを使って基数変換する。 | |
リストの長さが62だったら、62進数に変換する感じ。 | |
intは、10進数で入れる。 | |
""" | |
import math |
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
on search(keyword) | |
tell application "iTunes" | |
set p to first library playlist | |
set sr to (search p for keyword) | |
return sr | |
end tell | |
end search | |
set sr to search("曲名") |
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
import xlrd | |
from collections import OrderedDict | |
import simplejson as json | |
excel_path = raw_input('input path> ') | |
json_path = raw_input('output json path> ') | |
wb = xlrd.open_workbook(excel_path) | |
sheets = OrderedDict() |
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
def override_print(message, line_length = 100): | |
if len(message) > line_length: | |
message = message[:line_length - 3] + "..." | |
sys.stdout.write((u"\r{0:<" + str(line_length) + "}").format(message)) | |
sys.stdout.flush() |
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
ko.bindingHandlers.dropzone = | |
init: (element, value_accessor) -> | |
passed_value = ko.unwrap value_accessor() | |
send_data = passed_value.data | |
$target = $(element).dropzone | |
url: passed_value.url | |
sending: (file, xhr, form_data) -> | |
for name, value of send_data | |
if typeof(value) == "function" | |
form_data.append name, value() |
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
user www; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; |
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
description "[APP NAME] API Server" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
respawn | |
script | |
su - www | |
source /home/www/[APP NAME]/virtualenv/bin/activate |
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
javascript: $(".ProfileCard-avatarImage").each(function() { $avatarImg = $(this); $avatarImg.attr("src", $avatarImg.attr("src").replace("_bigger", "_400x400")); }); |