Skip to content

Instantly share code, notes, and snippets.

@sndyuk
sndyuk / qubo_tutorial.ipynb
Last active February 16, 2023 18:15
QUBO Tutorial - Quadratic unconstrained binary optimization
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package jp.co.aflac.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@sndyuk
sndyuk / README.md
Last active August 30, 2015 23:05
Rubik's Cube 3x3 Solver

Input order:

            000102
            030405
            060708
    091011 363738 272829 454647
    121314 394041 303132 484950
    151617 424344 333435 515253
            181920

212223

@sndyuk
sndyuk / CustomConstraint.java
Last active September 24, 2021 13:03
Bean Validation
package sample;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
public class User {
@NotNull @Email
public String getEmail() { return email; }
public void setEmail(String email) {
this.email = email;
}
private String email;
}
public class UserService {
@sndyuk
sndyuk / List_add_functioins.scala
Created March 20, 2013 08:29
ListとListBufferの要素を後ろに追加する処理の速度を測ってみた Scala 2.10
import java.io.PrintWriter
import scala.collection.mutable.ListBuffer
import scala.util.{ Try, Success, Failure }
object List_add_functioins extends App {
//val out = new PrintWriter("score.csv", "utf-8")
//out.println("""symbol,size,elapsed""") -> For D3js
def time[R](symbol: String, size: Int, block: => R): R = {
#!/bin/bash
echo -ne "\033[K1!\r"
sleep 1
echo -ne "\033[K2!\r"
sleep 1
echo -ne "\033[K3!\r"
(function($) {
$.fn.noClickDelay = function() {
var $wrapper = this;
var $target = this;
var moved = false;
$wrapper
.bind(
'touchstart mousedown',
function(e) {
e
@sndyuk
sndyuk / contravariantPosInType.md
Created December 16, 2012 03:24
error: covariant type T occurs in contravariant position in type ... について Scala

error: covariant type T occurs in contravariant position in type について

このクラスは定義できない:

scala> class B[+T] {
     | def f(arg: T): T = arg
     | }
<console>:9: error: covariant type T occurs in contravariant position in type T of value arg
       def f(arg: T): T = arg
@sndyuk
sndyuk / Bean.java
Created November 5, 2012 18:59
logic to determine Dao calls based on logged in user and servlet called
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Bean {
}