Skip to content

Instantly share code, notes, and snippets.

@jargnar
jargnar / bioprocess_neural_ode_jax_claude.py
Last active November 14, 2024 08:50
A simple Neural ODE for learning bioprocess dilution, growth and production rates. Generated by Claude 3.5 Sonnet.
"""
I'm building a simple hybrid model to predict growth rate and production rate for a bioprocess.
Can you give me the most simplest form of Neural ODE in JAX.
My ODE im trying to solve is a growth rate and production rate in context of bioprocess run data.
Here are my model equations:
I want to first solve the ODE
D = dV/dt = f(t) + b
@jargnar
jargnar / bioprocess_neural_ode_o1.py
Last active November 16, 2024 05:16
A simple Neural ODE for learning bioprocess dilution, growth and production rates. Generated by OpenAI o1.
"""
I'm building a simple hybrid model to predict
growth rate and production rate for a bioprocess.
My Neural ODE solves for growth rate and
production rate in context of bioprocess run data.
Here are my model equations:
First
D = dV/dt = f(t) + b
@jargnar
jargnar / api.py
Created June 18, 2024 13:06
Fictional PR review
from flask import Flask, jsonify
import sqlite3
app = Flask(__name__)
DATABASE = 'movies.db'
def get_db_connection():
conn = sqlite3.connect(DATABASE)
conn.row_factory = sqlite3.Row
@jargnar
jargnar / news_sim.dart
Last active March 13, 2021 12:02
Android/Flutter simple news feed sim
import 'dart:typed_data';
import 'package:firebase_core/firebase_core.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:intl/intl.dart';
class ArticleModel {
String title;
String body;
// MIT
// Suhas Guruprasad, [email protected]
const puppeteer = require("puppeteer");
const fetch = require("node-fetch");
const imagemin = require("imagemin");
const imageminMozjpeg = require("imagemin-mozjpeg");
const fs = require("fs").promises;
@jargnar
jargnar / edit_distance.rs
Created January 26, 2021 14:56
The minimum edit distance between two strings in Rust, LeetCode #72: https://leetcode.com/problems/edit-distance/
use std::collections::HashMap;
use std::cmp::min;
impl Solution {
pub fn min_distance(word1: String, word2: String) -> i32 {
let mut D: HashMap<(i32, i32), i32> = HashMap::new();
let m = word1.len() as i32;
let n = word2.len() as i32;
let w1: Vec<char> = word1.chars().collect();
@jargnar
jargnar / climbing_stairs.rs
Created January 26, 2021 08:02
Climbing Stairs
use std::collections::HashMap;
impl Solution {
pub fn fib(n: i32, cache: &mut HashMap<i32, i32>) -> i32 {
if n <= 2 { return n; }
else if !cache.contains_key(&(n-1)) && !cache.contains_key(&(n-2)) {
let a = Self::fib(n - 1, cache);
let b = Self::fib(n - 2, cache);
cache.insert(n - 1, a);
@jargnar
jargnar / 0062_unique_paths_stupid_solution.py
Created March 21, 2020 15:48
0062_unique_paths_stupid_solution.py
"""
The naive/stupid version where I actually created a tree... for unique paths...
<https://leetcode.com/problems/unique-paths>
before I realised we could just do simple DP of: #paths(i, j) = #paths(i, j + 1) + #paths(i + 1, j)
ouch.
"""
s0, r0, g0, p0, n0 = :C3, :D3, :E3, :G3, :B3
s, r, g, p, n = :C4, :D4, :E4, :G4, :B4
s2, r2, g2, p2, n2 = :C5, :D5, :E5, :G5, :B5
define :maya do
sleep 3
play_pattern_timed [s, s, r, s, r, s, r, r], 0.75, release: 3
sleep 3
play_pattern_timed [s, r, g, s, r, s, r, r], 0.75, release: 3
@jargnar
jargnar / duplicated_accumulator.go
Last active December 9, 2018 14:09
Find duplicated accumulator from a stream
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"github.com/AndreasBriese/bbloom"
)