Skip to content

Instantly share code, notes, and snippets.

@yatt
yatt / sakura-python27.kwd
Created July 3, 2015 01:59
sakura editor python2.7 keyword file
and
del
from
not
while
as
elif
global
or
with
@yatt
yatt / xargs.py
Created June 1, 2015 12:01
xargs for windows written in python, supports -P and -n
#! /usr/bin/python2.7
# coding: utf-8
# ref: http://unixhelp.ed.ac.uk/CGI/man-cgi?xargs
"""
create .bat file below as xargs.bat and run this script
@echo off
C:\Python27\python.exe %~dp0xargs.py %*
@yatt
yatt / login_hatena_py3.py
Created May 31, 2015 12:51
login www.hatena.ne.jp using python3 (and requests package)
#! /usr/bin/python3.4
import requests
name='*your username*'
pwd='*your password*'
s = requests.session()
data = {
'name': name,
@yatt
yatt / taskscheduler
Created May 27, 2015 13:19
easy task scheduler
#! /bin/sh
# easy task scheduler
#
# 1. mkdir taskscheduler/app/bin/cal/log
# taskscheduler
# ├── app (775)
# │.. ├── renkei_0001.sh
# │.. └── renkei_0002.sh
# ├── bin (775)
@yatt
yatt / scripteuler.js
Created April 30, 2015 13:58
link euler project problem to http://odz.sakura.ne.jp/
// ==UserScript==
// @name ScriptEuler
// @namespace http://d.hatena.ne.jp/yatt/
// @description link euler project problem to http://odz.sakura.ne.jp/
// @include https://projecteuler.net/archives*
// ==/UserScript==
(function(){
var lst = document.getElementsByClassName('id_column')
var prefix = 'http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%20'
@yatt
yatt / app.html
Last active August 29, 2015 14:17
ANA season chart 2015 domestic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ANA Season Clendar</title>
<!-- ref: http://shanabrian.com/web/javascript/date04.php
-->
<!-- CSS -->
<link href="fullcalendar-2.3.1/fullcalendar.min.css" rel="stylesheet" type="text/css">
@yatt
yatt / element.py
Created January 31, 2015 08:54
css nth-of-type pseudo class implimentation for beautifulsoup4, python html scraping library
import collections
import re
import sys
import warnings
from bs4.dammit import EntitySubstitution
DEFAULT_OUTPUT_ENCODING = "utf-8"
PY3K = (sys.version_info[0] > 2)
whitespace_re = re.compile("\s+")
@yatt
yatt / gmail.py
Created December 16, 2014 15:06
Python2.7でGMailから自身にメールを送信、日本語もOK.
#! /usr/bin/python2.7
# coding: utf-8
"""
stdinの内容をGMailで
自分自身に送る
"""
import smtplib
@yatt
yatt / a.js
Created April 23, 2014 15:10
snap links lite(1.3.4)が最新のchrome( 34.0.1847.116 m)で設定を保存できなかったので直接修正
chrome.extension.sendMessage({message:'snaplinksInit'}, function(ret){
visibleOnly = ret.visibleOnly;
button = ret.button;
// 2014/04/21 設定が反映されないのでソースを修正
button = 1;
reverse = ret.reverse;
});
@yatt
yatt / starbuckscardbalance.py
Last active June 29, 2017 05:37
スターバックスカードの残高確認スクリプト
# coding: utf-8
# スタバカードの残金を取得する。
import urllib
import re
cardno,pin = open('credentials.txt').read().split()
# HTML
params = urllib.urlencode({'sbCardNumber': cardno, 'pinNumber': pin})