Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
who will guard the guards themselves

Cavoi Rom cavoirom

💭
who will guard the guards themselves
View GitHub Profile
View plain_java_vs_raw_reflection.java
/* Plain Java */
JUnitCore junit = new JUnitCore();
TestResultListener testResultListener = new TestResultListener();
junit.addListener(testResultListener);
junit.run(testClass);
return testResultListener.getTestResult();
/* Java Reflection */
ClassLoader testClassLoader = testClass.getClassLoader();
Class<Object> junitClass = (Class<Object>) getClass("org.junit.runner.JUnitCore", testClassLoader);
View IntLinkedList.java
package com.cavoirom.java.recursion.example;
public class IntLinkedList {
private Node first;
public IntLinkedList() {}
public void add(int data) {
Node newNode = new Node(data);
if (first == null) {
@cavoirom
cavoirom / gist:6930143
Created Oct 11, 2013
Fix GRUB: “invalid arch independent ELF magic”
View gist:6930143
Boot into Live CD and run:
(sda1 is linux partition)
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt /dev/sda