Skip to content

Instantly share code, notes, and snippets.

View ymnk's full-sized avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
Verifying that +ymnk is my openname (Bitcoin username). https://onename.io/ymnk
@ymnk
ymnk / ECCKeyAgreement.java
Last active December 19, 2023 18:35
ECC with Java
// The following code is from http://www.academicpub.org/PaperInfo.aspx?PaperID=14496 .
import java.math.BigInteger;
import java.security.*;
import java.security.spec.*;
import javax.crypto.KeyAgreement;
public class ECCKeyAgreement {
public static void main(String[] args) throws Exception {
KeyPairGenerator kpg;
kpg = KeyPairGenerator.getInstance("EC","SunEC");
@ymnk
ymnk / README
Created October 13, 2013 14:11
http://devtesting.jp/tddbc/?TDDBC%E4%BB%99%E5%8F%B003/%E8%AA%B2%E9%A1%8C
@ymnk
ymnk / Interval.java
Last active December 21, 2015 10:49
class Interval {
private Point upper;
private Point lower;
private Interval(Point lower, Point upper) {
if (lower != infinite && upper != infinite
&& !inclusive(lower.p).greater(upper.p))
throw new IllegalArgumentException(lower + " " + upper);
this.lower = lower;
<html>
<head>
<script type="text/javascript">
<!--
// Geolocation API[1] を使って、
// 開始地点と現在地の緯度・経度、及び両者の差を表示するためのプログラム
// [1] http://en.wikipedia.org/wiki/W3C_Geolocation_API
// 開始地点の緯度・経度を保持する変数
var start_latitude;
@ymnk
ymnk / Shell.java
Last active August 22, 2017 10:49
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.util.zip.GZIPInputStream;
public class Shell{
public static void main(String[] arg){
@ymnk
ymnk / AES.java
Last active July 20, 2023 15:54
JSch examples
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate how to use "aes128-cbc".
*
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
public class AES{
$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_16).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :paste
// Entering paste mode (ctrl-D to finish)
trait X {
val a = ""
@ymnk
ymnk / gist:1341022
Created November 5, 2011 02:48
OOME on jruby caused by zlib's leaked resources.
ymnk@ubuntu:~/tmp/jruby-1.6.5$ ./bin/jruby -v -e "require 'zlib'; while true; Zlib::Deflate.new; end"
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) Client VM 1.6.0_29) [linux-i386-java]
Killed
ymnk@ubuntu:~/tmp/jruby-1.6.5$ ../jruby/bin/jruby -v -e "require 'zlib'; while true; Zlib::Deflate.new; end"
jruby 1.7.0.dev (ruby-1.8.7-p330) (2011-11-04 fbeb240) (Java HotSpot(TM) Client VM 1.6.0_29) [linux-i386-java]
require 'zlib'
dict = "hello"
str = "hello, hello!"
d = Zlib::Deflate.new
d.set_dictionary(dict)
comp_str = d.deflate(str)
comp_str << d.finish