Skip to content

Instantly share code, notes, and snippets.

View cosoria's full-sized avatar

Carlos Osoria cosoria

  • Oxoria Consulting Inc
  • Winnipeg, CA
View GitHub Profile
@cosoria
cosoria / DeviceContextMapppings.cs
Last active April 13, 2017 17:53
DeviceContext Mapping Sample
public class DeviceDbContext : LuxidorDbContext<DeviceDbContext>
{
public IDbSet<DeviceState> Devices { get; set; }
public IDbSet<AssetShapeState> AssetShapes { get; set; }
public IDbSet<AssetStrengthState> AssetStrengths { get; set; }
public IDbSet<AssetTypeState> AssetTypes { get; set; }
public IDbSet<CountryState> Countries { get; set; }
public IDbSet<CurrencyState> Currencies { get; set; }
public IDbSet<EventTypeState> EventTypes { get; set; }
public IDbSet<UserState> Users { get; set; }
public class ConnectionStringProvider : IConnectionStringProvider
{
private static string _connectionString;
public ConnectionStringProvider()
{
SetupConnectionString();
}
private void SetupConnectionString()
@cosoria
cosoria / Create-Shorcut.ps1
Created September 27, 2016 20:55
Create-Shorcut
function Create-Shortcut
{
<#
.SYNOPSIS
Create a windows shortcut to an desired executable (.EXE)
.DESCRIPTION
Create a windows shortcut to an desired executable (.EXE)
.EXAMPLE
Create-AOLShortcut -Path C:\User\Desktop\MyNotepadShortcut.lnk -Target C:\Windows\Notepad.exe -Arguments C:\file.txt -Icon C:\Windows\Notepad.exe,0
#>
@cosoria
cosoria / Add-CurrenDirToPath.ps1
Created September 27, 2016 20:07
Add-CurrenDirToPath
# Modify system environment path variable
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + $pwd ,[System.EnvironmentVariableTarget]::Machine)
@cosoria
cosoria / Dump-IISConfig.ps1
Created September 27, 2016 20:04
Dump-IISConfig
# This scripts will dump all (basic) IIS configuration to text file on the following path c:\iisconfig.txt
$rootDrive = "C:\";
$iisConfigFile = "iis_config.txt";
$websitesOutputFile = "websites.txt";
$apppoolsOutputFile = "apppools.txt";
$iisConfigFilePath = Join-Path $rootDrive $iisConfigFile;
$websitesFilePath = Join-Path $rootDrive $websitesOutputFile;
$apppoolsFilePath = Join-Path $rootDrive $apppoolsOutputFile;
@cosoria
cosoria / Get-MsBuildPath.ps1
Created September 27, 2016 20:00
Get-MsBuildPath
function Get-AOLMsBuildPath()
{
<#
.SYNOPSIS
Gets the path to the latest version of MsBuild.exe. Throws an exception if MsBuild.exe is not found.
.DESCRIPTION
Gets the path to the latest version of MsBuild.exe. Throws an exception if MsBuild.exe is not found.
.EXAMPLE
@cosoria
cosoria / Test-Numeric.ps1
Created September 27, 2016 19:58
Test-Numeric
function Test-Numeric
{
<#
.SYNOPSIS
Test if an string contains a numeric value
.DESCRIPTION
Test if an string contains a numeric value
.EXAMPLE
Test-Numeric -Number ABC70753 returns false
Test-Numeric -Number 70753 returns true
@cosoria
cosoria / Get-ExecutingScriptFolder.ps1
Created September 27, 2016 19:56
Get-ExecutingScriptFolder
function Get-ExecutingScriptFolder() {
return Split-Path -Parent $MyInvocation.MyCommand.Path;
}
@cosoria
cosoria / Get-ExecutingScript.ps1
Created September 27, 2016 19:55
Get-ExecutingScript
function Get-ExecutingScript() {
return $MyInvocation.MyCommand.Path;
}
@cosoria
cosoria / Test-Administrator.ps1
Created September 27, 2016 19:52
Test-Administrator
function Test-Administrator
{
<#
.SYNOPSIS
Returns True is the current user is an administrator
.DESCRIPTION
Returns True is the current user is an administrator
.EXAMPLE
if(Test-Administrator) { Action }
#>