Matthew Moses avatar Matthew Moses committed 00c460f

Move PowerShell stuff to its own repository.

Comments (0)

Files changed (3)

powershell/FileSystem.format.ps1xml

-<?xml version="1.0" encoding="utf-8" ?>
-<Configuration>
-    <SelectionSets>
-        <SelectionSet>
-            <Name>FileSystemTypes</Name>
-            <Types>
-                <TypeName>System.IO.DirectoryInfo</TypeName>
-                <TypeName>System.IO.FileInfo</TypeName>
-            </Types>
-        </SelectionSet>
-    </SelectionSets>
-    <Controls>
-        <Control>
-            <Name>FileSystemTypes-GroupingFormat</Name>
-            <CustomControl>
-                <CustomEntries>
-                    <CustomEntry>
-                        <CustomItem>
-                            <Frame>
-                                <LeftIndent>4</LeftIndent>
-                                <CustomItem>
-                                    <Text AssemblyName="System.Management.Automation" BaseName="FileSystemProviderStrings" ResourceId="DirectoryDisplayGrouping"/>
-                                    <ExpressionBinding>
-                                        <ScriptBlock>$_.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")</ScriptBlock>
-                                    </ExpressionBinding>
-                                    <NewLine/>
-                                </CustomItem>
-                            </Frame>
-                        </CustomItem>
-                    </CustomEntry>
-                </CustomEntries>
-            </CustomControl>
-        </Control>
-    </Controls>
-    <ViewDefinitions>
-       <View>
-            <Name>children</Name>
-            <ViewSelectedBy>
-                <SelectionSetName>FileSystemTypes</SelectionSetName>
-            </ViewSelectedBy>
-            <GroupBy>
-                <PropertyName>PSParentPath</PropertyName>
-                <CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
-            </GroupBy>
-            <TableControl>
-                <TableHeaders>
-                   <TableColumnHeader>
-                      <Label>Mode</Label>
-                      <Width>7</Width>
-                      <Alignment>left</Alignment>
-                   </TableColumnHeader>
-                    <TableColumnHeader>
-                        <Label>LastWriteTime</Label>
-                        <Width>25</Width>
-                        <Alignment>right</Alignment>
-                    </TableColumnHeader>
-                    <TableColumnHeader>
-                        <Label>Length</Label>
-                        <Width>10</Width>
-                        <Alignment>right</Alignment>
-                    </TableColumnHeader>
-                    <TableColumnHeader/>
-                </TableHeaders>
-                <TableRowEntries>
-                    <TableRowEntry>
-                        <Wrap/>
-                        <TableColumnItems>
-                            <TableColumnItem>
-                                <PropertyName>Mode</PropertyName>
-                            </TableColumnItem>
-                            <TableColumnItem>
-                                <ScriptBlock>
-                                    '{0:yyyy-MM-dd  HH:mm:ss}' -f $_.LastWriteTime
-                                </ScriptBlock>
-                            </TableColumnItem>
-                            <TableColumnItem>
-                           	<PropertyName>Length</PropertyName>
-                            </TableColumnItem>
-                            <TableColumnItem>
-                                <PropertyName>Name</PropertyName>
-                            </TableColumnItem>
-                        </TableColumnItems>
-                    </TableRowEntry>
-                </TableRowEntries>
-            </TableControl>
-        </View>
-        <View>
-            <Name>children</Name>
-            <ViewSelectedBy>
-                <SelectionSetName>FileSystemTypes</SelectionSetName>
-            </ViewSelectedBy>
-            <GroupBy>
-                <PropertyName>PSParentPath</PropertyName>
-                <CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
-            </GroupBy>
-            <ListControl>
-                <ListEntries>
-                    <ListEntry>
-                        <EntrySelectedBy>
-                            <TypeName>System.IO.FileInfo</TypeName>
-                        </EntrySelectedBy>
-                        <ListItems>
-                            <ListItem>
-                                <PropertyName>Name</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>Length</PropertyName>
-                            </ListItem>
-                           <ListItem>
-                                <PropertyName>CreationTime</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>LastWriteTime</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>LastAccessTime</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>VersionInfo</PropertyName>
-                            </ListItem>
-                        </ListItems>
-                    </ListEntry>
-                    <ListEntry>
-                        <ListItems>
-                            <ListItem>
-                                <PropertyName>Name</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>CreationTime</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>LastWriteTime</PropertyName>
-                            </ListItem>
-                            <ListItem>
-                                <PropertyName>LastAccessTime</PropertyName>
-                            </ListItem>
-
-                        </ListItems>
-                    </ListEntry>
-                </ListEntries>
-            </ListControl>
-        </View>
-        <View>
-            <Name>children</Name>
-            <ViewSelectedBy>
-                <SelectionSetName>FileSystemTypes</SelectionSetName>
-            </ViewSelectedBy>
-            <GroupBy>
-                <PropertyName>PSParentPath</PropertyName>
-                <CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
-            </GroupBy>
-            <WideControl>
-                <WideEntries>
-                    <WideEntry>
-                        <WideItem>
-                            <PropertyName>Name</PropertyName>
-                        </WideItem>
-                    </WideEntry>
-                    <WideEntry>
-                        <EntrySelectedBy>
-                            <TypeName>System.IO.DirectoryInfo</TypeName>
-                        </EntrySelectedBy>
-                        <WideItem>
-                            <PropertyName>Name</PropertyName>
-                            <FormatString>[{0}]</FormatString>
-                        </WideItem>
-                    </WideEntry>
-                </WideEntries>
-            </WideControl>
-        </View>
-        <View>
-            <Name>FileSecurityTable</Name>
-            <ViewSelectedBy>
-                <TypeName>System.Security.AccessControl.FileSystemSecurity</TypeName>
-            </ViewSelectedBy>
-            <GroupBy>
-                <PropertyName>PSParentPath</PropertyName>
-                <CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
-            </GroupBy>
-            <TableControl>
-                <TableHeaders>
-                   <TableColumnHeader>
-                      <Label>Path</Label>
-                   </TableColumnHeader>
-                   <TableColumnHeader />
-                   <TableColumnHeader>
-                      <Label>Access</Label>
-                   </TableColumnHeader>
-                </TableHeaders>
-                <TableRowEntries>
-                    <TableRowEntry>
-                        <TableColumnItems>
-                            <TableColumnItem>
-                                <ScriptBlock>
-                                    split-path $_.Path -leaf
-                                </ScriptBlock>
-                            </TableColumnItem>
-                            <TableColumnItem>
-                           	<PropertyName>Owner</PropertyName>
-                            </TableColumnItem>
-                            <TableColumnItem>
-                                <ScriptBlock>
-                                    $_.AccessToString
-                                </ScriptBlock>
-                            </TableColumnItem>
-                        </TableColumnItems>
-                    </TableRowEntry>
-                </TableRowEntries>
-            </TableControl>
-        </View>
-    </ViewDefinitions>
-</Configuration>

powershell/Microsoft.PowerShell_profile.ps1

-# PowerShell's default formatting for listing file system dates and times
-# ignores regional settings, so I had to modify it.
-Update-FormatData -PrependPath (Join-Path (Split-Path -Parent $profile) FileSystem.format.ps1xml)
-
-Set-Variable -Description 'Whether we have administrator privileges.' `
-	-Option Constant `
-	-Name 'isAdministrator' `
-	-Value ([Security.Principal.WindowsPrincipal] ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
-
-# In some circumstances (when run as administrator and at work), PowerShell
-# will not come up in my home folder. This gets around that.
-if ($env:userprofile -and $env:userprofile -ne (Get-Location)) {
-	Set-Location $env:userprofile
-}
-
-#
-# .SYNOPSIS
-# Creates a new, random GUID.
-#
-# .DESCRIPTION
-# This function will create at least one new, random GUID. Multiple GUIDs may
-# be created at once using the Count parameter.
-#
-# .PARAMETER Count
-# The number of GUIDs to generate. At least one GUID will always be generated,
-# even if the value of Count is less than 1.
-#
-function Get-Guid {
-	param ([int] $Count = 1)
-	if ($Count -lt 1) {
-		$Count = 1
-	}
-	for ($i = $Count; $i -gt 0; $i -= 1) {
-		[System.Guid]::NewGuid()
-	}
-}
-
-function prompt {
-	$divColor = 'darkyellow'
-	$pwdColor = 'cyan'
-	$userColor = 'green'
-	$divText = '$'
-
-	# The prompt will appear differently if we're running as administrator on
-	# something better than Windows XP.
-	if (([System.Environment]::OSVersion.Version.Major -ge 6) -and $isAdministrator) {
-		$divText = '#'
-		$divColor = 'darkmagenta'
-		$pwdColor = 'cyan'
-		$userColor = 'red'
-	}
-
-	Write-Host "$env:username@$($env:computername.ToLower()) " -Fore $userColor -NoNewline
-
-	$pwd = Get-Location
-	$pwdText = $null
-	if ($pwd.Provider.Home -eq $pwd.Path) {
-		$pwdText = '~ '
-	} else {
-		$pwdText = "$(Split-Path -Leaf $pwd) "
-	}
-
-	Write-Host $pwdText -ForegroundColor $pwdColor -NoNewline
-	Write-Host $divText -ForegroundColor $divColor -NoNewline
-	' '
-}

powershell/install.cfg

-[install.windows]
-FileSystem.format.ps1xml = ${home}\Documents\WindowsPowerShell\FileSystem.format.ps1xml
-Microsoft.PowerShell_profile.ps1 = ${home}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.