Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmed Tamrawi atamrawi

View GitHub Profile
@atamrawi
atamrawi / problem3.c
Created Oct 28, 2020
Assignment 4 - Problem 3
View problem3.c
#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 / problem2.c
Created Oct 28, 2020
Assignment 4 - Problem 2
View problem2.c
#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 / ClassLoaderLeakExample.java
Created Oct 25, 2020 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
View ClassLoaderLeakExample.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 / CrackMe.java
Created Sep 25, 2020
Assignment 2 - Problem 3 Source Code
View CrackMe.java
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 / problem2.c
Last active Sep 25, 2020
Assignment 2 - Problem 2 Source Code
View problem2.c
#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 / problem1.c
Created Sep 25, 2020
Assignment 2 - Problem 1 Source Code
View problem1.c
#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 Sep 6, 2020 — forked from benjholla/SE421.java
Welcome to SE421
View COMP4384.java
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 / StringPermutator.java
Created Dec 11, 2019
SWEN 6301 - Assignment 4 - Problem 1
View StringPermutator.java
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 Apr 26, 2021
A sample code to go with Problem 3 of SWEN 6301 Assignment 4.
View SensorDataProcessor.java
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 / Puzzle2.java
Last active Sep 8, 2018 — forked from benjholla/Puzzle4.java
Java Puzzle 2 (spot the bug if one exists)
View Puzzle2.java
public class Puzzle2 {
public static void main(String[] args) {
System.out.print("iexplore:");
http://www.google.com;
System.out.println(":maximize");
}
}