Skip to content

Instantly share code, notes, and snippets.

View Stephanevg's full-sized avatar
:octocat:
I like computers

Van Gulick Stephanevg

:octocat:
I like computers
View GitHub Profile
# Version 1.2.12
# check if newer version
$gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {
$latestVersion = [System.IO.File]::ReadAllText($latestVersionFile)
$currentProfile = [System.IO.File]::ReadAllText($profile)
// Discord all events!
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!)
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client
// Learn from this, do not just copy it mofo!
//
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
/*
koad-was-here
@Stephanevg
Stephanevg / Get-ServicingStackInfos.ps1
Last active January 28, 2021 11:16
Function to get servicing stack information from WSUS server
Function Get-ServicingStackInfos {
Param(
)
$Hash = @{}
$Updates = Get-WsusUpdate
Foreach($Update in $Updates){
#2021-01 Servicing Stack Update für Windows Server 2019 für x64-basierte Systeme (KB4598480)
@Stephanevg
Stephanevg / ConvertScriptTo-Function.ps1
Created August 10, 2020 09:21
Converts a script saved in a ps1 file to a function for testability.
### This works
## Content of C:\Plop.ps1
Write-host "plop"
# Code to import a script file as function
$Content = Get-Content C:\plop.ps1 -raw
@Stephanevg
Stephanevg / settings.json
Created July 1, 2020 16:27
vscode settings.json backup
{
#%APPDATA%\Code\User\settings.json
"terminal.integrated.shell.osx": "C:/Program Files/PowerShell/7/pwsh.exe",
"files.defaultLanguage": "powershell"
}
@Stephanevg
Stephanevg / ImportScriptAs-Function.ps1
Last active June 29, 2020 12:41
create a function based on a file (Second example doesn't work due to scoping issues)
### This works
## Content of C:\Plop.ps1
Write-host "plop"
# Code to import a script file as function
$Content = Get-Content C:\plop.ps1 -raw
@Stephanevg
Stephanevg / Add-WinRMDaclRule.ps1
Created June 24, 2020 09:04 — forked from jborean93/Add-WinRMDaclRule.ps1
Adds a rule to the WinRM DACL list
Function Add-WinRMDaclRule {
<#
.SYNOPSIS
Add a Discretionary Acl rule to the root WinRM listener or individual PSSession configuration.
.DESCRIPTION
Add a Discretionary Acl rule to the root WinRM listener or individual PSSession configuration.
This can be useful if you wish to give access to an individual user or group to either the root WinRM listener or
a specific PSSession configuration that is not an Administrator.
@Stephanevg
Stephanevg / Guido_02.ps1
Created May 3, 2020 08:58
Added A bootstrap 'container' class to the main div section so everything will be centralized
$HTML = html {
head {
Write-PSHTMLAsset # This simple command will add a local link to the Jquery / Chartjs and bootstrap frameworks.
# It wil allow to work with them without internet connection BUT it won't work if you send you html document per mail for example as it needs the ref to the local files.
}
body {
@Stephanevg
Stephanevg / guido_01.ps1
Created May 3, 2020 08:52
Updated Example from Guido
$HTML = html {
head {
Write-PSHTMLAsset # This simple command will add a local link to the Jquery / Chartjs and bootstrap frameworks.
# It wil allow to work with them without internet connection BUT it won't work if you send you html document per mail for example as it needs the ref to the local files.
}
body {
@Stephanevg
Stephanevg / vagrantfile.rb
Last active February 24, 2020 17:01
vagrant file to provision an Ansible server with a windows client (server)
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: "echo Hello"
config.vm.define "ansiblesrv" do |ansiblesrv|
ansiblesrv.vm.box = "centos/7"
ansiblesrv.vm.provision "shell", inline: <<-SHELL
sudo yum update
sudo yum install ansible -y
sudo yum install epel-release -y
sudo yum install python-pip -y