Skip to content

Instantly share code, notes, and snippets.

View Geek8080's full-sized avatar
:electron:
Exploring

Prashant Prakash Geek8080

:electron:
Exploring
View GitHub Profile
@Geek8080
Geek8080 / System Design.md
Created November 2, 2020 12:20 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@Geek8080
Geek8080 / public-stun-list.txt
Created October 4, 2020 17:25 — forked from mondain/public-stun-list.txt
Public STUN server list
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
@Geek8080
Geek8080 / ASCIIArt.java
Last active June 29, 2020 11:49
Create txt file with the ASCII art of an image or text.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.awt.*;
import java.awt.image.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import javax.imageio.ImageIO;
public class ASCIIArt {
@Geek8080
Geek8080 / ImageResize.java
Created June 29, 2020 11:10
Use the resImage() meyhod to resize image while maintaining the aspect ratio.
import java.awt.*;
import java.awt.image.*;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.ImageInputStream;
@Geek8080
Geek8080 / HttpRequest.java
Created June 7, 2020 11:41
Java Program to run a Web Server on loac machine to serve clients making HTTP requests.
import java.io.*;
import java.net.*;
import java.util.*;
final class HttpRequest implements Runnable {
final static String CRLF = "\r\n";
Socket socket;
// Constructor
public HttpRequest(Socket socket) throws Exception {
@Geek8080
Geek8080 / UDPClient.java
Last active June 7, 2020 11:16
Connects to a UDP server running on the local machine on port: 8500 and allows message exchange.
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Scanner;
public class UDPClient {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
@Geek8080
Geek8080 / UDPServer.java
Created June 7, 2020 11:13
Starts a UDP server on port 8500 on local machine.
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.util.Arrays;
public class UDPServer {
public static void main(String[] args) throws Exception {
DatagramSocket datagramSocket = new DatagramSocket(8500);
byte receivedMessage[] = new byte[65536];
DatagramPacket datagramPacket = null;
@Geek8080
Geek8080 / TCPClient.java
Created June 7, 2020 11:11
Establishes connection to the TCP server running on the same machine on port: 10240 and allows exchanging messages between the server and client.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.net.Socket;
public class TCPClient {
public static void main(String[] args) throws Exception {
Socket server = new Socket("127.0.0.1", 10240);
@Geek8080
Geek8080 / TCPServer.java
Last active June 7, 2020 11:09
Starts a TCP server on port 10240 on local machine.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class TCPServer {
public static void main(String[] args) throws Exception {
ServerSocket serverSocket = new ServerSocket(10240);
@Geek8080
Geek8080 / Arbitrage.java
Created June 2, 2020 07:04
Java code for finding profitable arbitrage.
import java.util.*;
public class Arbitrage {
public static int nov;
public static double dist[];
public static int parent[];
static{
nov = 5;