Skip to content

Instantly share code, notes, and snippets.

View Spitfire1900's full-sized avatar

Kyle Gottfried Spitfire1900

  • Web Infra. Admin @ Auto-Owners Insurance
  • Michigan
  • 14:41 (UTC -05:00)
View GitHub Profile
@Spitfire1900
Spitfire1900 / CircleAttributes.py
Last active December 2, 2015 16:44
Print the statistics of a circle
r = int(input("Please enter the radius of a circle: "))
print("Printing statistics of a circle that has a radius of", r, "units.")
import math as m
a = (m.pi*r)**2
d = r*2
c = 2*(m.pi)*r
print("Radius:", r, "units")
print("Diameter:", d, "units")
@Spitfire1900
Spitfire1900 / parsexml.sh
Last active August 12, 2022 06:00
Parse XML in bash
#! /bin/bash
#xml parser, assigns entity to $E and content to $C
rdom () { local IFS=\> ; read -d \< E C ;} # https://stackoverflow.com/questions/893585/how-to-parse-xml-in-bash/7052168#7052168
while rdom; do
if [[ $E = $2 ]]; then
echo $C
exit
fi
@Spitfire1900
Spitfire1900 / .gitconfig
Last active December 14, 2015 03:06
.gitconfig
[user]
name = Kyle Gottfried
email = [email protected]
[alias]
tree = log --graph --decorate --pretty=oneline --abbrev-commit
[diff]
tool = meld
[merge]
tool = meld
[difftool]
@Spitfire1900
Spitfire1900 / passsec.sh
Last active December 4, 2015 13:28
Securely provide password for a bash one-liner.
#! /bin/bash
if [ -z $pass ]; then
read -s -p "Enter Password: " pass
printf "\n\r"
fi
@Spitfire1900
Spitfire1900 / TestProcessBuilder.java
Last active April 13, 2016 13:59
Inherit the io of a subprocess in Java, allowing you to talk through Java to the process in the shell like normal.
import java.lang.ProcessBuilder;
import java.lang.ProcessBuilder.Redirect;
public class TestProcessBuilder
{
public static void main(String args[])
{
try
{
ProcessBuilder builder = new ProcessBuilder("fairymax");
from java.lang import ProcessBuilder
from java.lang.ProcessBuilder import Redirect
builder = ProcessBuilder(["fairymax"])
builder.redirectInput(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
builder.redirectError(Redirect.INHERIT)
builder.start().waitFor()
#### OUTPUT ####
#tellics say Fairy-Max 4.8V
#tellics say by H.G. Muller
@Spitfire1900
Spitfire1900 / debug.md
Created July 20, 2017 14:08
atom-beautify installation failure

Installing atom-beautify to C:\Users\e018503.atom\packages �[31mfailed �[39m�[31mC:\Users\e018503\AppData\Local\Temp\apm-install-dir-117620-9732-241d7z.o5udviy66r `-- (empty) npm WARN deprecated [email protected]: Use uuid module instead npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\e018503\AppData\Local\Temp\apm-install-dir-117620-9732-241d7z.o5udviy66r\package.json'

@Spitfire1900
Spitfire1900 / may_throw.py
Last active September 22, 2024 05:01
Rust, Go, and custom Union style Error as Values for Python
import enum
import typing
from enum import Enum
from typing import Callable, Generic, ParamSpec, Tuple, TypeVar, Union
P = ParamSpec("P")
R = TypeVar("R")
T = TypeVar("T")
__all__ = [