Skip to content

Instantly share code, notes, and snippets.

View z1nc0r3's full-sized avatar
🏠
Work From Home

Lasith Manujitha z1nc0r3

🏠
Work From Home
View GitHub Profile
@z1nc0r3
z1nc0r3 / BulkLinkClicker.py
Created May 25, 2021 11:12
Check bulk of web sites for their availability.
import requests
file = open('a.txt', 'r')
lines = file.readline()
count = 1
while lines:
url = "https://{}".format(lines.strip())
try:
req = requests.get(url)
class Node {
int value;
Node next;
Node(int value) {
this.value = value;
next = null;
}
}
@z1nc0r3
z1nc0r3 / BresenhamCircle.cpp
Created February 1, 2023 03:09
Bresenham's Circle Algorithm
#include <glut.h>
#include <math.h>
#include <cmath>
int width = 600, height = 600;
int xOg = 200, yOg = 200;
int xa, ya, xb, yb;
void putPixel(int x, int y) {
glColor3f(1.0f, 1.0f, 1.0f);
@z1nc0r3
z1nc0r3 / bresenhamLine.cpp
Created February 6, 2023 19:13
Bresenham's Line Algorithm
void bresenhamLine(int x0, int y0, int x1, int y1) {
int dx = abs(x1 - x0);
int dy = abs(y1 - y0);
int x, y;
if (dx >= dy) {
int d = 2 * dy - dx;
int ds = 2 * dy;
int dt = 2 * (dy - dx);
@z1nc0r3
z1nc0r3 / ddaLine.cpp
Last active February 6, 2023 19:14
DDA Line Algorithm
void ddaLine(float xa, float ya, float xb, float yb) {
int dx = xb - xa, dy = yb - ya;
int k, steps;
float xinc, yinc, x = xa, y = ya;
if (abs(dx) > abs(dy)) {
steps = abs(dx);
}
else {
steps = abs(dy);
@z1nc0r3
z1nc0r3 / CircularLinkedList.java
Created August 27, 2022 12:16
Circular Linked List
class Node {
int value;
Node next;
Node(int value) {
this.value = value;
next = null;
}
}
@z1nc0r3
z1nc0r3 / LinkedStack.java
Created August 27, 2022 12:13
Stack using Linked List
class Node {
String data;
Node next;
Node(String data) {
this.data = data;
next = null;
}
}
@z1nc0r3
z1nc0r3 / Queue.java
Created August 27, 2022 12:14
Queue using string array
import java.util.Scanner;
public class Queue {
public int size;
public int front = 0;
public int rear = -1;
public String[] queue;
Queue(int size) {
this.size = size;
@z1nc0r3
z1nc0r3 / LinkedQueue.java
Created August 27, 2022 12:15
Queue using Linked List
import java.util.Scanner;
class Node {
Node next;
int value;
Node (int value) {
this.value = value;
}
}
@z1nc0r3
z1nc0r3 / Stack.java
Created August 27, 2022 12:12
Stack using integer Array
public class Stack {
private int[] stack;
private int arrayLength;
private int current = -1;
public Stack(int arrayLength) {
this.arrayLength = arrayLength;
stack = new int[arrayLength];
}