Skip to content

Instantly share code, notes, and snippets.

@chalos
chalos / java.policy
Created January 12, 2017 16:29
Accessing package and protected class members
grant {
permission java.lang.RuntimePermission "accessDeclaredMembers"
permission java.lang.reflection.ReflectionPermission "suppressAccessCheck"
}
@chalos
chalos / AwtHelper.java
Created January 12, 2017 14:53
Accessing package and protected class members
package java.awt
public class AwtHelper {
public static Component getChild(BorderLayout layout, String key) {
Component result = null;
if(key == BorderLayout.NORTH) result = layout.north;
else if(key == BorderLayout.SOUTH) result = layout.south;
else if(key == BorderLayout.WEST) result = layout.west;
else if(key == BorderLayout.EAST) result = layout.east;
else if(key == BorderLayout.CENTER) result = layout.center;
@chalos
chalos / BorderLayout.java
Last active January 12, 2017 14:54
Accessing package and protected class members
package java.awt;
public class BorderLayout {
...
Component north;
Component south;
Component west;
Component east;
Component center;
...
@chalos
chalos / UbuntuCongestionControlBBR.md
Last active January 6, 2017 11:06
Ubuntu using BBR
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
public class TestObject {
int g;
String h;
int[] i;
String[] j;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class TestObjectLoader {
public long create(String filename) throws Exception {
TestObject to = new TestObject();
to.randomGenerate();
System.out.println("Created Hash: " + String.valueOf( to.hashClass() ));
SerializationUtil.serialize(to, filename);
import java.io.File;
import java.lang.reflect.*;
import java.net.URL;
import java.net.URLClassLoader;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.util.ClassLoaderRepository;
import org.apache.bcel.util.ClassPath;
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@chalos
chalos / index.html
Last active August 29, 2015 14:07 — forked from max-mapper/index.html
<div><a href="http://jsforcats.com/">JS for cats</a></div>
<div><a href="https://github.com/maxogden/art-of-node#the-art-of-node">Art of Node</a></div>
<div><a href="http://github.com/substack/node-browserify"><img src="talk/browserify.png"></a></div>
<div>javascript should run everywhere</div>
<div><img src="talk/require.png"></div>
<div><img src="talk/venn.png"></div>
<div>browserify + npm = ♥</div>
<div>npm = client side + server side modules in one registry</div>
<div><a href="http://github.com/substack/browserify-handbook">browserify-handbook</a></div>
<div><a href="http://npmjs.org/browserify-adventure">browserify-adventure</a></div>
@chalos
chalos / index.html
Last active August 29, 2015 14:07 — forked from max-mapper/index.html
<div><a href="http://jsforcats.com/">JS for cats</a></div>
<div><a href="https://github.com/maxogden/art-of-node#the-art-of-node">Art of Node</a></div>
<div><a href="http://github.com/substack/node-browserify"><img src="talk/browserify.png"></a></div>
<div>javascript should run everywhere</div>
<div><img src="talk/require.png"></div>
<div><img src="talk/venn.png"></div>
<div>browserify + npm = ♥</div>
<div>npm = client side + server side modules in one registry</div>
<div><a href="http://github.com/substack/browserify-handbook">browserify-handbook</a></div>
<div><a href="http://npmjs.org/browserify-adventure">browserify-adventure</a></div>