Skip to content

Instantly share code, notes, and snippets.

View harsh183's full-sized avatar
😺
People pleasing users

Harsh Deep harsh183

😺
People pleasing users
View GitHub Profile
@harsh183
harsh183 / github-devin-aside.js
Last active May 25, 2026 15:41
When using Devin on Github PRs I keep forgetting to prefix my comments with "aside -" which causes accidental changes. Vibe coded some a quick user script after a lot of iterations to add it by default
// ==UserScript==
// @name GitHub Comment "aside -" Prefix
// @namespace http://tampermonkey.net/
// @version 28.0
// @description Auto-prefixes GitHub PR comments with "aside -" for Devin
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function () {
@harsh183
harsh183 / gh_stack
Created March 30, 2026 17:56
Quick command to automatically find the parent branch to stack as a base branch when creating a PR on GitHub
#!/usr/bin/env ruby
current = `git branch --show-current`.strip
branches = `git for-each-ref --format='%(refname:short)' refs/heads/`.split
branches.reject! { |b| b == current }
base = branches
.map { |b| [b, `git rev-list --count #{b}..#{current}`.strip.to_i] }
.min_by { |_, count| count }
@harsh183
harsh183 / stacked_pr.rb
Created September 24, 2025 19:15
Stacked PR using jj version control (very vibe coded)
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'English'
require 'json'
require 'tempfile'
require 'fileutils'
# StackedPR creates and manages stacked pull requests for Jujutsu commits
class StackedPR
@harsh183
harsh183 / travel_history_days.rb
Last active October 13, 2025 16:18
using ruby nice datetime things to calculate time in a place
#!/usr/bin/env ruby
# Load Ruby's standard Date library
require 'date'
# Travel data as key-value map where arrival date points to departure date
# Each pair represents how long spent in the country during that visit
# Note: Most recent arrival (2025-03-30) uses projected departure of Nov 1, 2025
trips_data = {
'2025-03-30' => '2025-11-01', # Current visit - projected departure Nov 1, 2025
@harsh183
harsh183 / bot.py
Created October 7, 2021 18:05
DRES chatbot for looking up resources. Powered by google and discord.py
from discord.ext import commands
from googlesearch import search
bot = commands.Bot(command_prefix='!')
@bot.command(name="uiuc", help="Find a UIUC specific resources")
async def uiuc(ctx, *, question):
# breakpoint()
search_text = f"UIUC {question}"
await ctx.send("You've come to the right place for help! :slight_smile:")
@harsh183
harsh183 / typeInf125.md
Last active December 25, 2020 05:29
Blurb I wrote on CS 125 Forum about explaining Type Inference

I've gotten many questions about this from both students, and current existing course staff since type inference is a reasonably new age concept that is getting picked up in the programming languages of the 2010s and 2020s.

The lesson gives a pretty good starting point, especially the 7-minute walkthrough here on the basics of type inference.


Talk is cheap, show me the code

I redid a few of the older problems using var type inference across a few of the past homework problems to see this in action. I highly suggest checking these out.

@harsh183
harsh183 / hackyTestFramework.java
Last active June 8, 2024 01:42
Java hacky test framework
interface TestCase {
boolean test();
}
// print title if case fails
void checkCase(String title, TestCase t) {
if (t.test() == false) {
System.out.println("Failed: " + title);
}
}
int add(int a, int b) {
@harsh183
harsh183 / simple-linked-list-data-class.kt
Last active April 17, 2021 11:03
Simple singly linked list using data classes in Kotlin using one line. Featuring data classes and null safety
// Linked list
data class Node<T>(var value: T, var next: Node<T>?);
fun main() {
val head = Node(1, null)
val second = Node(2, Node(3, null)) // two more (init multiple)
head.next = second
println(head.value) // 1
println(head.next?.value) // 2
@harsh183
harsh183 / hackyTestWithScores.kt
Last active May 29, 2026 04:08
A very, very budget cut test running framework that also works with grade weights. Expanded from hackyTest.kt. It eventually got used in https://github.com/daviskeene/KTeach
data class TestResult(var score: Double, var maxScore: Double);
fun main() {
println("Running stuff")
val results = listOf(
case("5 + 10", 2.0) {
var x = 15;
x = x + 10
add(5, 10) == x
},
#!/usr/bin/env bash
set -ex
kotlinc $1 -d $1.jar
java -jar $1.jar