Skip to content

Instantly share code, notes, and snippets.

View atamrawi's full-sized avatar

Ahmed Tamrawi atamrawi

View GitHub Profile
@atamrawi
atamrawi / ClassLoaderLeakExample.java
Created October 25, 2020 07:15 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@atamrawi
atamrawi / COMP4384.java
Last active September 6, 2020 19:09 — forked from benjholla/SE421.java
Welcome to SE421
public class COMP4384 {
public static void main(String[] args) {
print("Hello");
/*
* TODO: print World in unicode
* \u002A\u002F\u0070\u0072\u0069\u006E\u0074\u0028\u0022\u0043\u0072\u0075\u0065\u006C\u0022\u0029\u003B\u002F\u002A
*/
print("World");
@atamrawi
atamrawi / Puzzle2.java
Last active September 8, 2018 07:34 — forked from benjholla/Puzzle4.java
Java Puzzle 2 (spot the bug if one exists)
public class Puzzle2 {
public static void main(String[] args) {
System.out.print("iexplore:");
http://www.google.com;
System.out.println(":maximize");
}
}
@atamrawi
atamrawi / Puzzle1.java
Created September 8, 2018 07:30 — forked from benjholla/Puzzle1.java
Java Puzzle 1 (spot the bug if one exists)
import java.util.Random;
public class Puzzle1 {
public static void main(String[] args) {
Random rnd = new Random();
int odds = 0;
int runs = 1000;
for(int i=0; i<runs; i++) {
int num = rnd.nextInt();