Skip to content

Instantly share code, notes, and snippets.

View tusqasi's full-sized avatar

Tushar Kuntawar tusqasi

View GitHub Profile
@tusqasi
tusqasi / template.c
Created January 10, 2024 16:59
Raylib starting template for stuff
#include "raylib.h"
#include <stdlib.h>
#define WIDTH 1000
#define HEIGHT 800
#define FPS 120
int main(void) {
InitWindow(WIDTH, HEIGHT, "raylib [core] example - basic window");
SetTargetFPS(FPS); // Set our graphics to run at 60 frames-per-second
import requests
import multiprocessing
def get_paper_for_year(year):
data = requests.get(
f"https://gate.iitkgp.ac.in/documents/gatepapers/{year}/ec_{year}.pdf")
with open(f"/tmp/gate_paper/{year}.pdf", mode='wb') as fp:
fp.write(data.content)
# Run the below command to download all the deps
## pip install request
import requests
for year in range(2007, 2022):
data = requests.get(
f"https://gate.iitkgp.ac.in/documents/gatepapers/{year}/ec_{year}.pdf")
with open(f"{year}.pdf", mode='wb') as fp:
fp.write(data.content)
import java.util.HashMap;
public class factorial {
private static double sqrt5 = Math.sqrt(5);
private static double Phi = (1 - sqrt5) / 2;
private static double phi = (1 + sqrt5) / 2;
public static boolean isInteger(String s) {
return isInteger(s, 10);
227,227,227,227,227,227,227,228,227,227,227,226,227,226,224,222,249,302,368,439,470,433,312,217,188,217,231,221,224,230,223,217,225,229,222,221,232,235,226,228,241,243,237,241,249,246,241,245,250,243,239,249,253,243,238,250,257,248,246,259,264,256,255,266,267,258,262,273,269,260,267,273,265,256,259,258,242,236,241,237,225,225,233,230,222,224,231,228,224,228,233,231,229,233,235,230,230,237,239,232,232,238,236,230,236,244,237,230,235,242,237,233,238,244,237,232,239,242,232,229,241,244,233,233,244,244,234,241,256,263,262,269,277,268,264,278,281,268,261,266,263,248,242,242,237,229,231,238,234,227,232,239,234,231,238,239,228,223,241,272,316,396,485,493,384,258,204,204,224,233,236,226,216,221,226,221,219,227,231,226,227,237,240,233,235,245,243,235,235,242,242,237,243,251,248,246,253,260,257,257,265,266,263,270,281,275,264,275,300,299,271,261,268,271,270,276,273,258,249,250,247,235,231,234,230,223,224,230,228,223,228,234,231,227,234,238,233,231,237,242,237,237,243,242,238,239,245,244,241,245,250,247,241,246,249,247,
@tusqasi
tusqasi / Web Technologies.md
Last active June 2, 2023 11:10
Now that I am writing about web tech I'll just make it here
@tusqasi
tusqasi / file_receiver_server.js
Last active April 20, 2023 06:23
Basic server which can receive files over post request
const express = require('express');
const multer = require('multer');
const cors = require('cors');
// const sqlite3 = require("sqlite3").verbose();
const axios = require('axios');
const app = express();
app.use(cors());
// app.use(express.static("uploads"));
let reconnects = 0;
let socket;
function connectWebsocket(url) {
socket = new WebSocket(url);
socket.onmessage = function onmessage_callback(message) {
// recieve messages here
};
socket.onopen = function onopen_callback() {
console.log("Connected to: " + socket.url);
@tusqasi
tusqasi / Stacks.c
Created December 22, 2022 12:57
Just implementing stacks
#include <stdio.h>
#include <stdlib.h>
// array based stack
// stack has a size
// it has a end element pointer. That is pretty much it
typedef enum { F, T } boolean;
typedef struct stack {
@tusqasi
tusqasi / functions_test.ex
Last active September 14, 2022 16:09
Useful Enum functions
final_val = Enum.reduce([10, 22, 84], 0, fn(x, acc) -> x + acc end)
# acc takes the value of the return of function passed to Enum.reduce
# `here fn(x,acc) -> x + acc` is the function
# 1
# fn(10, 0) returns 10
# 2
# fn(22, 10) returns 32
# 3
# fn(84, 32) returns 116