Skip to content

Instantly share code, notes, and snippets.

# Reverse-Engineering Cursor's fast Code Search algorithm
*Ahmed Yousri · March 2026*
---
In March 2026, Cursor published a blog post titled ["Fast regex search"](https://cursor.com/blog/fast-regex-search) by Vicent Marti. It described how they'd built an indexed code search system that could find a pattern across an entire codebase in 13 milliseconds. Their claim: sparse n-gram inverted indexes, two files on disk, a single binary search on a memory-mapped lookup table.
I read it and thought: I can build that.
package io.mapledoum.telegram.starter.exams.tools;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@hemeda3
hemeda3 / hashing.java
Created October 23, 2022 04:19
BasicHashing+UsingMultiplierToAvoidSpuriousHit+UsingModulerToAvoidLargeHashValue
```Java
public class test {
public static void main(String[] args) throws Exception {
test t = new test();
@hemeda3
hemeda3 / mongodb-groupby-week-unwind-array-withoutFieldNames
Last active September 29, 2022 02:26
MongoDB+NodeJs script, that take string date convert it to ISO date, then extract ISO week number then count total per weekNo then calc average, then convert weeknumber to date range for readability
```javascript
var mongoose = require('mongoose');
//Set up default mongoose connection
async function calcSumByWeek() {
const weeklypipeline = [
@hemeda3
hemeda3 / memoize-until.js
Created June 2, 2022 08:39 — forked from bezhermoso/memoize-until.js
`memoizeUntil` -- memoize function for n milliseconds
var R = require("ramda");
var memoizeUntil = function (fn, expiry) {
var cache = {};
var onExpiry = [];
var onCache = [];
var onCachedResult = [];
var memoized = function () {
#!/bin/bash
# This script requires jq, a command line to to parse and format JSon.
# https://stedolan.github.io/jq/
function padBase64 {
STR=$1
MOD=$((${#STR}%4))
if [ $MOD -eq 1 ]; then
STR="${STR}="

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

@hemeda3
hemeda3 / README.md
Created February 7, 2022 01:39 — forked from wuriyanto48/README.md
Kafka, Redis, Elastic Search, Mongodb with docker compose

Run

$ docker-compose up
@hemeda3
hemeda3 / custom-my-account-endpoint.php
Created January 9, 2022 18:44 — forked from claudiosanches/custom-my-account-endpoint.php
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
@hemeda3
hemeda3 / display-attributes-as-table.php
Created January 1, 2022 09:13 — forked from helgatheviking/display-attributes-as-table.php
Display the WooCommerce product attributes as a table element via shortcode [display_attributes]
<?php
/**
* Attributes shortcode callback.
*/
function so_39394127_attributes_shortcode( $atts ) {
global $product;
if( ! is_object( $product ) || ! $product->has_attributes() ){