Skip to content

Instantly share code, notes, and snippets.

Avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
View gist:a5f823a0ef30bef0c38b
Verifying that +ymnk is my openname (Bitcoin username). https://onename.io/ymnk
View ECCKeyAgreement.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");
View README
http://devtesting.jp/tddbc/?TDDBC%E4%BB%99%E5%8F%B003/%E8%AA%B2%E9%A1%8C
View Interval.java
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;
View geolocation.html
<html>
<head>
<script type="text/javascript">
<!--
// Geolocation API[1] を使って、
// 開始地点と現在地の緯度・経度、及び両者の差を表示するためのプログラム
// [1] http://en.wikipedia.org/wiki/W3C_Geolocation_API
// 開始地点の緯度・経度を保持する変数
var start_latitude;
View Shell.java
/* -*-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 Jan 10, 2020
JSch examples
View AES.java
/* -*-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{
View gist:1432802
$ 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 Nov 5, 2011
OOME on jruby caused by zlib's leaked resources.
View gist:1341022
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]
View gist:1186724
require 'zlib'
dict = "hello"
str = "hello, hello!"
d = Zlib::Deflate.new
d.set_dictionary(dict)
comp_str = d.deflate(str)
comp_str << d.finish