Skip to content

Instantly share code, notes, and snippets.

@gilmation
Created July 7, 2010 12:36
Show Gist options
  • Save gilmation/466630 to your computer and use it in GitHub Desktop.
Save gilmation/466630 to your computer and use it in GitHub Desktop.
# Set the execution policy
Set-ExecutionPolicy RemoteSigned
# Set up functions
# To use this profile the following environment variables must exist:
# They can be created by substituting:
# $VALUE for the value that you want for each variable
# The third argument can be either of Process|User|Machine.
# Process gets and sets to the current window
# so for persistent values use User|Machine but remember that to avoid problems
# use the same option for both get and set.
# Run these commands in a PowerShell window
#
# [Environment]::SetEnvironmentVariable("WORKSPACE_HOME", "$VALUE", "User")
# [Environment]::SetEnvironmentVariable("EXAMPLE_HOME", "$VALUE", "User")
# [Environment]::SetEnvironmentVariable("EXAMPLE_DB_HOME", "$VALUE", "User")
# [Environment]::SetEnvironmentVariable("DATA_HOME", "$VALUE", "User")
# [Environment]::SetEnvironmentVariable("SELENIUM_HOME", "$VALUE", "User")
# Create the shortcut functions to move us into project dirs
function workspace {cd $([Environment]::GetEnvironmentVariable('WORKSPACE_HOME', 'User'))}
function example {cd $([Environment]::GetEnvironmentVariable('EXAMPLE_HOME', 'User'))}
function exampleDB {cd $([Environment]::GetEnvironmentVariable('EXAMPLE_DB_HOME', 'User'))}
# Database functions
# Connect to the mysql schema for the project EXAMPLE_DB_HOME
function con_mysql_ex {& "$([Environment]::GetEnvironmentVariable('EXAMPLE_DB_HOME', 'User'))\bin\mysql.ps1"}
# Connect to the mysql test schema for the project EXAMPLE_DB_HOME
function con_mysql_ex_test {& "$([Environment]::GetEnvironmentVariable('EXAMPLE_DB_HOME', 'User'))\bin\mysqlTest.ps1"}
# refresh the mysql schema for the project EXAMPLE_DB_HOME
function ref_ex {& "$([Environment]::GetEnvironmentVariable('EXAMPLE_DB_HOME', 'User'))\bin\createExampleAll.ps1"}
# refresh the mysql test schema for the project EXAMPLE_DB_HOME
function ref_ex_test {& "$([Environment]::GetEnvironmentVariable('EXAMPLE_DB_HOME', 'User'))\bin\createExampleAllTest.ps1"}
# Launch GVim - the path could be moved out into an environmental variable
function vim {[diagnostics.process]::start("C:\Vim\vim72\gvim.exe", "$args")}
# Show the environment ordered by variable name
function geten {get-childitem env: | sort-object -property name}
# Show the list of available functions - including those defined here
function getfu {get-item function:}
# As close to a Unix tail as we can get
function tail {
if($args.length -lt 1) {
write-host Usage: "tail $TARGET_FILE"
return
}
Get-Content $args[0] -wait
}
# Kill the launchy process
function killLaunchy {
kill (ps Launchy).get_Id()
}
# Generate a database schema using the phing and propel
#function genDataSchema {
# cd $env:PROPEL_HOME\generator
# phing reverse "-Dproject.dir=$([Environment]::GetEnvironmentVariable('DATA_HOME', 'User'))\build\propel"
#}
# Copy data from one dir to another drive - if there are files that already exist in the target dir overwrite them
#function copyData {cp -rec "$env:DATA_HOME\**" "Z:\tmp" -ErrorAction SilentlyContinue}
# Startup the selenium java server
#function startSelenium {java "-Dhttp.proxyHost=192.168.0.27" "-Dhttp.proxyPort=3128" -jar "$([Environment]::GetEnvironmentVariable('SELENIUM_HOME', 'User'))\selenium-server-1.0-beta-2\selenium-server.jar" -firefoxProfileTemplate "C:\Documents and Settings\hgilmour\Datos de programa\Mozilla\Firefox\Profiles\qvs55du3.default"}
# Aliases
Set-Alias ll get-childitem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment