Skip to content

Instantly share code, notes, and snippets.

View josephcagle's full-sized avatar
👨‍💻

Joseph Cagle josephcagle

👨‍💻
View GitHub Profile
@josephcagle
josephcagle / howtograph.md
Last active November 29, 2023 23:38
Graph stuff in Python ASAP

Python math and function graphing, ASAP

  1. Make sure python3 and pip3 are installed
  2. Run pip3 install matplotlib numpy sympy
  3. Throw this other gist in a file (call it "domath.py" or something).
  4. Run python3 -i domath.py to run the script and continue in an interactive shell.
  5. You're done! (Well, done setting up, at least.)
  6. To actually do stuff with this, you can use the helper functions from that gist:
  • The plot_it function will plot the graph of a function, taking these arguments:
@josephcagle
josephcagle / domath.py
Last active November 29, 2023 23:42
My Python math utilities
# To use this, run `python3 -i domath.py`.
import math
from math import *
from matplotlib import pyplot
from numpy import inf
import numpy as np
from numpy.linalg import det, inv, matrix_power, eigvals, eig, solve, matrix_rank
from sympy import Matrix, flatten
@josephcagle
josephcagle / rockpaperscissors.sh
Created April 19, 2021 13:37
A simple rock-paper-scissors game shell script
#!/bin/bash
read -d '' intro << "END"
===========================================
Welcome to Rock, Paper, Scissors!
===========================================
END
read -d '' rock << "END"
@josephcagle
josephcagle / disable.vim
Created December 25, 2021 04:18
Remove all built-in vim commands
" These mappings disable all built-in vim functionality.
" This is based on commands listed in :help index
" NOTE: This includes the various commands to exit vim.
" It is recommended to set up a "quit" mapping so you don't have to kill the process.
" E.g., this invocation of vim would let you quit by typing C-q.
" vim -u disable.vim -c 'nnoremap <C-q> :qa!<CR>'
inoremap <C-@> <Nop>
inoremap <C-A> <Nop>
@josephcagle
josephcagle / morse.c
Created December 3, 2022 21:57
-- .-. .-- .- - ... --- -. -.-. --- -- . .... . .-. .
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
void printEncoded(char[]);
void printDecoded(char[]);
int main(int argc, char *argv[])