Skip to content

Instantly share code, notes, and snippets.

View quonic's full-sized avatar

Spyingwind quonic

  • Dallas
View GitHub Profile
@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 / 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 / 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 / DivoomPixoo64.ps1
Last active February 21, 2024 16:38
Function to control Divoom's Pixoo 64 over the network. This presumes that you have PowerShell 7 installed. Examples at the bottom of the file. Sometime the Pixoo will reboot when sending a command. No way to fix this at the moment.
#Requires -Version 7
# Current API documentation
# http://doc.divoom-gz.com/web/#/12?page_id=143
function Invoke-PlayGif {
[CmdletBinding()]
param(
[Parameter()]
[string]
@quonic
quonic / readme.md
Created February 6, 2022 09:23
Rooting BGW210-700. Reformatting of https://github.com/dbf08/Rooting-BGW210-700/blob/master/README.md to Github's Markdown format

Rooting-BGW210-700

Rooting BGW210-700 update

Barring any network exploit being published and/or subsequently patched, here's a guide to physically root and extract certs from the demon spawn aka BGW210 without desoldering any flash chips and ruining the unit:

Needed equipment:

  • v1.5.12 or earlier RG firmware bin file
@quonic
quonic / putty.reg
Created January 14, 2022 09:54
Registers ssh:// to putty installed under c:\Program Files\PuTTY\
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ssh]
@="URL:ssh Protocol"
"URL Protocol"="ssh://"
[HKEY_CLASSES_ROOT\ssh\shell]
[HKEY_CLASSES_ROOT\ssh\shell\open]
[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="cmd /V:ON /c set params=%1 && set params=!params:ssh://=! && start \"PuTTY\" \"c:\\Program Files\\PuTTY\\putty.exe\" \"!params:/=!\""
@quonic
quonic / upgrade.js
Last active March 22, 2024 02:06
Birburner Hacknet Node upgrade script. I found and converted this script from .script to .js.
const MoneyFormat = '$0.0a';
const TimeFormat = '00:00:00';
/** @param {import(".").NS } ns */
export async function main(ns) {
/*
ns.hacknet-auto.script for Bitburner v0.47.2
Winners don't use copyright
@quonic
quonic / Export-GitLab.ps1
Created October 7, 2021 19:47
Backup/Export GitLab repositories
# This will clone each repo that your user/token has access to.
# I created this to help backup the repo's, then wipe the gitlab server, reinstall, and restore.
$token = "<YourTokenHere>"
$Url = "https://<YourDomainHere>/api/v4/projects/?per_page=500"
$Projects = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN' = $token } -Method Get -Uri $Url
$Projects.http_url_to_repo | ForEach-Object {
git.exe clone $_
}
@quonic
quonic / Convert-Code.ps1
Last active September 24, 2021 05:46
Nolol/Yolol code expander for thing like battery addition, for the Starbase game.
#Requires -Version 5.1
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string[]]
$Path
)
function Expand-Addition {
[OutputType("String")]
@quonic
quonic / Get-LastestPowershellCoreMSI.ps1
Created March 4, 2020 22:59
Checks if the current running Powershell Core environment is the latest version and download if it isn't
[Version]$ReleaseVersion = (Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json).ReleaseTag -replace '^v'
if ($PSVersionTable.PSEdition -like "Core" -and $ReleaseVersion -gt $PSVersionTable.PSVersion) {
$latest = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/PowerShell/releases" | Where-Object { $_.tag_name -eq "v$ReleaseVersion" }
$downloadUrl = $latest.assets | Where-Object Name -like "*win-x64.msi" | Select-Object -ExpandProperty 'browser_download_url'
Invoke-WebRequest -Uri $downloadUrl -OutFile "$PSScriptRoot\$(Split-Path $downloadUrl -Leaf)"
}