Skip to content

Instantly share code, notes, and snippets.

@utgwkk
utgwkk / cggekijo.json
Last active October 17, 2016 02:55
シンデレラガールズ劇場
[
{
"title": "気付いて小春ちゃん",
"people": [
"古賀小春"
],
"number": 787
},
{
"title": "セクシー魔女の悪戯",
@utgwkk
utgwkk / media-key-for-subsonic-5.user.js
Created April 2, 2016 03:50
Enables to control your Subsonic with Media Key.
// ==UserScript==
// @name Media Key for Subsonic 5
// @namespace http://utgw.net/
// @version 0.1
// @description Enables to control your Subsonic with Media Key.
// @author utgwkk
// @match https?://*/subsonic/index.view
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.min.js
// ==/UserScript==
@utgwkk
utgwkk / tweetdeck-word-space.js
Last active March 21, 2016 16:29
TweetDeck で英字と非英字の間に自動でスペースを入れる User Script
// ==UserScript==
// @name TweetDeck Text Spacing
// @namespace http://utgw.net/
// @version 0.1
// @description TweetDeck で英字と非英字の間に自動でスペースを入れる
// @author @utgwkk
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.min.js
// @match https://tweetdeck.twitter.com/*
// ==/UserScript==
@utgwkk
utgwkk / zundoko.py
Created March 18, 2016 22:25
「ズン」「ドコ」のいずれかをランダムに返し、「ズンズンズンズンドコ」の順番に yield されたら「キ・ヨ・シ!」を yield するジェネレータ
# coding: utf-8
import random
def zundoko():
s = 'ズン', 'ドコ'
q = []
while True:
z = random.choice(s)
yield z
q.insert(0, z)
@utgwkk
utgwkk / string.py
Created March 12, 2016 15:24
tr// とか String.tr 的あれ
# coding: utf-8
import re
def expand_hyphen(pattern_string):
def _expand(hyphen):
start, end = map(ord, hyphen.groups())
return ''.join(map(chr, range(start, end+1)))
return re.sub(r'(\S)\-(\S)', _expand, pattern_string)
@utgwkk
utgwkk / scoop-hoge.user.js
Created February 18, 2016 04:48
arbeit page no hogehoge suruyatu
// ==UserScript==
// @name arbeit page no hogehoge suruyatu
// @namespace
// @version 0.1
// @description s-coop.net のあれ
// @author utgwkk
// @match https://rcpt.kyoto-bauc.or.jp/kyodai_arbeit/*
// ==/UserScript==
'use strict';
@utgwkk
utgwkk / untitled.py
Last active December 21, 2015 11:39
リストをこういうふうに分割する
def split_list(xs, span=1):
result = []
arr = []
for i, x in enumerate(xs):
if i > 0 and i % span == 0:
result.append(arr)
arr = []
arr.append(x)
else:
if len(arr) > 0:
@utgwkk
utgwkk / nijie.py
Created December 12, 2015 09:08
ニジエスクレイピング野郎
#!/usr/bin/env python
# coding=utf-8
import re
import requests
import lxml.html
class Nijie(object):
def __init__(self, params):
self._scheme = 'http:'
@utgwkk
utgwkk / imanonashi.py
Created October 29, 2015 15:54
"(いま|今)のなしで?" で前のツイートを削除できるぞ!!!!!
#!/usr/bin/python3
import re
import tweepy
from tokens import *
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
me = api.me().screen_name
@utgwkk
utgwkk / mandel.py
Last active October 23, 2015 11:23 — forked from firstspring1845/mandel.py
draw Mandelbrot set / requires PIL
import itertools
from PIL import Image
result = Image.new("L", (6400, 6400))
for r, i in itertools.product(range(6400), repeat=2):
c = complex(r / 1600.0 - 2.0, i / 1600.0 - 2.0)
z = 0
print(c)