Skip to content

Instantly share code, notes, and snippets.

View atamrawi's full-sized avatar

Ahmed Tamrawi atamrawi

View GitHub Profile
@atamrawi
atamrawi / StringPermutator.java
Created December 11, 2019 10:34
SWEN 6301 - Assignment 4 - Problem 1
import java.util.Scanner;
public class StringPermutator {
public static void permutate(String string) {
int [] factorials = new int[string.length()+1];
factorials[0] = 1;
for (int i = 1; i<=string.length();i++) {
factorials[i] = factorials[i-1] * i;
}
@atamrawi
atamrawi / SensorDataProcessor.java
Last active April 26, 2021 18:19
A sample code to go with Problem 3 of SWEN 6301 Assignment 4.
public class SensorDataProcessor{
// Senson data and limits.
public double[][][] data;
public double[][] limit;
// constructor
public DataProcessor(double[][][] data, double[][] limit) {
this.data = data;
this.limit = limit;
@atamrawi
atamrawi / problem2.c
Created October 28, 2020 19:39
Assignment 4 - Problem 2
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
@atamrawi
atamrawi / problem3.c
Created October 28, 2020 20:19
Assignment 4 - Problem 3
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <stdio.h>
struct auth {
char name[32];
int auth;
};
@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 / problem2.c
Last active September 25, 2020 12:22
Assignment 2 - Problem 2 Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
int con;
con = 0;
int account_balance = 1100;
while(con == 0){
printf("=========================================\n");
printf("Welcome to the Store - (World's Most Secure Purchasing App) \n");
@atamrawi
atamrawi / CrackMe.java
Created September 25, 2020 12:09
Assignment 2 - Problem 3 Source Code
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
public class CrackMe {
public static void main(String[] args) throws Exception {
long sleepy = 1;
while (true) {
@atamrawi
atamrawi / problem1.c
Created September 25, 2020 11:05
Assignment 2 - Problem 1 Source Code
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
// maximum number of integers stored in buffer
const int MAX_BUF_SZ = 1024;
int srcBuffer[MAX_BUF_SZ]; // source buffer
int dstBuffer[MAX_BUF_SZ]; // destination buffer
@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");
}
}