Skip to content

Instantly share code, notes, and snippets.

public class Test {
public static void main(String[] args) {
System.out.println("Hello.");
}
}
@hyuki0000
hyuki0000 / 00readme.txt
Created October 9, 2009 08:36
"Coloring Pascal's Triangle" Applet. Visit http://www.hyuki.com/math/triangle/ for its live example.
javac Triangle.java
appletviewer index.html
@hyuki0000
hyuki0000 / httpserver.rb
Created March 30, 2013 08:47
Tiny HTTP Server.
require 'webrick'
WEBrick::HTTPServer.new(
:DocumentRoot => '.',
:Port => 8013,
).start
@hyuki0000
hyuki0000 / ruby.pl
Created April 19, 2013 06:11
Try to find ruby-ed keywords that are not indexed from LaTeX files.
# ruby.pl
# カレントディレクトリの *.tex から、
# ruby{A}{B}とindex{A@B}とindex{A}を探し、
# indexされていないと思われるrubyを表示する。
use strict;
use warnings;
my %index;
my %ruby;
@hyuki0000
hyuki0000 / 000note1.tex
Last active December 18, 2015 18:29
TeXLive 2013 にして書籍をpLaTeXかけようとしたらこんなエラーになってしまった。 - Windows 7 - インストールはデフォルトのまま install-tl.bat を動かした。 - 以前は TeXLive 2012 で動かしていた。その環境は現在はない。
\documentclass{jsbook}
\begin{document}
Hello!
\end{document}
@hyuki0000
hyuki0000 / private.xml
Created July 10, 2013 15:08
private.xml for KeyRemap4MacBook to remap ESC -> ESC + EISUU and ^[ to ^[ EISUU. This is to make Kotoeri disable in vim's normal mode. Based on http://r7kamura.hatenablog.com/entry/20110217/1297910068
<?xml version="1.0"?>
<root>
<list>
<item>
<name>LeaveInsMode with EISUU(Terminal)</name>
<identifier>private.app_terminal_esc_with_eisuu</identifier>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::JIS_EISUU</autogen>
<autogen>--KeyToKey-- KeyCode::JIS_BRACKET_LEFT, VK_CONTROL, KeyCode::JIS_BRACKET_LEFT, VK_CONTROL, KeyCode::JIS_EISUU</autogen>
</item>
@hyuki0000
hyuki0000 / filetype.vim
Created July 13, 2013 00:53
A simple example for syntax coloring of ".txt" files. *Sample Sample Sample => PreProc ;Sample Sample Sample => Comment
augroup filetypedetect
au BufNewFile,BufRead *.txt setf txt
augroup END
@hyuki0000
hyuki0000 / zip_to_dropbox.rb
Created July 13, 2013 09:00
zip a dir and mv it to dropbox dir.
#!/usr/bin/env ruby
DESTDIR = "~/Dropbox/Backup"
if ARGV.length != 2
puts "Usage: zip_to_dropbox projectname srcdirname"
puts "Example: zip_to_dropbox girldoc doc"
puts "It will create #{DESTDIR}/girldoc_yyyy-mm-dd-hhmmss.zip."
abort
end
PROJECTNAME = ARGV[0]
SRCDIRNAME = ARGV[1]
@hyuki0000
hyuki0000 / Main.java
Created September 19, 2013 11:26
CodeIQ で @cielavenir 氏が出題した「リテラルを使わずにHello Worldを出力せよ」という問題への結城浩の解答です。評価5をいただきました。ありがとうございます。 https://codeiq.jp/ace/cielavenir/q431 https://github.com/cielavenir/codeiq_problems/tree/master/q431
class Hello {}
class World {}
class Main {
public static void main(String[] args) {
String h = Hello.class.getName(), w = World.class.getName();
System.out.println(h + (char)(h.length() / h.length() << w.length()) + w);
}
}
@hyuki0000
hyuki0000 / cmp.rb
Created October 31, 2013 06:46 — forked from anonymous/cmp.rb
(まちがってanonymousで作ったので自分でfork) BOOKSCANでスキャンしたPDFを全部ダウンロードしたかどうかを確認するためのスクリプト。Webページから(手動で)スクレイプした書名一覧をbookscan.txtに入れて末尾の.pdfを消す。自分のダウンロードしたファイル一覧をdropbox.txtに入れて末尾の.pdfを消す。そしてこのスクリプトを動かす。要するにファイル名中に入っているISBNを比較してるだけ。一回しか使わなかったからインタフェース適当。
bookscan = Hash.new
dropbox = Hash.new
File::open("bookscan.txt") do |f|
f.each do |line|
line.match(/_([\dX]+)$/)
bookscan[$1] = line
end
end
File::open("dropbox.txt") do |f|