Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Kallman kallmanation

View GitHub Profile
@kallmanation
kallmanation / 3d_fillets.scad
Created May 22, 2020
Complex 3D fillets in OpenSCAD
View 3d_fillets.scad
r1 = 100;
r2 = 76;
r3 = 42;
overlap12 = 33;
overlap13 = 21;
overlap23 = 21;
distance12 = r1+r2-overlap12;
distance13 = r1+r3-overlap13;
@kallmanation
kallmanation / $
Created Aug 23, 2019
/bin/$ - copying commands from strangers on the internet with (slightly less) reckless abandon!
View $
#!/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
View simple_cli_calculator.md

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 / catdeck.sh
Last active May 28, 2019
A simple file-driven concatenation command
View catdeck.sh
#!/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 / mcd.md
Last active Jan 15, 2021
mcd - mkdir && cd
View mcd.md

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