Skip to content

Instantly share code, notes, and snippets.

@yuitest
yuitest / gist:10491038
Created April 11, 2014 18:40
tail と xargs する時のメモ
tail -n 0 -f hoge.txt | xargs -I{} echo
# coding: utf-8
from __future__ import unicode_literals, print_function
def partial_contains(text1, text2):
index = 0
for char in text2:
index = text1.find(char, index)
if index < 0:
return False
@yuitest
yuitest / mls.html
Created April 12, 2014 14:34
画面側: ひたすらポニー画像が出てきて、ポニーの居る範囲をクリックすると次のポニー画像に遷移、を繰り返す。(ポニーで遊ぼう!)
<html>
<head>
<meta charset="utf-8">
<title>ポニーの居る位置をマウスで選択</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
jQuery.noConflict();
jQuery(function ($) {
var targetImg = $('#img');
var borderBox = $('div.x');
@yuitest
yuitest / derpibooru.py
Last active August 29, 2015 13:59
derpibooru から、 JSON と画像を取得する。ループが 3 秒ぐらいになってる。負荷を掛けないように各自要調整。
# coding: utf8
from __future__ import division, print_function, unicode_literals
import json
import mimetypes
import os
import requests
@yuitest
yuitest / メモ、文書作成を向上.md
Last active August 29, 2015 13:59
文書作成の技能を向上させたいのでメモしている。

まず

  • 向上させたい対象は「文書」の「文章」両方を意味してる。

工夫する方法

  • 実際に文章を書く。繰り返し推敲する。
    • なんの文章を?
  • レビューしてもらう。
  • 誰に?どうやって?
@yuitest
yuitest / 気分転換.md
Last active August 29, 2015 14:00
私の気分転換リスト

私の気分転換の方法

※あくまで「私の場合」です。

汎用

  • 歯を磨く
  • 飴を舐める
  • ゆっくりと呼吸する(深い呼吸にこだわらなくても良いが、呼吸に意識を傾ける)
  • ストレッチ(特に、日常生活の筋肉の動きとは逆側に緊張をかける)
根掘り葉掘り
踏んだり蹴ったり
願ったり叶ったり
痛し痒し
行ったり来たり
伸るか反るか
@yuitest
yuitest / rect.py
Last active August 29, 2015 14:00
練習
# coding: utf8
from __future__ import division, print_function, unicode_literals
from collections import namedtuple
class Point(namedtuple('Point', ('x', 'y'))):
__slots__ = ()
class Rect(namedtuple('Rect', ('x', 'y', 'w', 'h'))):
@yuitest
yuitest / warshalfloyd.py
Last active August 29, 2015 14:00
ワーシャル-フロイド法のお勉強。最短路線検索。
# coding: utf8
from __future__ import division, print_function, unicode_literals
from functools import total_ordering
from collections import namedtuple
import copy
@total_ordering
class Way(namedtuple('Way', ('time', 'transporter'))):
'''
@yuitest
yuitest / transparent.sh
Last active August 29, 2015 14:00
グレイスケールを作る but 白-黒ではなく白-透明の。
#!/bin/sh
exec convert "$1" -alpha copy -channel alpha -negate +channel -fx '#FFF' "$2"