Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
hyuki0000 / sample.txt
Created February 28, 2014 00:25
Tiny Vim help file.
*sample.txt*
sample.txt
*hyuki*
hyuki
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:
@hyuki0000
hyuki0000 / verbatim.rb
Created February 22, 2014 07:44
An Octopress plugin that renders the given content 'as is'.
# Input:
# {% verbatim tag:p %}
# $$a_1, a_2, a_3, \ldots$$
# {% endverbatim %}
#
# Output:
# <p>$$a_1, a_2, a_3, \ldots$$</p>
#
# Author: Hiroshi Yuki.
# Description: The content between {% verbatim %} and {% endverbatim %} would be rendered 'as is'.
@hyuki0000
hyuki0000 / gemstring.c
Created February 13, 2014 23:43
《ジェムストリング問題》の参考プログラム
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int ar[] = { /* 1.41421356 */
1,
2, 2, 2, 2,
3,
4, 4, 4, 4,
5, 5,
" NeoBundle
" https://github.com/Shougo/neobundle.vim
" cf. http://qiita.com/puriketu99/items/1c32d3f24cc2919203eb
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle/'))
endif
@hyuki0000
hyuki0000 / days.pl
Created January 18, 2014 11:11
今年の日付を作るスクリプト
use strict;
use warnings;
my @days = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
for my $month (1..12) {
for my $day (1..$days[$month - 1]) {
print "2014/$month/$day\n";
}
}

Where were you?

This tiny app ("Where were you?") saves your current position periodically in your browser's local storage.

  • This app is under construction.
  • The append button is for debug.
  • The clear button is to delete all records.
  • The register button register current position with a assigned name.

Plan

@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|
@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 / 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 / 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