Skip to content

Instantly share code, notes, and snippets.

View midhunkrishna's full-sized avatar

Midhun Krishna midhunkrishna

View GitHub Profile
@midhunkrishna
midhunkrishna / uniq_file.py
Created August 9, 2026 21:14
List Unique Files
from collections import deque
from pathlib import Path
from queue import Queue
from dataclasses import dataclass, field
from typing import List
import concurrent.futures
import xxhash
import os
@midhunkrishna
midhunkrishna / SKILL.md
Created July 14, 2026 18:40
Merlin Mode
name merlin
description An operating discipline that makes a non-frontier-tier model (Opus 4.8, Sonnet) approximate Fable 5's long-horizon reliability through structure: full-spec intake, checkpointed execution, externalized state (GRIMOIRE.md), contracted sub-agent delegation, adversarial fresh-context verification, and cold-reader handoff. Use when the user invokes /merlin, says "merlin mode", or hands over a hard, long-horizon, multi-step task they want carried autonomously end-to-end. NOT for quick edits, single-file changes, or questions — the ritual overhead would exceed the work.
@midhunkrishna
midhunkrishna / reloader.py
Created July 3, 2026 22:21
reload a python file after making an edit without restarting the repl
"""
Drop in REPL: `import reloader; reloader.interact()` at the bottom of a script.
Gives you tab completion, persistent history and reload() function
that re-execs the calling-scropt into the live REPL namespace
"""
import atexit
import code
import os
@midhunkrishna
midhunkrishna / deque.ts
Last active May 20, 2025 22:24
A typescript Double Ended Queue implementation using doubly linked list.
/**
* A doubly-linked list node for Deque implementation
*/
class DequeNode<T> {
data: T | null;
next: DequeNode<T> | null;
prev: DequeNode<T> | null;
constructor(data: T | null = null) {
this.data = data;
@midhunkrishna
midhunkrishna / priority_queue.ts
Last active May 20, 2025 00:16
priority queue
type HeapType = 'min' | 'max'
class MinMaxHeap {
private heap: number[];
private type: HeapType;
private compare: (a: number, b: number) => boolean;
constructor(type: HeapType = 'min') {
this.heap = [];
this.type = type;

graphql ruby dynamically refresh schema, well a portion of it. ;)

class Types::DrugType
  
  # hook method that is called to check whether fields changed or not. 
  def self.dynamic_field_hook
    # this is example code, basically if the dynamic fields 
    # defined for a `SomeType` changes, the checksum changes as well
    DynamicField.for(DrugType).checksum
;; Override Emacs Internals
(defun smarter-move-beginning-of-line (arg)
"In Emacs there are two essential commands when you have to
go the beginning of a line - move-beginning-of-line(bound to C-a)
and back-to-indentation(bound to M-m). The first takes you to the first
column of a line and the latter takes you the first non-whitespace
character on a line.
@midhunkrishna
midhunkrishna / pre-commit.sh
Last active September 11, 2019 22:38
Precommit Hook
#!/bin/bash -l
echo "precommit running"
if (($(git diff --name-only --cached | grep ".rb" | wc -l) > 0)); then
echo "RuboCop autofix running..."
cd ~/vineti-platform/platform && bundle exec rubocop --fail-level A -a
exit $?
fi
@midhunkrishna
midhunkrishna / prepare-commit-msg.sh
Last active September 11, 2019 20:37
prepare commit hook
#!/bin/bash
if ! grep -q ci-run "$1" ; then
sed -i.bak -e "1s/^/[ci-skip] /" $1
fi
@midhunkrishna
midhunkrishna / .spacemacs.el
Last active February 16, 2020 09:26
Spacemacs Configuration
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory