Skip to content

Instantly share code, notes, and snippets.

View Korilakkuma's full-sized avatar

Tomohiro IKEDA Korilakkuma

View GitHub Profile
@Korilakkuma
Korilakkuma / webgl-add-2d-context.js
Last active August 29, 2015 14:06
Adding 2D content to a WebGL context
<script type="text/javascript" src="sylvester.js"></script>
<script type="text/javascript" src="glUtils.js"></script>
<script type="text/javascript">
<!--
document.addEventListener('DOMContentLoaded', function() {
var webGL = null;
var canvas = document.querySelector('canvas');
var shaderProgram = null;
var vertexPositionAttribute = null;
var squareVerticesBuffer = null;
@Korilakkuma
Korilakkuma / webgl-animate-object.js
Last active August 29, 2015 14:06
Animating objects with WebGL
<script type="text/javascript" src="sylvester.js"></script>
<script type="text/javascript" src="glUtils.js"></script>
<script type="text/javascript">
<!--
document.addEventListener('DOMContentLoaded', function() {
var webGL = null;
var canvas = document.querySelector('canvas');
var shaderProgram = null;
var vertexPositionAttribute = null;
var vertexColorAttribute = null;
@Korilakkuma
Korilakkuma / CircleButton.as
Last active August 29, 2015 14:06
Create circle replay button
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.filters.DropShadowFilter;
public class CircleButton extends SimpleButton {
public static const STATE_UP:String = 'up';
public static const STATE_OVER:String = 'over';
@Korilakkuma
Korilakkuma / Audio3DVisualizer.js
Last active May 21, 2018 12:27
Audio 3D Visualizer
if (!window.Matrix4x4) {
window.alert('This class requires "Matrix4x4" class (matrix4x4.js) !!');
}
function Audio3DVisualizer(canvas, backgroundColors, foregroundColors) {
this.webGL = null;
this.canvas = null;
this.camera = null;
this.sonogram3DVBO = null;
@Korilakkuma
Korilakkuma / SocketClient.java
Last active August 29, 2015 14:06
Socket Client
import java.io.*;
import java.net.*;
public final class SocketClient {
private static final String SERVER_HOST = "localhost";
private static final int SERVER_PORT = 9999;
public static void main(String[] args) {
if (args.length < 1) {
System.err.println("Require at least 1 argument !!");
@Korilakkuma
Korilakkuma / SocketServer.java
Last active August 29, 2015 14:06
Socket Server
import java.util.*;
import java.io.*;
import java.net.*;
public final class SocketServer {
private static final int LISTEN_PORT = 9999;
private static final int TIMEOUT = 60000; //ms
public static void main(String[] args) {
@Korilakkuma
Korilakkuma / ChatClient.java
Last active August 29, 2015 14:06
Chat Client
import java.io.*;
import java.net.*;
public final class ChatClient {
private static final String SERVER_HOST = "localhost";
private static final String TERMINAL_MESSAGE = "quit";
private static final int BUFFER_SIZE = 4096;
public static void main(String[] args) {
if (args.length < 1) {
@Korilakkuma
Korilakkuma / ChatServer.java
Last active August 29, 2015 14:06
Chat Server
import java.util.*;
import java.io.*;
import java.net.*;
public final class ChatServer {
private static final int LISTEN_PORT = 9999;
private static final String TERMINAL_MESSAGE = "quit";
private static final int BUFFER_SIZE = 4096;
@Korilakkuma
Korilakkuma / AtomicThread.java
Last active August 29, 2015 14:07
CAS (Compare And Swap)
import java.util.concurrent.atomic.*;
public final class AtomicThread {
private static final int NUM_LOAD = 100000;
private AtomicInteger count = new AtomicInteger();
private static class Worker implements Runnable {
private AtomicThread counter = null;
public Worker(AtomicThread counter) {
@Korilakkuma
Korilakkuma / SynchronizedCounter.java
Last active August 29, 2015 14:07
synchronized method
public final class SynchronizedCounter {
private static final int NUM_LOAD = 10000;
private int count = 0;
private static class Worker implements Runnable {
private SynchronizedCounter counter = null;
public Worker(SynchronizedCounter counter) {
this.counter = counter;
}