Last active
August 29, 2015 13:56
-
-
Save togakangaroo/8833104 to your computer and use it in GitHub Desktop.
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
$tempDir = ([system.io.path]::GetTempPath()) | |
Import-Module pscx 2>$null | |
$Pscx:Preferences['TextEditor'] = 'C:\Program Files\Sublime Text 3\subl.exe' | |
set-alias edit Edit-File -Scope Global | |
Set-Alias vim 'C:\Program Files (x86)\vim\vim74\vim.exe' | |
Set-Alias vi vim | |
Import-Module z | |
#if(-not $env:OwPassword) { | |
# $env:OwPassword = (Get-Credential OWEX\George.Mauer).GetNetworkCredential().Password | |
#} | |
# function edit | |
# { | |
# param( [Parameter(ValueFromPipeline=$true,Position=0)] $file ) | |
# begin { set-alias EDITOR 'W:\tools\sublime_text.bat' } | |
# process { EDITOR $file } | |
# } | |
function Coalesce-Args { | |
(@($args | ?{$_}) + $null)[0] | |
} | |
function Change-ToNewDirectory($directoryName) { | |
mkdir $directoryName | |
cd $directoryName | |
} | |
Set-Alias ?? Coalesce-Args | |
Set-Alias nuget W:\tools\NuGet.exe | |
Set-Alias hgworkbench 'C:\Program Files\TortoiseHg\thg.exe' | |
Set-Alias hg 'C:\Program Files\TortoiseHg\hg.exe' | |
Set-Alias erlang 'C:\Program Files\erl5.9.3.1\bin\erl.exe' | |
Set-Alias ss Select-String | |
Set-Alias vpn 'C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient.exe' | |
pushd . | |
import-module sqlps -DisableNameChecking | |
popd | |
function Find-File([string]$pattern="*", $startAt=".") { | |
return Get-ChildItem $startAt -Recurse -Include $pattern | |
} | |
function Find-InFile([string]$searchFor=1, $filePattern="*", $startAt=".") { | |
$found = Find-File -pattern $filePattern -startAt $startAt | Select-String $searchFor | |
if($found -eq $null) { | |
Write-Host "No files found" | |
return | |
} | |
if($found.Count) { # There is more than one | |
do { | |
Write-Host "Please select file (Ctrl+C to quit)" | |
for($i=0;$i -lt $found.Count;$i=$i+1) { Write-Host "($i) - $($found[$i])" } | |
$idx = Read-Host | |
$selected = $found[$idx] | |
}until($selected) | |
} | |
else { $selected = $found } | |
edit "$($selected.Path):$($selected.LineNumber)" | |
} | |
function Open-CurrentVsd { | |
pushd . | |
cd '\\VBOXSVR\gmauer\Dropbox\Preso Builder\Bill Manager' | |
$curr = ls 'BM*.vsd' | sort LastWriteTime -Descending | select -First 1 | |
#cp $curr c:\temp | |
#cd c:\temp | |
#ii $curr.Name | |
ii $curr | |
popd | |
} | |
function Open-Solution([string]$path = ".") { | |
$sln_files = Get-ChildItem $path -Include *.sln -Recurse | |
if($sln_files -eq $null) { | |
Write-Host "No Solution file found" | |
return | |
} | |
if($sln_files.Count) { # There is more than one | |
do { | |
Write-Host "Please select file (or Ctrl+C to quit)" | |
for($i=0;$i -lt $sln_files.Count;$i=$i+1) { Write-Host "($i) - $($sln_files[$i])" } | |
$idx = Read-Host | |
$sln = $sln_files[$idx] | |
}until($sln) | |
} | |
else { $sln = $sln_files } | |
Invoke-Item $sln | |
} | |
set-alias mongoose W:\tools\mongoose_aug12.exe | |
function Remove-Trash( | |
[Parameter(Position=0, Mandatory=$false)][string]$Drive = "", | |
[switch]$NoConfirmation, | |
[switch]$NoProgressGui, | |
[switch]$NoSound | |
) { | |
add-type @" | |
using System; | |
using System.Runtime.InteropServices; | |
using Microsoft.Win32; | |
namespace recyclebin | |
{ | |
public class Empty | |
{ | |
[DllImport("shell32.dll")] | |
static extern int SHEmptyRecycleBin(IntPtr hWnd, string pszRootPath, uint dwFlags); | |
public static void EmptyTrash(string RootDrive, uint Flags) | |
{ | |
SHEmptyRecycleBin(IntPtr.Zero, RootDrive, Flags); | |
} | |
} | |
} | |
"@ | |
[int]$Flags = 0 | |
if ( $NoConfirmation ) { $Flags = $Flags -bor 1 } | |
if ( $NoProgressGui ) { $Flags = $Flags -bor 2 } | |
if ( $NoSound ) { $Flags = $Flags -bor 4 } | |
[recyclebin.Empty]::EmptyTrash($RootPath, $Flags) | |
} | |
set-alias sudo w:/tools/sudo.ps1 | |
New-PSDrive HOST -PSProvider FileSystem -Root \\vboxsvr\gmauer | |
New-PSDrive STORE -PSProvider FileSystem -Root \\vboxsvr\store | |
cd W:\ | |
################################################################### | |
set-alias adb 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' | |
function Invoke-AsAdmin($file) { | |
sudo powershell (Resolve-Path $file) | |
} | |
function Update-SurgeRepos() { | |
pushd . | |
cd w:/Nen/ | |
hg pull -u | |
cd w:/surge/Surge | |
ls . | ?{$_.PsIsContainer} | ?{test-path (join-path $_ .hg)} | %{ hg pull $_ -u} | |
popd | |
} | |
if (-not $Env:RecreateDatabase_Default_Environment) { | |
$Env:RecreateDatabase_Default_Environment = 'local_express' | |
} | |
set-alias psake Invoke-Psake | |
# Load posh-git example profile | |
. 'C:\tools\poshgit\dahlbyk-posh-git-c3147d0\profile.example.ps1' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment