Skip to content

Instantly share code, notes, and snippets.


Jim Caten quonic

View GitHub Profile
quonic / Get-LastestPowershellCoreMSI.ps1
Created Mar 4, 2020
Checks if the current running Powershell Core environment is the latest version and download if it isn't
View Get-LastestPowershellCoreMSI.ps1
[Version]$ReleaseVersion = (Invoke-RestMethod -replace '^v'
if ($PSVersionTable.PSEdition -like "Core" -and $ReleaseVersion -gt $PSVersionTable.PSVersion) {
$latest = Invoke-RestMethod -Uri "" | 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)"
quonic /
Created Jul 2, 2019
Example of static screen at about 4 fps on a ryzen 7 1800X.
import sys
import random
# import math
from itertools import *
import numpy as np
import pygame
# from past.builtins import xrange
from profilehooks import profile
quonic /
Last active Apr 25, 2019
Untested: This should update the exchange rates of the Currency entities. Does require an AutoTask account to have access to multi-currencies.
# MIT license
# Created by Quonic on 4/23/2019
import atws
import getpass
import pprint
import keyring
import requests
def save_creds(creds_username, creds_password):
quonic / ADSync.ps1
Created Apr 8, 2019
Untested: This will sync AD on all Domain Controllers
View ADSync.ps1
Function Sync-AD {
$splatme = @{
ComputerName = Get-ADDomainController -Filter {Name -like "*"}
ScriptBlock = {
Import-Module -Name 'ADSync'
Start-ADSyncSyncCycle -PolicyType Delta
quonic /
Created Mar 3, 2019
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
quonic / Rename-DiscordCacheImagesToExt
Created Feb 14, 2019
Some example code to rename discord cached images
View Rename-DiscordCacheImagesToExt
# Function to figure out what the file type is
function Get-ImageExt {
# [OutputType([System.Boolean])]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[string] $Path
quonic / Powerpoint.ps1
Created Jan 22, 2019
Sample of how to create a PowePoint slide and get the text of a shape
View Powerpoint.ps1
$Application = New-Object -ComObject PowerPoint.Application
# Make PowerPoint visible during debug
$Application.Visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
# Create a new presentation
# Add a slide
# Yes... index starts at 1...
# Get the text of the first shape in the first slide
quonic / ConvertTo-Bits.ps1
Last active Jan 4, 2019
ConvertTo-Bits converts any string, number or an array of numbers to a bit array object
View ConvertTo-Bits.ps1
function ConvertTo-Bits {
This converts any string, number or an array of numbers to a bit array object
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 / ConvertTo-UnixTime.ps1
Last active Apr 18, 2019
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.
View ConvertTo-UnixTime.ps1
function ConvertTo-UnixTime {
# Date in UNIX time
[Math]::Floor([decimal](Get-Date($DateTime).ToUniversalTime() -UFormat "%s"))
quonic / Test-Prime.ps1
Created Nov 6, 2018
Get-Factor and Test-Prime functions that are fairly fast, for Powershell
View Test-Prime.ps1
function Get-Factor {
param (
[Parameter(Mandatory = $true,
Position = 0,
ValueFromPipeline = $true)]