This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ensure-package-installed (&rest packages) | |
"Assure every package is installed, ask for installation if it’s not. | |
Return a list of installed packages or nil for every package not installed." | |
(mapcar | |
(lambda (package) | |
(package-installed-p 'evil) | |
(if (package-installed-p package) | |
package | |
(if (y-or-n-p (format "Package %s is missing. Install it? " package)) | |
(package-install package) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
SVN Access Level Enum Values | |
---------------------------- | |
No Access = 0 | |
Read Only = 1 | |
Read Write = 2 | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Configuration for log-reader.ps1 | |
This file is only read if log-reader.ps1 is invoked without arguments | |
from the command-line. This file will configure any tunable variabes | |
in log-reader.ps1. Thus far, the only setting is which logs to track. | |
#> | |
[string[]]$logname = $("Application", "System", "Security") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Takes and ACL and SID, returns an ACL with the correct entries for modify permissions added. | |
function Add-ModAce { | |
param ( | |
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true)] | |
[System.Security.AccessControl.FileSystemSecurity]$ACL, | |
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$false, ValueFromPipelinebyPropertyName=$true)] | |
[System.Security.Principal.IdentityReference]$SID | |
) | |
# Rule applies to parent container, does not propagate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Allow user to enter password | |
*/ | |
Console.Write ("Please enter your password (12 - 256 chars)\nand press (Enter|Return): "); | |
bool entered = false; | |
ConsoleKeyInfo pwIn; | |
string pw; | |
StringBuilder sb = new StringBuilder (); | |
do { | |
pwIn = Console.ReadKey (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("Netapi32.dll", CharSet = CharSet.Auto/*, SetLastError=true //Return value (NET_API_STATUS) contains error */)] | |
public static extern int NetDfsEnum( | |
[MarshalAs(UnmanagedType.LPWStr)]string DfsName, | |
int Level, | |
int PrefMaxLen, | |
out IntPtr Buffer, | |
[MarshalAs(UnmanagedType.I4)]out int EntriesRead, | |
[MarshalAs(UnmanagedType.I4)]ref int ResumeHandle); | |
const int MAX_PREFERRED_LENGTH = 0xFFFFFFF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Takes one or more UNC formatted DFS namespace paths and returns the names and | |
targets of all links contained in that namespace. | |
.DESCRIPTION | |
PowerShell wrapper around a C# class which uses .Net native interop for | |
calling into Netapi32.dll NetDfsEnum native system call. Which returns | |
a List<DFSLink> (list of structs) and is converted to a PowerShell array | |
of DFSLink. DFSLink contains 2 members [string]name and [string[]]target. | |
.PARAMETER Path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cd = $(Split-Path -parent $MyInvocation.MyCommand.Definition) | |
cd $cd | |
<# | |
Code that doesn't change goes in this file which just | |
loads functions and executes them. The function loading | |
logic could even exist in another while which is dot-included. | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using Microsoft.Office.Interop.Excel; | |
/* Simple command line utility for merging spreadsheets and | |
* addings some formatting. There are bugs and some exceptions | |
* are not handled gracefully, in my case it does what I need | |
* so here it is. | |
* -Sean McArdle |
OlderNewer