Skip to content

Instantly share code, notes, and snippets.

@onyxhat
onyxhat / Create-LinuxVM.ps1
Created August 15, 2018 15:44
Hyper-V script to Automate creation of Linux VMs
$Settings = New-Object PsObject -Property @{
Name = Read-Host "VM Name"
vCPU = Read-Host "vCPU Count"
MemoryStartupBytes = [int]$(Read-Host "GB of RAM") * 1GB
ImgSrc = Read-Host "Source VHD Location"
}
$vmhost = Get-VMHost
if ((Get-VM -Name $Settings.Name -ErrorAction SilentlyContinue) -or (Test-Path -Path "$($vmhost.VirtualHardDiskPath)\$($Settings.Name).vhdx")) {
[string]$UserName = "myJenkinsUser"
[string]$Jenkins_Token = "myJenkinsUserApiKey"
[uri]$Build_URL = "http://jenkins.local/job/myAwesomeApp/latest/"
$Headers = @{
"Authorization" = "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${UserName}:${Jenkins_Token}"))
}
$jobObj = Invoke-RestMethod -Headers $Headers -Uri "${Build_URL}/api/json"
$jobObj
Param (
[string]$VMName,
[int]$vCPU,
[int]$MemoryGB
)
$Settings = New-Object PsObject -Property @{
Name = $VMName
vCPU = $vCPU
MemoryStartupBytes = [int]$MemoryGB * 1GB
@onyxhat
onyxhat / printenv.groovy
Created February 26, 2019 18:44 — forked from dbt4u/printenv.groovy
Jenkins Groovy to print all env-variables
def env = System.getenv()
env.each{
println it
}
@onyxhat
onyxhat / get_myip.php
Created March 10, 2019 04:59
simple PHP script to return client IP address
<?php
/**
* Ensures an ip address is both a valid IP and does not fall within
* a private network range.
*/
function validate_ip($ip) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
return false;
}
return true;
@onyxhat
onyxhat / Export-Terraformer.ps1
Created May 23, 2022 20:15
Terraformer Export Helper
[CmdletBinding()]
param (
[Parameter()]
[string]
$aws_profile = "VirtixProd",
[Parameter()]
[string[]]
$aws_region = @("us-east-2"),
@onyxhat
onyxhat / steam-headless-setup.sh
Created December 7, 2025 15:44
Setup Steam-Headless Directories
#!/usr/bin/env bash
# Load env vars (compatible with Komodo)
export $(cat .env | grep -vE '^#|^$|^USER_LOCALES' | xargs)
# Make directories (if not exists)
mkdir -p "${HOME_DIR}"
mkdir -p "${SHARED_SOCKETS_DIR}"/{home,.X11-unix,pulse}
mkdir -p "${GAMES_DIR}"