Skip to content

Instantly share code, notes, and snippets.

@raccy
raccy / .gitignore
Last active August 13, 2018 06:35
ビット列検索
data.txt
result.txt
result_*.txt
pf_*.txt
*.o
@raccy
raccy / bfc.c
Created May 23, 2018 12:42
メモリがなければファイルを使えばいいじゃない
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
static inline noreturn void die(char *msg)
{
fprintf(stderr, "%s\n", msg);
exit(1);
}
@raccy
raccy / count.c
Created December 26, 2017 15:21
ifが遅いなんて誰が言ったのだろう?
#include <stdio.h>
#include <stdlib.h>
#define LIST_MAX_LINE 10000
#define MAX_LEN 256
int same_char(const char *s, const char *t);
int main(void)
{
char *list = (char *)malloc(LIST_MAX_LINE * MAX_LEN);
@raccy
raccy / AbstractCreature.java
Last active January 8, 2017 06:36
抽象クラスを説明するためのRPGプログラム
package rpg;
public abstract class AbstractCreature implements Battlable {
private final String name;
private final int maxHP;
private int currentHP;
protected AbstractCreature(String name, int hp) {
this.name = name;
this.maxHP = hp;
this.currentHP = hp;
@raccy
raccy / Gemfile
Created July 2, 2016 12:54
喫茶店シナトラでは珈琲を二杯同時に頼んではいけない
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'puma'
gem 'sinatra'
gem 'slim'
gem 'coffee-script'
gem 'therubyracer'
@raccy
raccy / schema2ldif.rb
Created May 1, 2015 11:20
OpenLDAPのschemaをldifに変換するツール
#!/usr/bin/env ruby
# schema2ldif.rb
# Copyright (c) 2015 IGARASHI Makoto (raccy)
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
if RUBY_VERSION.split(".")[0].to_i < 2
warn "Ruby version must be over 2.0.0."
exit 2
end
@raccy
raccy / svg2icns.rb
Last active September 27, 2020 01:12
SVGファイルをMacのアイコン形式icns(Retina対応)に変換するだけ
#!/usr/bin/env ruby
# svg2icns.rb
# Copyright (c) 2015 IGARASHI Makoto (raccy)
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
# SVGファイルをMacのアイコン形式であるicnsに変換します。
# 作成されるicnsはRetina対応です。
# SVGファイルはあらかじめ正方形にしておいて下さい。
# そうじゃないと歪みます。
# 実行前に、"gem install rsvg2" しておいてください。
@raccy
raccy / kometalk.rb
Last active December 2, 2015 02:51
Viqo経由でめいちゃんにコメをしゃべって貰おうとしたら、なぜかこうなった。
#!/usr/bin/env ruby
# coding: utf-8
=begin
kometalk.rb
Copyright (c) 2015 IGARASHI Makoto (raccy)
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
コマンドラインからの入力文字をOpen JTalkでしゃべってくれます。
実行はすぐに終わって、裏でサーバが立ち上がって、しゃべります。