Skip to content

Instantly share code, notes, and snippets.

View Noble-Mushtak's full-sized avatar

Noble Mushtak Noble-Mushtak

View GitHub Profile

Keybase proof

I hereby claim:

  • I am noble-mushtak on github.
  • I am noble_mushtak (https://keybase.io/noble_mushtak) on keybase.
  • I have a public key ASCsHlXlReAN4kt5-ZDKSu1CVpGbledExE8CN3L9pupj6go

To claim this, I am signing this object:

def hexc2dec(bufp):
"""
Returns the decimal value of bufp[1:5],
where bufp[1:5] is the hexadecimal representation of a 16-bit number
in two's complement.
"""
# This variable accumulates our final answer
newval = 0
divvy = 4096
@Noble-Mushtak
Noble-Mushtak / check_course.py
Created January 16, 2021 03:08
Python script to find out who has taught previous Northeastern courses.
"""
Script to find out who has taught previous Northeastern courses.
Prerequisites:
- Have Python bindings for Selenium installed (https://selenium-python.readthedocs.io/)
- Have chromedriver installed and in PATH environment variable (http://chromedriver.storage.googleapis.com/index.html)
Usage: python3 check_course.py `subject_name` `subject_code` `course_number`
Examples:
@Noble-Mushtak
Noble-Mushtak / calc_putnam_places.py
Created January 15, 2021 03:07
Calculate the place corresponding to every possible score in the Putnam 2019 competition
"""
Usage: python3 calc_putnam_places.py [score]
If score is not provided,
the script prints the place corresponding to every score
any Putnam competitor got in the Putnam 2019 competition.
If score is provided and is an integer,
the script prints the place corresponding to that score.
"""
@Noble-Mushtak
Noble-Mushtak / ackermann.py
Last active December 2, 2019 14:28
Iterative Implementation of Ackermann Function
import unittest
UNKNOWN = None
def ackermann(m, n):
last_answer = None
stack = []
stack.append((m, n))
while len(stack) > 0:
@Noble-Mushtak
Noble-Mushtak / Markov.hs
Last active July 30, 2019 23:29 — forked from atcol/Markov.hs
Fixed bugs in simple tri-state Markov Chain generator
#!/usr/bin/env stack
-- stack --resolver lts-13.30 script --package random
import Control.Monad (foldM)
import Data.List (elemIndex, minimumBy)
import Data.Maybe (fromMaybe)
import Debug.Trace (trace)
import System.IO (getLine)
import System.Random (randomIO, randomRIO)
@Noble-Mushtak
Noble-Mushtak / mouse_keys_simulator.c
Last active August 5, 2019 15:05
Emulates Mouse Keys and uses 0/period on numpad to slow/speed up mouse movements
//Based off https://gist.github.com/matthewaveryusa/a721aad80ae89a5c69f7c964fa20fec1 and https://www.kernel.org/doc/html/latest/input/uinput.html
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
from math import pi, sqrt, atan2, asin
def count_collisions(ratio):
masses = [1, ratio]
vels = [0, -1]
collisions = 0
angles = []
while vels[0] < 0 or vels[1] < vels[0]:
collisions += 1
% Finds min between two numbers.
min_nums(X,Y,X) :- X =< Y.
min_nums(X,Y,Y) :- Y =< X.
% Finds min of list.
% Obviously, if there's only one item, then that's the minimum.
min([Item|[]],Item).
% If there's more than one item, find the minimum of the tail,
% then take the minimum of the tail's minimum and the head element.
min([Head|Tail],Min) :-
@Noble-Mushtak
Noble-Mushtak / .gitignore
Last active June 21, 2017 22:18
Qt Widgets Application for Four-Function Calculator
calculator.pro.user