Skip to content

Instantly share code, notes, and snippets.

View kallmanation's full-sized avatar

Nathan Kallman kallmanation

View GitHub Profile
@kallmanation
kallmanation / mcd.md
Last active March 10, 2024 21:30
mcd - mkdir && cd

mcd

Make and Change Directory

mkdir && cd

It's an often used pattern when setting up to first make a directory with mkdir and then immediately moving into the new directory with cd.

mkdir my_dir
cd my_dir
@kallmanation
kallmanation / catdeck.sh
Last active May 28, 2019 11:35
A simple file-driven concatenation command
#!/bin/bash
catdeck() {
if [[ "$#" -eq 0 ]]; then
(>&2 echo "usage: $0 final_file_name.catdeck")
exit 1
fi
OUTPUTFILE=$(echo "$1" | sed 's/\.catdeck//')
echo -n "" > "$OUTPUTFILE"
@kallmanation
kallmanation / simple_cli_calculator.md
Last active April 20, 2023 11:46
Simple CLI Calculator

Setup

This leverages the arbitrary-precision command line calculator bc

Just add the function c (or similarly short) to your .bashrc:

c() { echo "$@" | bc -l; }
@kallmanation
kallmanation / $
Created August 23, 2019 12:31
/bin/$ - copying commands from strangers on the internet with (slightly less) reckless abandon!
#!/bin/sh
# Copying dangerous commands from the internet and forgetting to trim the `$` off the start?
# Getting all sorts of `# -bash: $: command not found` errors?
# This script is for you!
# `$ command` will now ask for confirmation before executing the gum you scraped off of stackoverflow!
echo "You are about to run the command:"
echo "$@"
read -n 1 -p "Do you want to continue? [yN]: " answer
@kallmanation
kallmanation / 3d_fillets.scad
Created May 22, 2020 21:04
Complex 3D fillets in OpenSCAD
r1 = 100;
r2 = 76;
r3 = 42;
overlap12 = 33;
overlap13 = 21;
overlap23 = 21;
distance12 = r1+r2-overlap12;
distance13 = r1+r3-overlap13;