Skip to content

Instantly share code, notes, and snippets.

View rahulahoop's full-sized avatar
😶‍🌫️

Rahul Bhonsale rahulahoop

😶‍🌫️
View GitHub Profile
@rahulahoop
rahulahoop / day_three.gleam
Last active June 5, 2024 22:49
an awfully slow (NOW FAST!!) AOC gleam solution (2019 day 3)
import gleam/int
import gleam/io
import gleam/list
import gleam/set
import gleam/string
pub fn part_one(wire_one: List(String), wire_two: List(String)) {
let central = #(0, 0)
let assert Ok(wire_one_path) = list.rest(draw(wire_one, [central]))
let assert Ok(wire_two_path) = list.rest(draw(wire_two, [central]))
@rahulahoop
rahulahoop / lb.go
Last active February 25, 2024 00:37
go loadbalanced server
package main
import (
"context"
"fmt"
"net"
"net/http"
"time"
)
@rahulahoop
rahulahoop / mimemap.scala
Last active November 15, 2022 10:35
stateless mimetype map
// given mime types like this
//
// val input = List(
// List("txt", "plain/text"),
// List("jpg,jpeg", "image/jpeg"),
// List("tif,tiff", "application/tiff")
// )
val parseMimeMap: List[List[String]] => Map[String, String] = { input =>
input
.flatMap( entry => {
@rahulahoop
rahulahoop / gist:c463ca7e97d41704d322366a2143a7c6
Created March 30, 2022 10:13
zip directory and ignore sub directories if they exist using zip command (osx)
# in my case i was trying to ignore generated build dirs like target and node modules
$ > zip -r documents.zip Documents/ -x "Documents/**/target/*" -x "Documents/**/node_modules/*" -x "Documents/**/.idea/*"