Skip to content

Instantly share code, notes, and snippets.

View krish-adi's full-sized avatar
🐒
hanging around...

Adithya Krishnan krish-adi

🐒
hanging around...
View GitHub Profile
@krish-adi
krish-adi / microgpt.py
Created February 12, 2026 16:52 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@krish-adi
krish-adi / dlopen.md
Created January 22, 2025 12:27 — forked from hannes/dlopen.md

Parallel Python within the same process or hacking around the cursed GIL with a hand-rolled library loader

From its obscure beginnings in Amsterdam, the Python programming language has become a fundamental building block of our digital society. It is used literally everywhere and by everyone for a mind-boggingly wide variety of tasks.

Python is also the lingua franca of Data Science, tying together tools for data loading, wrangling, analysis and AI. There is a massive ecosystem of contributed Python packages, which - for example - allows reading every obscure data format under the sun. This makes Python and its ecosystem extremely valuable for analytical data management systems: Users are likely somewhat familiar with Python due to its immense popularity and the ecosystem provides solutions for most data problems. As a result, Python is being integrated into SQL systems, typically through so-called User-Defined Functions (UDFs). For example, [Apach

@krish-adi
krish-adi / testRegex.js
Created August 19, 2024 09:27
Regex for chunking by using all semantic cues
// Updated: Aug. 15, 2024
// Run: node testRegex.js testText.txt
// Used in https://jina.ai/tokenizer
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
Parameter Type Description Example
<table_name> string Data table name 'TS_DATA_TABLE'
<time_column_name> string Timestamp column name 'DS'
<value_column_name> string Value of interest 'Y'
<forecast_period> integer Forecast period 40
`` integer Unit alias of the given period 'M' (month)
@krish-adi
krish-adi / gee-initialize-service-account.py
Created February 23, 2022 12:19
GEE Authentication and initialisation using a service account.
import ee
# Authenticate and initialize
email = "my-service-account@...gserviceaccount.com"
key_file = "/path-to-key/key-file.json"
credentials = ee.ServiceAccountCredentials(email=email, key_file=key_file)
ee.Initialize(credentials)
@krish-adi
krish-adi / greppo-gee-quickstart-2.py
Last active February 23, 2022 11:50
Greppo and GEE integration demo, the Quickstart example.
app.display(name='text1', value='# Enter point value for finding its elevation')
lon = app.number(name='Longitude of the Point', value=86.9250)
lat = app.number(name='Latitude of the Point', value=27.9881)
point_name = app.text(name='Enter the name of point', value='Mt. Everest')
# Point object in EE
ee_point = ee.Geometry.Point([lon, lat])
app.ee_layer(ee_object=ee_point, vis_params={"color": "red"},
name=point_name, description=f"The Point representing {point_name}.")
@krish-adi
krish-adi / greppo-gee-trendy-lights.py
Created February 22, 2022 15:18
Greppo and GEE integration demo, trendy night lights example.
from greppo import app
import ee
# Authenticate and initialize
email = "my-service-account@...gserviceaccount.com"
key_file = "/path-to-key/key-file.json"
credentials = ee.ServiceAccountCredentials(email=email, key_file=key_file)
ee.Initialize(credentials)
# Adds a band containing image date as years since 1991.
@krish-adi
krish-adi / greppo-gee-quickstart-1.py
Last active February 23, 2022 11:07
Greppo and GEE integration demo, the Quickstart example.
from greppo import app
import ee
# Authenticate and initialize
email = "my-service-account@...gserviceaccount.com"
key_file = "/path-to-key/key-file.json"
credentials = ee.ServiceAccountCredentials(email=email, key_file=key_file)
ee.Initialize(credentials)
# Select the satellite dataset from the catalog
@krish-adi
krish-adi / greppo-vector-demo.py
Created February 17, 2022 10:46
Greppo demo app for vector data.
from greppo import app
import geopandas as gpd
app.display(name='title', value='Vector demo')
app.display(name='description',
value='A Greppo demo app for vector data using GeoJSON data.')
app.base_layer(
name="Open Street Map",
visible=True,
from greppo import app
import geopandas as gpd
regions = gpd.read_file("./regions.geojson")
roads = gpd.read_file("./roads.geojson")
cities = gpd.read_file("./cities.geojson")
app.display(name='text-2',
value='The following displays the count of polygons, lines and points as a barchart.')