Skip to content

Instantly share code, notes, and snippets.

View cartercanedy's full-sized avatar
🚀
Thinking about the next rice for my nvim cfg

cartercanedy

🚀
Thinking about the next rice for my nvim cfg
View GitHub Profile
@cartercanedy
cartercanedy / tgz.sh
Last active August 27, 2024 21:32
A shell command to get a progress bar while creating a tarball
#!/usr/bin/env bash
function error() {
# $1 err code
# $2 err msg
echo -e "error: $1: $2"
}
function tgz() {
local longopts="help,output:,force"
@cartercanedy
cartercanedy / Result.cs
Last active March 7, 2024 22:26
C# Result<TOk, TErr> type
using System;
// makes sure that all references passed to this api are valid
// imho calls yielding nulls should actually yield err/exception if using this interface
#nullable enable
namespace Result;
/// <summary>
/// Covariant interface for <see cref="Result{TOk, TErr}"/> that assists in consumer variable binding.
@cartercanedy
cartercanedy / .prompt_fmt.sh
Last active March 9, 2024 19:14
bash prompt
GREEN=""
RED=""
NO_COLOR=""
BLUE=""
if [ "$color_prompt" = yes ]; then
GREEN='\033[01;32m'
RED='\033[01;31m'
NO_COLOR='\033[00m'
BLUE='\033[34m'
@cartercanedy
cartercanedy / query.py
Last active November 1, 2023 21:58
Pure Python sequence query functions using Python 3.12+ generic type syntax
from typing import (
Sequence,
Iterable,
Callable
)
type Predicate[ T ] = Callable[ [ T ] , bool ]
type Converter[ TIn , TOut ] = Callable[ [ TIn ] , TOut ]
class QueryException( Exception ):