Skip to content

Instantly share code, notes, and snippets.

View rajatscode's full-sized avatar
⚠️
This player uses computer assistance.

rajat mehndiratta rajatscode

⚠️
This player uses computer assistance.
View GitHub Profile
@rajatscode
rajatscode / random_lowercase_strings.py
Last active May 28, 2020 06:14
Generating random lowercase ASCII strings in Python
import argparse
import cProfile
import itertools
import random
import string
ALL_FUNCTION_NAMES=[
'using_choice', 'using_sample', 'using_randint', 'using_randint_with_offset', 'using_randbits',
'using_randbits_ascii_lowercase', 'using_one_long_randbits'
]
@rajatscode
rajatscode / james_road.py
Created June 6, 2020 07:06
Jane Street alternative name generator
# To get this to work: install names (`pip3 install --user -U names`)
import names
import random
# copied from https://pe.usps.com/text/pub28/28apc_002.htm
# hardcoded because requests + BeautifulSoup got too ugly and it's faster to
# just extract and prettify the words from the page manually
STREET_SUFFIXES = {
'Alley', 'Annex', 'Arcade', 'Avenue', 'Bayou', 'Beach', 'Bend', 'Bluff',
'Bluffs', 'Bottom', 'Boulevard', 'Branch', 'Bridge', 'Brook', 'Brooks',
@rajatscode
rajatscode / LICENSE
Created June 6, 2020 20:02
This license applies to all public gists listed at https://gist.github.com/rajatscode
MIT License
Copyright (c) 2020 rajat mehndiratta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@rajatscode
rajatscode / leetcode_765.py
Created October 29, 2020 05:18
Python 2 code for Leetcode 765
def convert_to_couples(row):
return [n // 2 for n in row]
def trim_couples(couples):
return [
couples[i] for i in xrange(len(couples))
if couples[i//2*2] != couples[i//2*2+1]
]
def reindex_by_appearance(sequence):
@rajatscode
rajatscode / cs
Last active September 27, 2026 16:28
cs: fzf picker to find, resume, restore (from Entire checkpoints) and port sessions between Claude Code and Codex
#!/usr/bin/env python3
"""cs — find and pick up coding-agent sessions (Claude Code + Codex), even after the transcript is gone.
cs [query] fzf picker over every session, newest first
cs pickup <id> [claude|codex|opencode|gemini] pick up in that tool (default: its own)
cs resume <id> same as `pickup <id>` in its own tool
cs restore <id> bring a purged transcript back from an Entire checkpoint
cs attach <id> [--branch B] write an Entire checkpoint for the session straight to the
checkpoint remote (never amends a commit, never touches main)
cs --refresh (re)index Entire checkpoint remotes found in your projects
@rajatscode
rajatscode / README.md
Last active September 15, 2026 15:32
local-code: dynamic local model discovery and Claude/Codex launcher

local-code

An interactive Ollama launcher for people who do not want to learn model names, quantization suffixes, or provider configuration first.

Run local-code and get four choices:

  1. Install new models — see detected memory headroom, then the five best benchmark-matched local variants at or below your comfortable threshold, ranked by the live Arena text-overall leaderboard. Each row shows
@rajatscode
rajatscode / 000cross-harness subagents
Last active September 18, 2026 21:02
Inspectable OpenCode, Ori/OpenRouter, and OMP subagent harnesses
name
@rajatscode
rajatscode / README.md
Last active September 26, 2026 00:18
MLX vector-steered prompt valence experiment for Ashkelon

MLX vector-steered prompt valence

This gist is a small experiment for Ashkelon request mediation. It does not call a second hosted model to rewrite text. It loads an open-weight MLX model, measures a contrastive hidden-state direction from a kind seed and a hostile seed, and adds that direction to a selected transformer block while the model generates a rewritten request.

python valence_vector_mlx.py \