Skip to content

Instantly share code, notes, and snippets.

View hbhutta's full-sized avatar
🎯
Focusing

Haad Bhutta hbhutta

🎯
Focusing
View GitHub Profile
class Dequeue() {
/**
Construct a dequeue of the form:
B F
---------------------
e/d e/d
---------------------
*/
private queue: number[];
@hbhutta
hbhutta / minmax.ts
Created March 8, 2025 22:16
min and max in js/ts using reduce
function max(nums: number[]): number {
return nums.reduce((p,v) => {return p>v? p:v;})
}
function min(nums: number[]): number {
return nums.reduce((p,v) => {return p<v? p:v;})
}
@hbhutta
hbhutta / binarysearch.ts
Created March 4, 2025 20:57
Iterative and recursive implementations of binary search
function binarySearch(numbers: number[], target: number): number {
let low: number = 0;
let high: number = numbers.length - 1;
while (low <= high) {
let mid = Math.floor((low + high) / 2);
if (target < numbers[mid]) {
high = mid - 1;
} else if (target > numbers[mid]) {
low = mid + 1;
@hbhutta
hbhutta / rnaseq_utils.R
Last active December 23, 2024 18:22
A suite of R functions for repetitive bulk RNAseq procedures which I wrote while working as a data analyst at a hospital.
library(limma)
library(edgeR)
library(sva)
library(ggplot2)
library(tidyr)
library(broom)
library(dplyr)
library(ggpubr)
library(biomaRt)
options(stringsAsFactors = F)
@hbhutta
hbhutta / tch.py
Created December 28, 2023 00:09
Python script to get cities from TransCanadaHighway (TCH) website
import requests
from bs4 import BeautifulSoup
from time import sleep
import json
from pprint import pprint
import re
def find_phone_numbers(text: str) -> list[str]:
pattern = re.compile(r'\b\d{3}-\d{3}-\d{4}')
phone_numbers = re.findall(pattern, text)