This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
# import math | |
from itertools import * | |
import numpy as np | |
import pygame | |
# from past.builtins import xrange | |
from profilehooks import profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Sync-AD { | |
Param( | |
[Credential] | |
$Credential=$(Get-Credential) | |
) | |
$splatme = @{ | |
ComputerName = Get-ADDomainController -Filter {Name -like "*"} | |
ScriptBlock = { | |
Import-Module -Name 'ADSync' | |
Start-ADSyncSyncCycle -PolicyType Delta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Factor { | |
param ( | |
[Parameter(Mandatory = $true, | |
Position = 0, | |
ValueFromPipeline = $true)] | |
[ValidateNotNullOrEmpty()] | |
[int64[]] | |
$Number, | |
[switch] |