Skip to content

Instantly share code, notes, and snippets.

View recrsn's full-sized avatar
💭
I may be slow to respond.

Amitosh Swain Mahapatra recrsn

💭
I may be slow to respond.
View GitHub Profile
@recrsn
recrsn / chat.py
Last active April 20, 2025 18:05
Very basic LLM chat
import json
import requests
def load_config(config_path):
with open(config_path, 'r') as file:
config = json.load(file)
return {
"endpoint": config["endpoint"],
@recrsn
recrsn / autocoder.py
Created April 20, 2025 10:05
A very simple coding agent
import json
import os
import traceback
import requests
def load_config(config_path):
with open(config_path, 'r') as file:
config = json.load(file)
@recrsn
recrsn / dep.py
Created May 13, 2024 18:05
A simple package manager for Python inspired by npm
#!/usr/bin/env python3
"""
A simple package manager for Python inspired by npm.
It uses pip and uv to manage dependencies.
Usage:
Initialize a new package:
dep.py init <name>
import sqlite3
# Path to your SQLite file
sqlite_file = 'your_database.sqlite'
# Connect to the SQLite database
conn = sqlite3.connect(sqlite_file)
cursor = conn.cursor()
# Get the table names
@recrsn
recrsn / json_to_sqlite.py
Last active May 29, 2023 17:16
JSON to SQLite by inferring schema
import json
import sqlite3
import sys
def create_table_from_json(json_file, table_name):
# Load JSON data
with open(json_file, 'r') as file:
json_data = json.load(file)
# Retrieve the first element of the JSON array to infer schema
@recrsn
recrsn / agebot.go
Created January 11, 2023 04:38
Slackbot to calculate age
package main
import (
"context"
"errors"
"fmt"
"github.com/joho/godotenv"
"github.com/slack-go/slack"
"github.com/slack-go/slack/slackevents"
"github.com/slack-go/slack/socketmode"
pipeline {
job {
timeout = 12000
}
}
def sh(String command) {
return new ShellCommand(command)
}
class JobSpec {
def name
def steps = []
def artifacts = []
public JobSpec(name) {
this.name = name
}
class PipelineSpec {
def input, output
def maps = []
def filters = []
def input(String id) {
this.input = input
}
def output(String id) {
this.output = output
def pipeline(Closure<Void> cl) {
def pipelineSpec = new PipelineSpec()
cl.delegate = pipelineSpec
cl()
pipelines << pipelineSpec.build()
}