Skip to content

Instantly share code, notes, and snippets.

View adilio's full-sized avatar
Just a boy. Sitting in front of a console. Asking it to do stuff.

Adil Leghari adilio

Just a boy. Sitting in front of a console. Asking it to do stuff.
View GitHub Profile
@adilio
adilio / New-CSRepository.ps1
Last active June 24, 2022 22:56
Walk through of setting up a PowerShell Repo in Cloudsmith
# Create a user account at cloudsmith.io
# Create an Org and Repository at cloudsmith.io
# In your PowerShell console,
# check that PSGallery repo is present only
Get-PSRepository
# Build Repository Source URI
$RepoName = 'YOUR-REPO-NAME'
$OrgName = 'YOUR-ORG'
@adilio
adilio / New-CSRepository.ps1
Last active April 24, 2022 09:04
Run-through of creating a new Cloudsmith repository and pushing PowerShell modules to and from it.
# Create a user account at cloudsmith.io
# Create an Org and Repository at cloudsmith.io
# Build Repository Source URI
$RepoName = 'psdemo'
$User = 'YOUR_USER_NAME_HERE'
$RepoSource = "https://nuget.cloudsmith.io/$User/$RepoName/v2/"
# We needa a PSCredential to upload to repo
$Key = $ENV:CLOUDSMITH_API_KEY
@adilio
adilio / DSC-QDE-Setup.md
Last active March 30, 2021 08:10
Setting up Chocolatey for Business (C4B) with Quick Deployment Environment (QDE) using Desired State Configuration (DSC)

Setting up C4b with QDE using DSC

Setting up Chocolatey for Business (C4B) with Quick Deployment Environment (QDE) using Desired State Configuration (DSC)

Prerequisites

  1. Install NuGet and PowerShellGet, and trust the PowerShell Gallery:
Install-PackageProvider -Name NuGet -Force
@adilio
adilio / Update-SonatypeNexus.ps1
Created August 7, 2020 02:38
The latest Nexus version, 3.25.1*, does not upgrade smoothly. New exe version is not pointed to, and SSL certs are not preserved. This script is a workaround for that, with Chocolatey running the upgrade piece.
Stop-Service nexus
#Backup SSL Configuration
if(-not (Test-Path C:\nexusbackup)){
New-Item C:\nexusbackup -ItemType Directory
}
if(Test-Path C:\ProgramData\nexus\etc\ssl\keystore.jks){
Copy-Item C:\ProgramData\nexus\etc\ssl\keystore.jks C:\nexusbackup
}
@adilio
adilio / keybase.md
Created August 20, 2019 19:01
keybase

Keybase proof

I hereby claim:

  • I am adilio on github.
  • I am adilio (https://keybase.io/adilio) on keybase.
  • I have a public key ASAA457_y7Q9ce12VjfS7_kOWi4Bl_bLrqIZvqVA3RzStAo

To claim this, I am signing this object:

@adilio
adilio / Set-SlackDark.ps1
Created July 18, 2019 04:06
Enables Slack Dark Mode for versions 3.4.1 and later
# Author: Colin Andress
# Modified by: adilio
# Github Link: https://github.com/Column01
Write-Output 'Getting Windows User and Slack version'
$user = $env:UserName
if (Test-Path -Path "C:\Users\$user\AppData\Roaming\Slack\storage\slack-settings") {
$json = Get-Content "C:\Users\$user\AppData\Roaming\Slack\storage\slack-settings" | Out-String | ConvertFrom-Json
}
else {
Write-Output 'Unable to find the slack version info. Is slack installed from the windows store? Make sure it is from the slack website!'
@adilio
adilio / bootstrap.bat
Created February 24, 2019 09:33
VM Customization Bootstrap script, to prepare for Ansible management
@echo off
if "%1%" == "precustomization" (
echo No pre-customization tasks to run
) else if "%1%" == "postcustomization" (
echo Running post-customization tasks
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
# Run this script in an elevated prompt, and quit and reload Slack after
$slackBaseDir = "C:\Program Files\Slack\"
$installations = Get-ChildItem $slackBaseDir -Directory | Where-Object { $_.Name.StartsWith("app-") }
$version = $installations | Sort-Object { [version]$_.Name.Substring(4) } | Select-Object -Last 1
Write-Output "Choosing highest present Slack version: $version"
$customContent = @'
// First make sure the wrapper app is loaded
@adilio
adilio / Test.md
Last active August 20, 2020 06:05

Compatibility

OS Family OS Name Version Module Tested Module Working
Linux RHEL Server 6 No No
Linux RHEL Server 7 No No
Linux Ubuntu Server 14.04 LTS No No
Linux Ubuntu Server 16.04 LTS No No
Windows Windows Server 2008 R2 No No
Windows Windows Server 2012 R2 No No
@adilio
adilio / Write-Log.ps1
Last active October 29, 2018 05:41
Simple function to write to a log file
<#
Write-Log.ps1
20181027 - 4dilio
Simple function to write to a log file.
You MUST define $Log in your script.
#>
function Write-Log {
[CmdletBinding()]
param(