Skip to content

Instantly share code, notes, and snippets.

$snapins = Get-PSSnapin -Registered
$snapins | Add-PSSnapin
Get-Module -ListAvailable | Import-Module
Get-PSSnapin | Format-Table -autosize PSVersion, Name
Get-Module | Format-Table -autosize ModuleType, Name
function ff ([string] $glob) { get-childitem -recurse -include $glob }
@kardeiz
kardeiz / gist:1723916
Created February 2, 2012 15:13
powershell script to combine multiple xml files
# See best option below
# Option 1: Simple, but breaks with "xml" element
# based on an answer posted on stackoverflow by user "Start-Automating"
# see http://stackoverflow.com/questions/2972264/merge-multiple-xml-files-into-one-using-powershell-2-0
$files = get-childitem "full path to parent directory"
$finalXml = "<xml>"
foreach ($file in $files) {
[xml]$xml = Get-Content $file.fullname
$finalXml += $xml.xml.InnerXml
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 1, 2025 23:36
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@janikvonrotz
janikvonrotz / Get-SysInternals.ps1
Created September 11, 2013 14:57
PowerShell: Get SysInternals #PowerShell
function Get-SysInternals {
param(
[parameter(Mandatory=$false)]
$Path = [string]$(Get-Location) + "\SysInternals\"
)
$Metadata = @{
Title = "Get SysInternals"
Filename = "Get-SysInternals.ps1"
Description = "[Description]"
@PierreMage
PierreMage / PowerShell-profile.ps1
Last active March 16, 2025 10:00
Make your Windows command line better with doskey
# http://technet.microsoft.com/en-us/library/ee692685.aspx
# F7 = history
# Alt+F7 = history -c
# F8 = Ctrl+R
Set-Location C:
# Easier navigation
Set-Alias o start
function oo {start .}
@janikvonrotz
janikvonrotz / Copy-ADGroupMember.ps1
Created October 24, 2013 06:38
PowerShell: PowerShell Manage Group Membership #PowerShell #ActiveDirectory
Get-ADGroupmember "" | %{Add-ADGroupMember -Identity "" -Members $_}
@jas-
jas- / readme.md
Last active February 26, 2024 09:43
Samba FS Active Directory Implementation

Samba Configuration for Active Directory

Kerberos realm authentication using LDAP authorization via MS Windows Active Directory

Some details on the SAMBA configuration. Original Samba, ADS, Winbind documention was found http://gentoo-wiki.com/HOWTO_Adding_a_Samba_Server_into_an_existing_AD_Domain.

Pre-Installation for Gentoo using emerge

This particular installation of Samba requires a few additional packages and features to ensure that Active Directory authentication works properly. In this first step we add the necessary use flags to the Gentoo Portage package system.

@sean-m
sean-m / Set-GroupManager.ps1
Last active July 11, 2024 17:27
Function takes the DN of a group and DN of user as input, sets the group manager as the prescribed user and checks that pesky "can modify group membership" box.
<#
.Synopsis
Takes Group DNs and User DNs and sets the user(s) as managers of the group(s).
.DESCRIPTION
Only changes needed for the group's configuration to match the request are
made, that is if the group already has the same managers in the specified
positions (managedBy vs msExchCoManagedByLink) then nothing is modified.
If no property changes are needed but the rights aren't set correctly,
the necessary ACL rules are applied and extraneous rules are removed.
# This is a powershell commandlet equivalent of build_ui.sh for installation on Windows
# Generate python files based on the designer ui files. pyrcc4 should be on the path.
# If you need to modify the python location or pyuic path, just change the 2 variables below
$pythonPath = "C:\Python27\"
$pyuicPath = "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py"
If (!(Test-Path "designer")) {
Write-Host "Please run this from the project root"
Exit
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.