Skip to content

Instantly share code, notes, and snippets.

View bradkrane's full-sized avatar

Brad Krane bradkrane

  • Waterloo, Ontario
View GitHub Profile
module Kernel
def to_hash
new_hash = self.instance_variables.reduce({}) do |hash, instance_var|
hash[instance_var.to_s[1..-1].to_sym] = self.instance_variable_get instance_var
hash
end
end
end
@bradkrane
bradkrane / kill-quantum.ps1
Created December 31, 2021 18:37
Kills the uses way too much CPU JBL QuantumApp
$process = Get-Process -Name "QuantumApp"
if ($process -eq $null) {
exit
}
$time = New-TimeSpan -Start $process.StartTime
if ($time.Minutes -gt 5) {
Stop-Process -Force -Id $process.Id
}
@bradkrane
bradkrane / Base64toFile.html
Created March 16, 2022 19:22
Paste Base64 and Save As...
<html>
<body>
<p><h2>Base64 to file</h2></p>
<p>
Get data with: <pre>cat &lt;file&gt; | gzip -c | base64</pre><br/>
Paste below and save to file:
</p>
<p>
<textarea id="content" style="width: 580px; height: 250px;"></textarea>
<br/>
@bradkrane
bradkrane / pwd.rb
Created October 5, 2022 03:07
Quick script to select subset of password list
#!/usr/bin/ruby
# ruby this.rb <wordlist> <command> <param> [cmd]
# Ex. C:\Users\Brad Krane\Documents\src\pwd>ruby pwd.rb 10-million-password-list-top-1000000.txt letters 5 "echo Weak PWD"
#Weak password
#Weak qwerty
#Weak dragon
#Weak baseball
#Weak football
throw ArgumentError.new "Invalid aruments: #{ARGV}\nruby this.rb <wordlist> <command> <param> [cmd]" if ARGV.length > 4 || ARGV.length < 3
@bradkrane
bradkrane / doses-remaining-estimator.html
Last active May 2, 2024 17:59
Estimates Remaining Quantity/Time of Doses using Weight
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Doses Remaining Estimator</title>
</head>
<body>
<h2>Doses Remaining Estimator</h2>
<form>
<label for="emptyWeight">Bottle weight (g):</label>