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:utf8 -*- | |
# FizzBuzz遅延評価版 | |
from itertools import repeat, starmap, count | |
try: | |
range = xrange | |
except NameError: | |
pass | |
else: | |
from itertools import imap as map |
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
// ==UserScript== | |
// @name MyPixiv | |
// @namespace http://d.hatena.ne.jp/kk6/ | |
// @description Pixiv用おれおれGM | |
// @include http://www.pixiv.net/* | |
// @exclude http://www.pixiv.net/bookmark.php* | |
// ==/UserScript== | |
(function($){ |
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 -*- | |
# アルファベットから顔文字生成 | |
# Python3専用です | |
import unicodedata | |
def to_face(ls): | |
for c in ls: |
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
>>> from celery.beat import ScheduleEntry | |
>>> from celery.task import periodic_task | |
>>> from celery.schedules import crontab | |
>>> from some_module import some_function | |
>>> entry = ScheduleEntry(periodic_task(mkdir_every_minute, run_every=crontab())) | |
>>> entry | |
<Entry: <function _create_task_cls at 0xb0156f4> None(*(), **{}) {None}> |
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 -*- | |
from functools import wraps | |
from django.contrib import messages | |
from django.shortcuts import redirect | |
def session_required(session_key, fail_redirect_to): | |
def _session_required(view_func): | |
@wraps(view_func) |
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 | |
import sys | |
def warning(ui, repo, hooktype, node=None, source=None, **kwargs): | |
ctx = repo[None] | |
unknown_files = repo.status(ctx.parents()[0], ctx, unknown=True)[4] | |
if unknown_files: | |
for filename in unknown_files: |
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($) { | |
// element の true/false に対して control の true/false が追従します | |
$.fn.toggle_chkboxes = function(control) { | |
var element = this; | |
control = $(control); | |
// element がクリックされたら change.chkboxes イベントを発火させる | |
element.click(function() { |
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 csv | |
import requests | |
from pyquery import PyQuery as pq | |
def _scrape_links(url, search_query): | |
response = requests.get(url, params=search_query) |