PS – Huge Log File

When the log is getting huge, it not a recommend to open into any text editor. most of text editor will not responding or crash because of log file was too big.

Get-Content "{file} | Select -First 10

Get-Content "{file} | Select-String -Pattern "{Pattern}"
Advertisements

PS – Register service

$destination = "D:\Publish\Snatch"
$filename = "Lottery.Automation.Services.Snatch.exe"
$servicename = "Snatch.Keno.Korea"
$description = "Snatch keno for korea market"


New-Service -Name $servicename -DisplayName $servicename -Description $description -BinaryPathName "$destination\$filename" -StartupType Automatic


# This is to delete the services
#(Get-WmiObject win32_service -filter "name='$servicename'").delete()
# This is to delete the services

VSO Prebuild

When you add vNext project in the VSO it will always encounter an err because it didn’t install the dnvm.

Run this prebuild before run other test.

# bootstrap DNVM into this session.
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}

# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

if($globalJson)
{
    $dnxVersion = $globalJson.sdk.version
}
else
{
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
}

# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

Chocolatey

You able to install the apps by using command line. an alternatives apt-get for windows.

#Install Chocolatey this is the best way to install the packages
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

#Install 7zip
choco install 7zip.install

#Install Notepad++
choco install notepadplusplus

#Install Git Client
choco install sourcetree

#Install Chrome Browser
choco install google-chrome-x64 

#Install Fiddler
choco install fiddler4

#Install Flux
choco install f.lux

Schedule Auto Restart Vidalia

When we run the vidalia tor network and let it run 24/7, it will consume a huge memory.

If we look into below printscreen it took 1.2GB of the RAM. In here we want to make it auto schedule to restart it.
Vidalia Use Huge Memory
Creating PowerShell File

#This is to auto restart the Vidalia
$process = Get-Process vidalia -ErrorAction SilentlyContinue

if ($process) {
taskkill /t /f /im vidalia.exe
}

$defaultVidaliaInstallation = "C:\Program Files (x86)\Vidalia Bundle\Vidalia\vidalia.exe"

Start-Process $defaultVidaliaInstallation

Enable Schedule Continue reading