Skip to content

Instantly share code, notes, and snippets.

View kmizumar's full-sized avatar

Kiyoshi Mizumaru kmizumar

  • Tokyo, Japan
  • 10:06 (UTC +09:00)
View GitHub Profile
@kmizumar
kmizumar / gist:2588059
Created May 3, 2012 18:48
日付関連
long gepoch(int y, int m, int d) {
y += 4800;
if (m < 3) --y, m += 12;
return 365L*y+y/4-y/100+y/400+(153*m-457)/5+d-32045;
}
long jepoch(int y, int m, int d) {
y += 4716;
if (m < 3) --y, m += 12;
return 365L*y+y/4+(153*month-457)/5+day-1402;
}
@kmizumar
kmizumar / gist:2621007
Created May 6, 2012 08:08
ext/tls/ssltest.log (10db485ca61e02e06a3ff0851ca1cff27958f5c0)
lolouila:maru% cat ext/tls/ssltest.log [~/github/Gauche]
All AES tests passed
All RC4 tests passed
All MD5 tests passed
All SHA1 tests passed
All HMAC tests passed
All BIGINT tests passed
All RSA tests passed
Error: Invalid X509 ASN.1 file (Unsupported digest)
Error: Invalid X509 ASN.1 file (Unsupported digest)
@kmizumar
kmizumar / gist:2766274
Created May 22, 2012 03:07
reverse linked list
public class Node {
public Node next;
public String label;
public Node(String label, Node next) {
this.label = label;
this.next = next;
}
public void dump() {
@kmizumar
kmizumar / split.scm
Created June 28, 2012 14:40
text file splitter
#!/usr/bin/env gosh
(use gauche.parseopt)
(use math.mt-random)
(use util.match)
(define (p . args) (for-each print args))
(define (usage)
(p (format #f "Usage: ~a srcfile ratio trainfile testfile" *program-name*)
@kmizumar
kmizumar / build.xml
Created July 30, 2012 01:50
old build.xml for SSS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="mapreduce" default="jar" basedir="./">
<taskdef resource="testngtasks" classpath="lib/testng-6.0.1.jar"/>
<property file="build.properties" />
<property name="base.src" value="${basedir}/src/base"/>
<property name="benchmark.src" value="${basedir}/src/benchmark/"/>
@kmizumar
kmizumar / fizzbuzz.scm
Created August 9, 2012 14:56
FizzBuzz
#!/usr/bin/env gosh
(use gauche.generator)
(use slib)
(require 'format)
(define (main args)
(let ((mod3 (circular-generator #f #f #t))
(mod5 (circular-generator #f #f #f #f #t))
(nums (giota 100 1)))
(do-generator [out (gmap
@kmizumar
kmizumar / gist:4450218
Created January 4, 2013 05:41
MacPorts's Portfile for Gauche HEAD
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 96552 2012-08-14 04:32:45Z [email protected] $
PortSystem 1.0
name gauche-devel
version 0.9.4_pre2
categories lang scheme
license BSD
maintainers gmail.com:kiyoshi.mizumaru
select a.row_num as row, b.col_num as col, sum(a.value * b.value) as val
from a, b
where a.col_num = b.row_num
group by a.row_num, b.col_num
;
@kmizumar
kmizumar / tbcsv.scm
Created January 9, 2015 08:05
create a report from csv
#!/usr/bin/env gosh
;;
;; tokyobench csv output report
;;
(use gauche.parseopt)
(use gauche.record)
(use slib)
(use text.csv)
(use util.match)
@kmizumar
kmizumar / sblog.scm
Created January 9, 2015 08:09
create report from sss server log
#!/usr/bin/env gosh
;;
;; sss server log output report
;;
(use gauche.parseopt)
(use gauche.record)
(use slib)
(use text.csv)
(use util.match)