Skip to content

Instantly share code, notes, and snippets.

View quonic's full-sized avatar

Spyingwind quonic

  • Dallas
View GitHub Profile
@quonic
quonic / Approach Example.nolol
Last active February 16, 2022 22:59
A simple 2 line(when compiled) PID for the game StarBase, with "simplified" tuning instructions.
// Approach Example.nolol
// PID settings
start>
KP=0.3 //Some value you need to come up (see tuning section below)
KI=0.01 //Some value you need to come up (see tuning section below), not always needed leave at 1 if not used
KD=4 //Some value you need to come up (see tuning section below), not always needed leave at 1 if not used
bias=0
desired_value=10 // Set to what you want your desired value to be, AKA Set Point
IterationTime=0.2*2 // 0.2*number of line in compiled yolol code
@quonic
quonic / PID.ps1
Last active July 27, 2023 18:08
A PID controller class adapted for PowerShell. Made it because I haven't seen anyone make one for PowerShell.
#Requires -Version 5
# License: MIT
class PID {
# Adapted to PowerShell from: https://github.com/tommallama/CSharp-PID/blob/master/PID_Controller/PID.cs
#region Public Variables
# Upper output limit of the controller.
# This should obviously be a numerically greater value than the lower output limit.
@quonic
quonic / install-pwsh.sh
Last active October 8, 2023 01:43
Install PowerShell 7 on Ubuntu (23.04/22.04/20.04/18.04), Debian (12/11/10/9) Fedora/RHEL(8/7), Alpine, or macOS(Intel/M1)
#!/usr/bin/env bash
# Check if user is root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit
fi
Use_Package_Manager=0
Help_Message=0
@quonic
quonic / New-QemuTemplate.ps1
Created March 16, 2022 22:10
PowerShell script that creates a Ubuntu VM template.
#!/usr/bin/pwsh
[CmdletBinding()]
param (
[Parameter()]
[string]
$ReleaseName = "focal",
[Parameter()]
[string]
$Architecture = "amd64",
[Parameter()]
@quonic
quonic / Delete-Uploaded.ps1
Last active April 21, 2022 06:42
Script to upload an image to a self hosted pictshare server from Greenshot via pwsh(Powershell 7)
#Requires -Version 7
# Deletes all posts from $LogFile
[CmdletBinding()]
param (
# Log file of all requests
[string]
$LogFile = "C:\temp\pictshare_posts.json"
)
@quonic
quonic / Get-Voltage.md
Last active April 29, 2022 21:47
Get Input Voltage measurements from IPP's database for a single Eaton 5P UPS.

Example Output

Date                  Voltage
----                  -------
4/29/2022 9:49:47 AM  119.5
4/29/2022 10:10:20 AM 123.6
4/29/2022 10:10:26 AM 120.7
4/29/2022 11:10:49 AM 113.9
4/29/2022 11:10:55 AM 119.5
@quonic
quonic / Get-PolicyDefinition.ps1
Last active August 1, 2022 13:30
Basic parsing of installed amdx files under C:\Windows\PolicyDefinitions\ . Defaults to en-US.
function Get-PolicyDefinition {
[CmdletBinding(
ConfirmImpact = 'None',
RemotingCapability = [System.Management.Automation.RemotingCapability]::PowerShell
)]
[OutputType([PSObject[]])]
param(
[Parameter(Mandatory = $false)]
[string[]]
$Name,
@quonic
quonic / Get-PowerShellVersion.ps1
Last active August 6, 2022 04:09
Installs PowerShell/WMF 5.1 for applicable versions of Windows running on PowerShell 2.0 to 4.0. Includes script for getting PowerShell version for NinjaRMM.
#Requires -Version 2.0
<#
.SYNOPSIS
Returns the version of PowerShell installed and updates a custom field in NinjaRMM
.DESCRIPTION
Returns the version of PowerShell installed and updates a custom field in NinjaRMM if the Ninja Agent is installed.
.PARAMETER CustomField
Sets what custom field to update.
Defaults to "PowerShell" if not used.
@quonic
quonic / Install-RustDesk.ps1
Created December 5, 2022 22:12
Simple install script for RustDesk to point to your own server. Can be used in a GPO startup script.
$ErrorActionPreference = 'SilentlyContinue'
#Region Settings
# IP address of our server
$IpAddress = "127.0.0.1"
# The public key for our server
$PublicKeyString = "12345678"
# The temporary folder where we will store and run the installer
$TempFolder = "C:\Temp\"
#EndRegion Settings
@quonic
quonic / IP Address Class.ps1
Created January 24, 2023 20:13
A simple class for defining an IPv4 address, accessing or changing any octet. Uses the Version object as the base object.
class IP {
IP([string]$Address) {
$this._IPAddress = $Address
}
hidden [Version] $_IPAddress = $($this | Add-Member ScriptProperty 'Address' {
# get
[PSCustomObject]@{
First = $this._IPAddress.Major
Second = $this._IPAddress.Minor
Third = $this._IPAddress.Build