Skip to content

Instantly share code, notes, and snippets.

View MacsInSpace's full-sized avatar

Craig Hair MacsInSpace

  • Department of Education
  • Melbourne
  • 05:31 (UTC +10:00)
View GitHub Profile
@stuartsmith78
stuartsmith78 / domain-join.ps1
Created July 13, 2023 15:51
Custom Domain Join for MDT
<#
.SOLUTION
.FILENAME domain-join.ps1
Joins a computer to the targeted domain, using a retrieved credential, deleting the old account
.DESCRIPTION
.PARAMETER -Join
@SMSAgentSoftware
SMSAgentSoftware / PSEncryptDecrypt.ps1
Last active January 10, 2025 15:20
PowerShell examples for symmetric and asymmetric encryption with the .Net cryptography model
# Example code for encrypting and decrypting secrets with .Net cryptography using either symmetric or asymmetric encryption
###################################
## SYMMETRIC ENCRYPTION ##
## Using AES 256-bit in CBC mode ##
###################################
# Create an AES key and Initialization vector
$AES = [System.Security.Cryptography.Aes]::Create()
$Key = [System.Convert]::ToBase64String($aes.Key)
@eisenreich
eisenreich / wait_for_http_200.sh
Last active July 5, 2024 16:20 — forked from rgl/wait_for_http_200.sh
Wait for HTTP endpoints to return 200 OK with bash, curl and timeout
#!/bin/bash
##############################################################################################
# Wait for URLs until return HTTP 200
#
# - Just pass as many urls as required to the script - the script will wait for each, one by one
#
# Example: ./wait_for_urls.sh "${MY_VARIABLE}" "http://192.168.56.101:8080"
##############################################################################################
@hugefiver
hugefiver / set_proxy.ps1
Last active August 12, 2024 02:53
powershell set default proxy for `Invoke-WebRequest`
# set to system default proxy
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
# or a custom one
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080")
# or use username and password auth
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080",$true)
[System.Net.WebRequest]::DefaultWebProxy.Credentials = New-Object System.Net.NetworkCredential($user, $passwd)
@echo off
:======================================================================================================================================================
:Thanks to abbodi1406 for SppExtComObjPatcher-kms\2-Activate-Local.cmd, which used as base in this script
:Thanks to rpo for the Great and Continued help in improving this script.
:Thanks to AR_Alex for the ideas and suggestions.
:======================================================================================================================================================
::===========================================================================
fsutil dirty query %systemdrive% >nul 2>&1 || (
@zbalkan
zbalkan / Start-WindowsActivation.ps1
Last active February 8, 2025 16:08
It's a drop-in replacement for slmgr.vbs script
#Requires -RunAsAdministrator
#Requires -Version 5
<#
.Synopsis
Activates Windows via KMS
.DESCRIPTION
It's a drop in replacement for slmgr scripts
.EXAMPLE
Start-WindowsActivation -Verbose # Activates the local computer
.EXAMPLE
@bonomali
bonomali / gist:cb440122bcac485ae56b29d09c7e863d
Created March 11, 2020 03:22 — forked from rtrouton/gist:a01073797a6d7e1fff9a
Disable Apple iCloud and Diagnostic Pop-Ups
#!/bin/bash
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
sw_vers=$(sw_vers -productVersion)
# Determine OS build number
sw_build=$(sw_vers -buildVersion)
@arainho
arainho / mdm_check.sh
Last active June 13, 2024 08:48
Check whether DEP is present and MDM enrollment is user-approved.
#!/usr/bin/env bash
# Check if a machine was enrolled via DEP (10.13+)
# Show whether a machine has a device enrollment profile (DEP) present (10.13.0+),
# and if the MDM enrollment is user approved (10.13.4+)
/usr/bin/profiles status -type enrollment
# Checking for a DEP profile on macOS
# Display the DEP profile for a macOS device in 10.13 and above:
sudo /usr/bin/profiles show -type enrollment
@aslamanver
aslamanver / adb-url-install.sh
Last active July 20, 2022 07:20
Install application APK from URL using ADB (Android Developer Bridge)
#!/bin/bash
BASEDIR=$(dirname "$0")
FILE=$(basename "$1")
EXTENSION="${FILE##*.}"
if [[ $EXTENSION == "apk" ]]; then
@palevell
palevell / utils.py
Created December 28, 2019 21:06
Plugging Tweepy into the Django-Allauth package was easier than I thought.
# utils.py - Saturday, December 28, 2019
# -*- coding: utf-8 -*-
""" I have been experimenting to see which web framework would make the better
wrapper for Tweepy. I decided on Django, with the Allauth package.
Afer going through the Django-Allauth Tutorial at
https://wsvincent.com/django-allauth-tutorial/ and playing with the DjangoTweepy repository at
https://github.com/martinjc/DjangoTweepy/blob/master/src/twitter_auth/utils.py,
this is what I contrived.