Skip to content

Instantly share code, notes, and snippets.

View rileytwo's full-sized avatar
🌺

Riley Roach rileytwo

🌺
  • Kansas City, Missouri
View GitHub Profile
@kieranb662
kieranb662 / SwiftEquationSolvers.md
Last active March 13, 2023 18:01
[Polynomial Solvers] A set of polynomial equation solvers written in Swift. #Math

Swift Equation Solvers

Most equations need to be solved numerically since no close-form expression representing their solutions can be obtained. For polynomial equations of order 1, 2, 3, 4 exact solutions can be obtained. I have created a series of solvers up to a cubic solver, that can be used to obtain most exact solutions. Of course with floating point errors, not everything is going to come out looking clean. To be able to handle complex numbers I made a simplified version of a complex number without all the mathematical operations.

If you call the cubicSolve function with a = 0 then the solver falls back on the quadratic solver, the quadratic solver will fallback on the linear solver and linear solver will return an empty array(Thanks for catching that u\korbonix).

Example Usage

@fish2000
fish2000 / brew-receipt.sh
Last active June 3, 2022 02:55
Homebrew external-command script to show syntax-highlited install receipt JSON, using Pygments
#!/usr/bin/env bash
#: * `receipt` <formula> [<formula>...]:
#: Show the syntax-highlighted JSON install receipt for the specified formulae
function brew () {
"${HOMEBREW_PREFIX}/bin/brew" "$@"
}
irfilename="INSTALL_RECEIPT.json"
pygmentize="$(command -v pygmentize)"
@gvenzl
gvenzl / One Liner to download the latest release from your GitHub repo.md
Last active January 14, 2024 22:18
One Liner to download the latest release from your GitHub repo
LOCATION=$(curl -s https://api.github.com/repos/<YOUR ORGANIZTION>/<YOUR REPO>/releases/latest \
| grep "zipball_url" \
| awk '{ print $2 }' \
| sed 's/,$//'       \
| sed 's/"//g' )     \
; curl -L -o <OUTPUT FILE NAME> $LOCATION

for example:

@bdesham
bdesham / process.awk
Last active March 7, 2024 11:56
Takes a list of commands with timing information and displays the elapsed time for each one.
# Takes a list of commands with timing information and displays the elapsed
# time for each one.
#
# The input is expected to look like
#
# +1518804574.3228740692 colors:76> local k
# +1518804574.3228929043 colors:77> k=44
# +1518804574.3229091167 colors:77> color[${color[$k]}]=44
# +1518804574.3229229450 colors:77> k=33
# +1518804574.3229279518 colors:77> color[${color[$k]}]=33
@0xKD
0xKD / help.md
Created September 24, 2017 02:46
Find shutdown cause macOS

Run this

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h

Check reason code in following list:

Code	Description	Solution
@azagniotov
azagniotov / download.all.adp.paystubs.js
Last active April 16, 2024 22:08
Downloads all pay-slips from ADP website
/*
This has been tested in Chrome v55.0.2883.95 (64-bit)
1. Log into ADP website using the URL: https://my.adp.com/static/redbox/login.html (Make sure you are NOT in Incognito mode)
2. Open Developer Tools console
3. Run the following code in the console:
*/
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://my.adp.com/v1_0/O/A/payStatements?adjustments=yes&numberoflastpaydates=300');
@kizzx2
kizzx2 / hammerspoon-move-resize.lua
Last active December 19, 2022 06:47
Hammerspoon script to move/resize window under cursor
-- Inspired by Linux alt-drag or Better Touch Tools move/resize functionality
function get_window_under_mouse()
-- Invoke `hs.application` because `hs.window.orderedWindows()` doesn't do it
-- and breaks itself
local _ = hs.application
local my_pos = hs.geometry.new(hs.mouse.getAbsolutePosition())
local my_screen = hs.mouse.getCurrentScreen()
@expersso
expersso / ggplot2_DRY
Last active May 27, 2019 22:42
Example of using ggplot2's %+% to follow DRY principle
library(eurostat)
library(dplyr)
library(ggplot2)
library(scales)
#### Original version (not using %+%) ####
# Originally posted at http://www.r-bloggers.com/european-debt-and-interest/ on June 7, 2015
r1 <- get_eurostat('gov_10dd_edpt1')
@romainl
romainl / _rnb.md
Last active August 12, 2021 21:56
RNB, a Vim colorscheme template
@christophergandrud
christophergandrud / source_lines.R
Created December 1, 2014 14:08
Source specific lines from a file in R
#' Source specific lines in an R file
#'
#' @param file character string with the path to the file to source.
#' @param lines numeric vector of lines to source in \code{file}.
source_lines <- function(file, lines){
source(textConnection(readLines(file)[lines]))
}