Skip to content

Instantly share code, notes, and snippets.

@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@cchurch
cchurch / py2clixml.py
Created October 22, 2014 22:52
Convert basic Python objects to PowerShell CLIXML format
def clixml(a, top=True):
import xml.etree.ElementTree as ET
if top:
objects = ET.Element('Objects')
obj = clixml(a, top=False)
obj.tag = 'Object'
objects.append(obj)
return ET.tostring(objects)
elif a is None:
return ET.Element('Property')
@HarmJ0y
HarmJ0y / Invoke-Psexec.ps1
Last active September 12, 2022 02:41
Invoke-Psexec
function Invoke-PsExec {
<#
.SYNOPSIS
This function is a rough port of Metasploit's psexec functionality.
It utilizes Windows API calls to open up the service manager on
a remote machine, creates/run a service with an associated binary
path or command, and then cleans everything up.
Either a -Command or a custom -ServiceEXE can be specified.
For -Commands, a -ResultsFile can also be specified to retrieve the
@Jaykul
Jaykul / Manifest.psm1
Last active December 28, 2023 05:34
Update Module Version ... or anything else
function Update-Manifest {
#.Synopsis
# Update a PowerShell module manifest
#.Description
# By default Update-Manifest increments the ModuleVersion, but it can set any key in the Module Manifest, its PrivateData, or the PSData in PrivateData.
#
# NOTE: This cannot currently create new keys, or uncomment keys.
#.Example
# Update-Manifest .\Configuration.psd1
#
@alces
alces / ansible_local_playbooks.md
Last active July 6, 2024 09:49
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@Xainey
Xainey / PowerShell.svg
Created January 1, 2017 22:02
SVG Vector for PowerShell logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@indented-automation
indented-automation / OctoPS.json
Last active October 4, 2017 13:46
Octopus Deploy - Stream redirection
{
"Id": "ActionTemplates-62",
"Name": "OctoPS",
"Description": "A PowerShell host implementation with flexible stream redirection.\n\nThe step parameters may be used to set values for the preference variables. The ErrorActionPreference variable is set to Continue by default for all scripts executing within the host.\n\nPreference variables may be set within scripts, overriding any settings defined by the step. Additional output may be requested using the individual parameters for each stream (for example, the Verbose parameter).\n\n**Limitations and known issues**\n\n- Write-Host is not supported except in PowerShell 5 as a wrapper for Write-Information.\n- Several of the IIS commands (Stop-WebSite, Stop-WebAppPool) appear to break the output streams used by the host.",
"ActionType": "Octopus.Script",
"Version": 13,
"CommunityActionTemplateId": null,
"Properties": {
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
@JustinGrote
JustinGrote / ModuleFast.ps1
Last active July 24, 2023 16:26
Bootstrap Script for a High Performance Module Installer
using namespace System.Net.Http
#requires -version 7.2
# This is the bootstrap script for Modules
[CmdletBinding(PositionalBinding = $false)]
param (
#Specify a specific release to use, otherwise 'latest' is used
[string]$Release = 'latest',
#Specify the user
[string]$User = 'JustinGrote',
#Specify the repo
@dend
dend / toast.ps1
Last active July 16, 2024 17:05
Toast Notification in PowerShell
function Show-Notification {
[cmdletbinding()]
Param (
[string]
$ToastTitle,
[string]
[parameter(ValueFromPipeline)]
$ToastText
)