Skip to content

Instantly share code, notes, and snippets.

@mr-fool
mr-fool / MatrixRational
Last active January 1, 2016 04:19
Rational Calculator added normalize function in the Rational classand reduce functionMatrixRational fixed shallow copy on transpose
public class MatrixRational
{
private Rational matrix [][] = new Rational[0][0]; //initialize it in case of weird errors
private Rational transpose [][] = new Rational[0][0];
public MatrixRational(int size)
{
matrix = new Rational[size][size];
for (int i = 0; i < size; i++)
@mr-fool
mr-fool / InternetDictionary
Last active January 1, 2016 04:19
A simple java Internet dictionary using HashMap
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
/** Simple /b/tard dictioanry
* @author mr-fool
* @version 0.o*/
public class InternetDictionary {
public static void main(String[] args) {
/**
* @param Create a hasmap with an intial size of 10 and the default load factor*/
@mr-fool
mr-fool / gist:8092153
Created December 23, 2013 05:36
Internet Dictionary added printing out the index Fixed the word not found issue
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Map;
/** Simple /b/tard dictioanry
* @author mr-fool
* @version 0.0*/
public class InternetDictionary {
public static void main(String[] args) {
/**
@mr-fool
mr-fool / SocketProxy
Last active January 1, 2016 15:39
Simple networking attempt
import java.net.Socket;
/**
* @author mr-fool
* @param a simple network tool*/
public class SocketProxy extends Thread {
public static void main (String[] args) {
String address = args[0];
int port = Integer.parseInt(args[1]);
@mr-fool
mr-fool / SocketProxy
Last active January 1, 2016 15:39
Another socketProxy attempt version 0.o
import java.net.Socket;
import java.util.Scanner;
import java.net.InetAddress;
/**
* @author mr-fool
* @version 0.o
* @param a simple network tool*/
public class SocketProxy extends Thread {
public static void main (String[] args) {
System.out.print("Please enter an valid ip address: ");
@mr-fool
mr-fool / ProxyChain
Last active January 1, 2016 15:49
ProxyChain using Socket only works with Socks Proxy
import java.net.Socket;
import java.util.Scanner;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
/* Socket does not like HTTP proxy, SOCKS sometimes work */
/**
* @author mr-fool
@mr-fool
mr-fool / ProxyChain
Last active January 1, 2016 16:58
ProxyChain retry
import java.net.Socket;
import java.util.Scanner;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
/**
* @author mr-fool
@mr-fool
mr-fool / birthday
Last active August 29, 2015 14:00
Assignment 2 for my intro cs classes
#Tested using Python 3.3.0
#Version 10 change from recursive to function to no-function
#Lucky number generator
#Limitation:
#if the inputs are within the range of the loops, the program will assume your inputs are correct
#Program crashs when the input is not integer
#Contains the maximum amount of days in a month
Max_Day=[31,28,31,30,31,30,31,31,30,31,30,31]
#Taking user input
@mr-fool
mr-fool / Circle
Last active August 29, 2015 14:00
Calculating the diameter, circumference and area of a circle
/*Calculate the diameter,circumference and area of a circle
Using C pi*/
/*Including Library*/
#include <math.h>
#include <stdio.h>
int main (void) {
/*Declaring the variable*/
int radius;
@mr-fool
mr-fool / Makefile
Last active August 29, 2015 14:01
A C program that draws hollow circle, hollow rectangle and hollow right triangle
allFiles: draw.c
gcc -Wall draw.c -o draw.out -lm
clean:
rm *.o draw.out