Skip to content

Instantly share code, notes, and snippets.

View masui's full-sized avatar

Toshiyuki Masui masui

View GitHub Profile
@masui
masui / bing_search
Created January 10, 2015 13:42
Bingで画像検索
@masui
masui / Nexus6
Created January 9, 2015 14:06
Nexus6が発売されたら通知する
system "wget -O /tmp/nexus6 https://play.google.com/store/devices/details/Nexus_6_64_GB_%E3%83%80%E3%83%BC%E3%82%AF%E3%83%96%E3%83%AB%E3%83%BC?id=nexus_6_blue_64gb"
res = system "grep '近日発売' /tmp/nexus6 > /dev/null"
unless res
system "echo 'Nexus6 is out.' | mail masui@pitecan.com"
system "echo 'Nexus6 is out.' | mail masui@masui.org"
end
@masui
masui / gist:6ec408cc5129a7919f58
Created November 29, 2014 04:34
Nexus6が発売されたら通知する
# -*- coding: utf-8 -*-
system "wget -O /tmp/nexus6 https://play.google.com/store/devices/details/Nexus_6_64_GB_%E3%83%80%E3%83%BC%E3%82%AF%E3%83%96%E3%83%AB%E3%83%BC?id=nexus_6_blue_64gb"
res = system "grep '近日発売' /tmp/nexus6 > /dev/null"
unless res
system "echo 'Nexus6 is out.' | mail masui@pitecan.com"
system "echo 'Nexus6 is out.' | mail masui@masui.org"
end
@masui
masui / defaultbrowser.rb
Created November 4, 2014 03:25
Macのデフォルトブラウザを知る
`defaults read com.apple.LaunchServices | grep -C3 'LSHandlerURLScheme = http;' | grep LSHandlerRoleAll | uniq` =~ /"(.*)"/
browser =
case $1
when /safari/i then "Safari"
when /chrome/i then "Chrome"
else "Firefox"
end
@masui
masui / gist:7a6713831d9ee9808b96
Created November 3, 2014 04:37
GyazoりつつWebページを推薦するスクリプト
# -*- coding: utf-8 -*-
require 'open-uri'
require 'nokogiri'
require 'httparty'
require 'net/http'
require 'uri'
#
# FirefoxをアクティブにしてURLを取得
function (ev, arg) {
var document = window.content.document;
var location = encodeURIComponent(document.location);
var title = encodeURIComponent(document.title);
var win = window.open('http://gyazz.masuilab.org/__write?name=osusume&title='+title+'&data=[['+location+']]');
win.close();
}
@masui
masui / png.coffee
Created July 13, 2014 12:11
自力でPNGを作成する
#
# PNGを自力で生成する (masui 2014/07/13 14:26:29)
#
# こういう感じのRGB配列をPNGにする
# data = [
# [[0, 0, 0], [100, 100, 100], [200, 200, 200]],
# [[0, 0, 0], [100, 100, 100], [200, 200, 200]],
# [[0, 0, 0], [100, 100, 100], [200, 200, 200]]
# ]
#
require 'gyazz'
re = []
wiki = Gyazz.wiki('EpisoPassData')
wiki.pages.each do |page|
page.text.split(/\n/).each { |line|
if line =~ /^=(.*)$/ then
s = $1.sub(/\?$/,'')
re << s
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>title</title>
<script language="JavaScript" src="test.js"></script>
<script type="text/javascript">
alert(100);
</script>
<link rel="stylesheet" href="test.css" type="text/css">
<style type="text/css">
@masui
masui / swap()
Created January 29, 2014 06:09
一時変数を使わず変数の内容を交換する
#define swap(a,b) (a = a ^ b; b = a ^ b; a = a ^ b;)