Skip to content

Instantly share code, notes, and snippets.

View quonic's full-sized avatar

Spyingwind quonic

  • Dallas
View GitHub Profile
@quonic
quonic / ApacheGuacUserMapping.ps1
Last active May 29, 2021 00:14
Appache Guacamole user-mappings.xml file generator for current network
. .\NewXMLDocument.ps1
$rdp_domainname = "MicrosoftAccount"
$rdp_username = "fred"
$ssh_username = "fred"
$vnc_username = "fred"
$rdp_password = "changeme!"
$ssh_password = "changeme!"
$vnc_password = "changeme!"
@quonic
quonic / powershell.json
Last active April 29, 2023 05:36
A Powershell DynamicParam snippet for VSCode
{
"Dynamic_Param_Start": {
"prefix": "dynamic1start",
"body": [
"DynamicParam {",
"\t${1:dynamic2p}${2:}",
"}"
],
"description": "An empty dynamic parameter"
},
@quonic
quonic / ADAuthUDExample.ps1
Last active August 29, 2021 12:23
An example of AD auth with
Import-Module -Name UniversalDashboard
$ADDomain = "MyDomainHere.consto.com"
$ADGroup = "GroupNameHere"
$PageHome = New-UDPage -Name "Home" -Content {
New-UDLayout -Columns 3 -Content {
New-UDCard -Title "Scheduled" -Content {
"Links"
} -Links @(
@quonic
quonic / scum_sqlite.ps1
Last active September 3, 2022 22:16
For the game SCUM. This sets stats too 5 and skills to 4 for specified character.
#Requires -Module PSSQLite
param(
[Alias('Name', '')]
[string]
$ProfileName
)
<#
Updated for 9/2 patch
Updated by request of Truth91
#>
@quonic
quonic / Test-Prime.ps1
Created November 6, 2018 20:26
Get-Factor and Test-Prime functions that are fairly fast, for Powershell
function Get-Factor {
param (
[Parameter(Mandatory = $true,
Position = 0,
ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[int64[]]
$Number,
[switch]
@quonic
quonic / ConvertTo-UnixTime.ps1
Last active August 15, 2021 20:50
Created this to help convert UNIX time to and from Windows time when interfacing with data from API's that output time in UNIX time.
function ConvertTo-UnixTime {
[OutputType([int64])]
Param(
# Date in UNIX time
[Parameter(Mandatory,
ValueFromPipeline=$true)]
[DateTime]
$DateTime
)
[Math]::Floor([decimal](Get-Date($DateTime).ToUniversalTime() -UFormat "%s"))
@quonic
quonic / ConvertTo-Bits.ps1
Last active September 15, 2025 08:27
ConvertTo-Bits converts any string, number or an array of numbers to a bit array object
function ConvertTo-Bits {
<#
.SYNOPSIS
This converts any string, number or an array of numbers to a bit array object
.DESCRIPTION
This converts any string, number or an array of numbers to a bit array object
.PARAMETER InputObject
Accepts any object, but String or Number is expected
@quonic
quonic / Powerpoint.ps1
Created January 22, 2019 22:47
Sample of how to create a PowePoint slide and get the text of a shape
$Application = New-Object -ComObject PowerPoint.Application
# Make PowerPoint visible during debug
$Application.Visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
# Create a new presentation
$Application.Presentations.Add([Microsoft.Office.Core.MsoTriState]::msoTrue)
# Add a slide
# Yes... index starts at 1...
$Application.Presentations[1].Slides.Add(1,1)
# Get the text of the first shape in the first slide
$Application.Presentations[1].Slides[1].Shapes[1].TextFrame2.TextRange.Text
@quonic
quonic / Rename-DiscordCacheImagesToExt
Created February 14, 2019 06:47
Some example code to rename discord cached images
# Function to figure out what the file type is
function Get-ImageExt {
[CmdletBinding()]
# [OutputType([System.Boolean])]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[Alias('PSPath')]
[string] $Path
)
@quonic
quonic / install-autoupgrade.sh
Created March 3, 2019 07:06
This add an auto upgrade to cron for debian/ubuntu
crontab -l > mycron
echo "0 2 * * * apt-get update" >> mycron
echo "0 3 * * * apt-get -y dist-upgrade" >> mycron
echo "0 4 * * * apt-get -y upgrade" >> mycron
crontab mycron
rm mycron