Skip to content

Instantly share code, notes, and snippets.

View sumeet's full-sized avatar

Sumeet Agarwal sumeet

  • San Francisco, CA
View GitHub Profile
@on-stdin ( -> )
( increment num-bytes-read )
;incoming/num-bytes-read LDA2 ( =: count )
INC2 ( =: count )
( count &> ) DUP2 ;incoming/num-bytes-read STA2
( first 4 bytes are the IP )
( count &> ) DUP2 #0001 EQU2 #00 EQU ?{ LIT "< draw-char }
( count &> ) DUP2 #0005 LTH2 #00 EQU ?{

There are several items on the list of projects that I'm absolutely interested in doing. I think RC will be much more satisfying to me if I plan for and achieve several small milestones across different projects than working on only one project for the 3 months.

I'm trying to filter the list down to the biggest glaring holes in my understanding of computing, including bucket list type topics I've always wanted to learn about. I'm attempting to flesh out goals and milestones ahead of time, so I have clear and attainable targets to work towards.

For accountability, goal-setting, and for the sake of a momento, I'd like to start making a <=5 minute video very casually documenting what I accomplished in the day. I'll check in after the first week to see if this is useful. One thing I struggle with is sufficiently reflecting on and presenting my work -- I would like to have some sort of projects portfolio on my personal website.

I've also listed some shorter projects that I feel really confident about, to knock

@sumeet
sumeet / binaryTree.js
Created October 19, 2022 00:36
formation binary trees
// Binary Tree
// 10
// 5 15
// 1 7 12 20
// 11
// better graphical representation of a tree
// https://cdn.programiz.com/sites/tutorial2program/files/bst-vs-not-bst.png
diff '--color=auto' -U1000 -r -u plasma-desktop-5.24.5/applets/pager/plugin/windowmodel.cpp plasma-desktop-5.24.5-modded/applets/pager/plugin/windowmodel.cpp
--- plasma-desktop-5.24.5/applets/pager/plugin/windowmodel.cpp 2022-05-03 03:31:25.000000000 -0700
+++ plasma-desktop-5.24.5-modded/applets/pager/plugin/windowmodel.cpp 2022-06-20 10:37:59.906814525 -0700
@@ -1,138 +1,150 @@
/*
SPDX-FileCopyrightText: 2016 Eike Hein <hein.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "windowmodel.h"
@sumeet
sumeet / lcs.py
Created September 23, 2022 17:56
count = 0
def lcs(w1, w2, i=0, j=0, cache=None):
global count
cache = cache or {}
if (i, j) in cache:
return cache[(i, j)]
class LL:
@classmethod
def from_list(cls, vals):
if not vals:
raise "LL must have at least one element"
root = cls(vals[0])
cur = root
for val in vals[1:]:
cur.next = cls(val)
cur = cur.next
@sumeet
sumeet / dag.py
Created September 14, 2022 03:38
from random import randint
import networkx as nx
def random_dag(nodes, edges):
"""Generate a random Directed Acyclic Graph (DAG) with a given number of nodes and edges."""
G = nx.DiGraph()
for i in range(nodes):
G.add_node(i)
while edges > 0:
a = randint(0,nodes-1)
use std::fs::File;
use std::io::{BufRead, BufReader};
use rayon::iter::{ParallelBridge};
use serde::Deserialize;
use rayon::iter::ParallelIterator;
#[derive(Deserialize, Debug)]
struct Business {
stars: f64,
}
use std::collections::HashMap;
use std::fs::read_to_string;
fn main() {
let filestr = read_to_string("example.csv").unwrap();
let mut lines = filestr.lines();
let header_row = lines.next().unwrap();
let field_names : Vec<_> = header_row.split(",").collect();
let objects : Vec<HashMap<_, _>> = lines.map(|line| {

Command line adder

Adds together all numbers separated by newlines from input. If an empty line is given, doesn't add anything to the total sum (i.e., it adds 0).

Terminate the program by either sending EOF (Ctrl-D), or with the keyword END. Upon termination, the program will print out the whole sum.

Example:

$ cargo run