Skip to content

Instantly share code, notes, and snippets.

View cavoirom's full-sized avatar
💭
who will guard the guards themselves

Cavoi Rom cavoirom

💭
who will guard the guards themselves
View GitHub Profile
/* 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);
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 October 11, 2013 05:51
Fix GRUB: “invalid arch independent ELF magic”
Boot into Live CD and run:
(sda1 is linux partition)
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt /dev/sda