Skip to content

Instantly share code, notes, and snippets.

View kubo39's full-sized avatar
💭
I may be slow to respond.

Hiroki Noda kubo39

💭
I may be slow to respond.
  • Tokyo, Japan
  • 13:36 (UTC +09:00)
View GitHub Profile
$ spin -a lock.spin
$ gcc -o pan pan.c
$ ./pan
(Spin Version 6.4.6 -- 2 December 2016)
+ Partial Order Reduction
Full statespace search for:
never claim - (none specified)
assertion violations +
  • DMD
$ dmd --version
DMD64 D Compiler v2.074.0
Copyright (c) 1999-2017 by Digital Mars written by Walter Bright
$ dmd -O -c hoge.d
$ objdump -Mintel -d hoge.o
...
   b:   49 89 fd                mov    r13,rdi
import core.sys.linux.epoll;
import std.stdio;
import core.stdc.errno;
import std.exception : errnoEnforce;
void main()
{
epoll_event event;
event.events = EPOLLIN;
auto epfd = epoll_create1(EPOLL_CLOEXEC);
module parser;
import lexer : Lexer, Token, TokenType;
class ParserError : Exception
{
public:
this(string message,
string file =__FILE__,
@kubo39
kubo39 / opIndexTut.d
Last active December 3, 2015 18:40
Operator Oveloading (compared with http://qiita.com/szktty/items/9fa3b972fbdae7aaa0ef)
import std.stdio : writeln;
class Company
{
Employee[] employees;
auto opOpAssign(string op)(Employee employee) if (op == "~")
{
employees ~= employee;
}
@kubo39
kubo39 / kubo-zsh.zsh
Last active August 29, 2015 14:17 — forked from anonymous/kubo-zsh.zsh
# emacsキーバインドを使用
bindkey -e
setopt ignore_eof
# 補完
setopt COMPLETE_IN_WORD
# コピペ時PROMPTを消す
setopt TRANSIENT_RPROMPT
uint inner_nqueen(int all_bits, int left, int depth, int right) pure nothrow @safe @nogc
{
int results, bitmap = ~(left | depth | right) & all_bits;
while (bitmap != 0) {
int last_bit = -bitmap & bitmap;
bitmap ^= last_bit;
results += inner_nqueen(all_bits, (left | last_bit) << 1, depth | last_bit, (right | last_bit) >> 1);
}
return results + (depth == all_bits ? 1 : 0);
}
@kubo39
kubo39 / bytearr.go
Created May 5, 2014 16:40
go tips for byte-magic array
package main
import "fmt"
var noEscape = [256]bool{
'A': true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
'a': true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
'0': true, true, true, true, true, true, true, true, true, true,
'-': true,
'.': true,
@kubo39
kubo39 / Makefile
Created December 12, 2013 11:32
experimental ruby from go (work in progress)
RUBY := ruby
RUBY_CFLAGS := $(shell $(RUBY) -e "puts RbConfig::CONFIG['rubyhdrdir'] + ' -I' + RbConfig::CONFIG['rubyarchhdrdir']")
RUBY_LDFLAGS := $(shell $(RUBY) -e "puts '-L' + RbConfig::CONFIG['rubylibdir']")
CGO_LDFLAGS := "$(RUBY_LDFLAGS)"
CGO_CFLAGS := "-I$(RUBY_CFLAGS)"
# default to gc, but allow caller to override on command line
GO_COMPILER:=$(GC)
ifeq ($(GO_COMPILER),)
@kubo39
kubo39 / paiza_problem1.d
Created December 8, 2013 02:43
paiza problem
import std.algorithm, std.conv, std.stdio, std.string;
void main() {
string[] arr = stdin.readln.strip.split(" ");
int num = arr[0].to!int;
int days = arr[1].to!int;
int[] prices;