Skip to content

Instantly share code, notes, and snippets.

@syusui-s
syusui-s / index.erb
Last active August 29, 2015 14:00
サンプル02: 簡単に掲示板っぽいの作れるよというサンプル.XSSの対策は全くやってない.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>BBS一覧</title>
</head>
<body>
<h1>ひとこと掲示板</h1>
<div id="form">
<form action="/" method="post">
@syusui-s
syusui-s / interpret.rb
Created May 10, 2014 08:35
インタプリタっぽいのを実現する
class Interpret
def initialize
@handlers = []
return self
end
def on(regexp, &process)
handler = { regexp: regexp, proc: process }
@handlers << handler
@syusui-s
syusui-s / Makefile
Created May 14, 2014 10:13
マイクファッイル pandoc, platex, dvipdfmx, convert, inkscape依存
PANDOC = pandoc
PLATEX = platex
DVIPDFMX = dvipdfmx
CONVERT = convert
INKSCAPE = inkscape
OPTIONS = -s -N --no-highlight --variable=documentclass:jreport --variable=papersize:a4j
TOFORMAT = -t latex
PDFNAME = 1st_report.pdf
DVINAME = 1st_report.dvi
TEXNAME = 1st_report.tex
@syusui-s
syusui-s / result.txt
Last active August 29, 2015 14:01
仮想デストラクタのサンプルコード
new Base -----------------
Base Constructor
Base Destructor: Address is 0x241a010. Size is 8.
new Derived --------------
Base Constructor
Derived Constructor
Derived Destructor: Address is 0x241a010. Size is 24.
Base Destructor: Address is 0x241a010. Size is 8.
@syusui-s
syusui-s / mikutter_multi_fav.rb
Last active August 29, 2015 14:01
複数アカウントふぁぼプラグイン for mikutter 3.x.気が向いたら,Gitリポジトリにします.
Plugin.create :multi_fav do
def service_select_dialog
dialog = Gtk::Dialog.new(
nil,
nil,
Gtk::Dialog::DESTROY_WITH_PARENT,
['Favorite', Gtk::Dialog::RESPONSE_OK],
['Favorite', Gtk::Dialog::RESPONSE_CANCEL]
)
@syusui-s
syusui-s / mikutter_multi_home.rb
Last active August 29, 2015 14:01
mikutterのホームタイムラインをアカウント分だけ作るプラグイン for mikutter 3.0.1537
# -*- coding: utf-8 -*-
Plugin.create :multi_timeline do
Service.services.each do |svc|
timeline_name = "home_timeline_#{svc.idname}".to_sym
tab timeline_name, "Home Timeline" + " (#{svc.idname})" do
set_icon svc.user_obj[:profile_image_url]
timeline timeline_name end
@syusui-s
syusui-s / 14pin-unit.sym
Last active August 29, 2015 14:02
某実験機器のgschem用Symbol.図のライセンスはパブリックドメイン(CC0ライセンス)です.( http://creativecommons.org/publicdomain/zero/1.0/ ,日本語訳ドラフト: http://creativecommons.jp/weblog/2013/11/5065/ )
v 20130925 2
B 0 0 2300 4100 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
P 2100 500 2200 500 1 0 0
{
T 2100 500 5 10 0 0 180 6 1
pintype=unknown
T 2205 645 5 10 1 1 0 6 1
pinnumber=1
T 2100 500 5 10 0 0 180 6 1
pinseq=0
@syusui-s
syusui-s / Yo.rb
Created June 24, 2014 06:48
Yo.rb - Yo API wrapper for Ruby
require 'net/http'
class Yo
API_URI = URI.parse('http://www.justyo.co/yoall/')
def initialize(api_token)
@token = api_token
end
def yo
@syusui-s
syusui-s / amida.rb
Created July 20, 2014 03:12
AMIDA WriteUp by Ruby #seccon
# do amida
def amida(matrix, pos)
matrix.each{|row|
if row[pos-2] == "-" && pos > 1 then pos -= 1
elsif row[pos-1] == "-" && pos < 8 then pos += 1
end
}
return pos
end
@syusui-s
syusui-s / twitpic_downloader.rb
Last active August 29, 2015 14:06
Twitpic閉鎖されるらしいので,Twitpicの画像を全部保存してくれるスクリプト作った.Public Domainです.multithreadは同時ダウンロード版です.
# -*- coding: utf-8 -*-
require 'net/http'
require 'json'
require 'nokogiri'
print "Type username > "
username = gets.delete(" \n\r\t")
images = []
page = 1