Skip to content

Instantly share code, notes, and snippets.

View shubhamkumar13's full-sized avatar
😑
is existing

shubham shubhamkumar13

😑
is existing
View GitHub Profile
@shubhamkumar13
shubhamkumar13 / range.rs
Created May 26, 2024 13:02
create a range with a custom function
fn range(start: isize, stop: isize, fun : impl Fn(&isize) -> isize) -> Vec<isize> {
let mut v = vec![start];
let mut temp = start;
loop {
temp = fun(&temp);
v.push(temp.clone());
if temp < stop {
break;
}
@shubhamkumar13
shubhamkumar13 / recurse-center-task.md
Last active April 30, 2024 04:54
recurse-center-task implementing a lisp interpreter in a weekend from scratch in rust, please don't disqualify I am working on it :prayge:
@shubhamkumar13
shubhamkumar13 / dune
Created April 28, 2024 06:03
dune for bin dir
(executable
(name main)
(public_name <keep-the-name-of-dir>.opam)
(libraries dream))
@shubhamkumar13
shubhamkumar13 / dune-project
Created April 28, 2024 06:01
starter dune project
(lang dune 3.0)
opam-version: "2.0"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.0.0"}
]

Error log

[  4%] Building C object lib/libappimage/src/libappimage_hashlib/CMakeFiles/libappimage_hashlib.dir/md5.c.o
[  4%] Linking C static library libappimage_hashlib.a
[  4%] Built target libappimage_hashlib
[  4%] Creating directories for 'xz-EXTERNAL'
[  8%] Performing download step (download, verify and extract) for 'xz-EXTERNAL'
-- verifying file...
       file='/home/sk/AppImageLauncher/build/lib/libappimage/xz-EXTERNAL-prefix/src/xz-5.2.3.tar.gz'
-- File already exists and hash match (skip download):
@shubhamkumar13
shubhamkumar13 / ocaml_retreat.md
Last active March 22, 2024 07:25
what I did in ocaml retreat

Motive

From the Hackacamel list I picked up working on the cdf plotter using TUI. Now I have never developed TUIs or GUIs so I thought this would be the perfect thing to do.

The initial hurdle was choosing the library, I wanted to try use OCaml 5 so I chose Minttea which is TUI framework inspired by Bubble Tea implemented in Golang and uses the The elm architecture (The TEA in minttea).

Biggest Hurdles

@shubhamkumar13
shubhamkumar13 / to_path.ml
Created February 14, 2024 09:04
convert a string to Eio.Path.t
let to_path ~env path = Eio.Stdenv.fs env / path
@shubhamkumar13
shubhamkumar13 / run_ls.ml
Created February 13, 2024 10:15
run a unix command
let _ =
Eio_main.run (fun env ->
let process_manager = Eio.Stdenv.process_mgr env in
Eio.Process.parse_out process_manager Eio.Buf_read.take_all ["ls"])
@shubhamkumar13
shubhamkumar13 / test_lpm.ml
Last active August 1, 2023 14:34
testing lpm by comparing outputs with generated tz files
module Fpath = Fpath
module OS = Bos.OS
module Cmd = Bos.Cmd
open Core
let ( let* ) o f = Result.bind o ~f
let get_tmp_dir () : string = OS.Dir.default_tmp () |> Fpath.to_string
let rm_rf ~(path : string) : unit =
OS.Dir.delete ~must_exist:true ~recurse:true (Fpath.v path) |> function