Skip to content

Instantly share code, notes, and snippets.

View Zelakolase's full-sized avatar
🏠
Working from home

Zelakolase Zelakolase

🏠
Working from home
  • Ottawa
View GitHub Profile
@Zelakolase
Zelakolase / HTTP.asm
Created December 6, 2022 20:35
A login portal in NASM, HTTP Server using ChatGPT
[bits 32]
section .data
username db \"morad\", 0
username_len equ $-username
password db \"morad\", 0
password_len equ $-password
@Zelakolase
Zelakolase / server.asm
Created December 6, 2022 20:30
static web server in assembly by ChatGPT
his program is a simple web server written in assembly language.
; It will listen for incoming connections on port 80 and serve
; static web pages.
section .text
global _start
_start:
#!/usr/bin/env bash
# Exit on error
set -e
# Ensure script is running as root
if [ "$EUID" -ne 0 ]
then echo "WARN: Please run as root (sudo)"
exit 1
fi
@Zelakolase
Zelakolase / JSON.java
Created February 15, 2022 12:35
JSON to HM and vice versa
import java.util.HashMap;
import java.util.Map;
public class JSON {
public static HashMap<String, String> QHM(String Q) {
HashMap<String, String> HM = new HashMap<String, String>();
Q = Q.replaceFirst("\\{", "").substring(0, Q.length()-2); // {“user”:”x”,”pass”:”y”} -> “user”:”x”,”pass”:”y”
String[] pairs = Q.split(","); // ["user":"x" , "pass":"y"]
for(int i = 0;i < pairs.length;i++) {
String[] pair = pairs[i].split(":"); // "user" , "x"
public List<byte[]> tokens(byte[] array, byte[] delimiter) {
List<byte[]> byteArrays = new LinkedList<>();
int begin = 0;
outer: for (int i = 0; i < array.length - delimiter.length + 1; i++) {
for (int j = 0; j < delimiter.length; j++) {
if (array[i + j] != delimiter[j]) {
continue outer;
}
}
@Zelakolase
Zelakolase / DTFromID.java
Created November 15, 2021 11:58
National ID to get data from
import java.util.HashMap;
public class DTFromID {
static HashMap<String, String> GovIDMap = new HashMap<String, String>(){
{
put("01","Cairo"); put("02","Alexandria"); put("03","Portsaid"); put("04","Suez"); put("11","Damietta"); put("12","Daqahlia"); put("13","Sharkia"); put("14","Qalyobia"); put("15","Kafr El-sheikh");
put("16","Gharbia"); put("17","Monufia"); put("18","Beheira"); put("19","Ismailia"); put("21","Giza"); put("22","Bani Suef"); put("23","Fayum"); put("24","Menya"); put("25","Asuit");
put("27","Qena"); put("28","Aswan"); put("29","Luxor"); put("31","Red Sea"); put("32","Alwady Algaded"); put("33","Matrouh"); put("34","North Sinai"); put("35","South Sinai"); put("88","N/A");
}
};
/*
* This code proofs my own proof of collatz, on Sunday Oct.24 2021 at 2:52AM Cairo Local Time
* Since 4,2,1 is a ending hole for any positive number, it belongs to f(x) = 2 ^ x
* Since x can go to infinity, any number that lands on the series of 2 ^ x can also go infinity.
* for example, 138829902545689665 falls to 16 (which belongs to 2^x series) after 384 iterations.
*/
public class CollatzProof {
public static void main(String[] args) {
long numberStart = 92233720368547758L; // HUGE TIT- I MEAN NUMBER
@Zelakolase
Zelakolase / UnaryAI.java
Created September 13, 2021 21:36
This program makes a AI Logical network for 2 unary logical gates.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class UnaryAI {
/*
* AI using Unary Logical Gates
* Dataset in hashmap goes to a train function, iterate to PatternFinder, test
*/
public static void main(String[] args) {
@Zelakolase
Zelakolase / sine.java
Last active August 27, 2021 10:43
sine function btw
public class sine {
/*
* This Class does sine function without any need to use Math.sin
* @author Morad A.
*/
static double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679d;
public static void main(String[] args) {
System.out.printf("%.19f\n",sin(30d)); // print the result to 19 decimal places of sin(30 deg.)
}
/*
package lib;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.math.BigInteger;
import java.util.Random;
public class DH {
public static String Server(DataInputStream DIS , DataOutputStream DOS) {
String secret = "";