Skip to content

Instantly share code, notes, and snippets.

@bsushmith
bsushmith / md2csv.py
Created February 20, 2026 10:09
convert markdown table to csv
import csv
import io
def markdown_to_csv(markdown_content: str, output_file: str = None) -> str:
lines = markdown_content.strip().split('\n')
table_lines = [line for line in lines if '|' in line]
if not table_lines:
raise ValueError('unable to find markdown table in the input')
@bsushmith
bsushmith / commands.md
Last active June 11, 2024 15:38
zellij auto completion setup for zsh

Add zellij command auto completion to zsh shell.

I'm using oh-my-zsh. The commands in the zellij documentation didn't work for me. I got it to work by running these commands below -

cd ~
take .zsh
zellij setup --generate-completion zsh > ./.zsh/_zellij
echo -e "fpath=(~/.zsh \$fpath)\n" >> ~/.zshrc
@bsushmith
bsushmith / csv_to_sql.sh
Created November 19, 2020 17:36
convert csv file to sql statements
#!/usr/bin/env bash
input_file_path="$1"
filename=$(basename "$input_file_path")
directory=$(dirname "$input_file_path")
temporary_file=/tmp/"$filename".copy
sed 's/\s*,*\s*$//g' "$input_file_path" > "$temporary_file"
@bsushmith
bsushmith / SlackUtil.scala
Created July 6, 2020 00:39
Simple way to send slack messages using Akka in scala
package slack
import java.util.concurrent.TimeUnit
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.stream.ActorMaterializer
import scala.concurrent.ExecutionContext.Implicits.global
# Add git wip status
(( $(git log -n 1 | grep -c "\-\-wip\-\-") == 1 )) && res+=" ${conflicted}WIP!!!"