Skip to content

Instantly share code, notes, and snippets.

@takapiko
takapiko / erase_hatena_bookmark.py
Created September 11, 2018 09:41
特定タグの付いたはてなブックマークを削除
#!/usr/bin/python
#-* coding:utf-8 -*-
import feedparser,sys,urllib
import json
import requests
from requests_oauthlib import OAuth1
def get_username(auth):
response = requests.get("http://api.b.hatena.ne.jp/1/my", auth=auth)
@takapiko
takapiko / complementary_afterimage.py
Created August 29, 2017 04:29
補色残像による錯視画像の生成
# coding: UTF-8
import sys
from PIL import Image
if __name__ == "__main__":
filename = sys.argv[1]
raw_img = Image.open(filename,'r')
gray_img = raw_img.convert('L')
size = raw_img.size
@takapiko
takapiko / kolakoski_sequence.py
Created August 14, 2017 11:45
KolakoskiSequenceを生成するプログラム
# coding: UTF-8
def kolakoski_transformation(seq):
l = []
temp = seq[0]
count = 0
for n in seq:
if(n == temp):
count+=1
else:
@takapiko
takapiko / first_isomorphism_theorem.tex
Created January 5, 2016 05:08
xypic(xymatrix)による第一同型定理の図式
\documentclass{jsarticle}
\usepackage[all]{xy}
\begin{document}
$\xymatrix{
G \ar[r]^{f} \ar[d]_{\pi} & G' \\
G/ker f \ar@{.>}[ru]_{\psi}
}$
\end{document}
@takapiko
takapiko / commutative_diagram.tex
Created January 5, 2016 04:01
amscdによる5項補題の可換図式
\documentclass{jsarticle}
\usepackage{amscd}
\begin{document}
$\begin{CD}
A @>f>> B @>g>> C @>h>> D @>i>> E \\
@VlVV @VmVV @VnVV @VpVV @VqVV \\
A' @>r>> B' @>s>> C' @>t>> D' @>u>> E'
\end{CD}$
\end{document}
@takapiko
takapiko / fav_eject.rb
Created November 17, 2015 09:14
ふぁぼされたらejectするmikutterプラグイン
# -*- coding: utf-8 -*-
Plugin.create :fav_eject do
on_favorite do |service, user, message|
Thread.new {
system("eject")
}
end
end
import Text.Regex
import Data.List
readCSV :: (String,String)->IO [[String]]
readCSV (fileName,delimiter) = do
text <- (readFile fileName)
let column = lines text::[String]
elements = map (splitRegex (mkRegex delimiter)) column
return elements
main(a,b,m){
scanf("%d%d",&a,&b);
b=(a+=b)-2*b;
m=b>>31;
!((a=(a+(b^m)-m)/2)%2)&&printf("%d",a);
}
@takapiko
takapiko / message_box_google.rb
Created March 3, 2014 08:22
message_box内の内容をgoogleで検索するmikutterプラグイン
# -*- coding: utf-8 -*-
Plugin.create :message_box_google do
command(:message_box_google,
name: 'メッセージボックスの内容をぐぐる',
condition: lambda{ |opt| true },
visible: true,
role: :postbox)do |opt|
baseurl = 'https://www.google.co.jp/#q='
str = Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text
Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text = ""
@takapiko
takapiko / makopero.rb
Last active August 29, 2015 13:56
mikutterでまこぺろ阻止
# -*- coding: utf-8 -*-
Plugin.create :makopero do
on_appear do |ms|
ms.each do |m|
if m.message.to_s =~ /まこぺろ/ && !(m.user.is_me?)
Service.primary.post(:message => "#{"@" + m.user.idname + "阻止"}", :replyto => m)
m.message.favorite(true)
end
end
end