Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Management;
namespace Chyron.Maps.Render.Maint
{
public class MemoryMetrics
{
public double TotalGB { get; set; }
public double UsedGB { get; set; }
public double FreeGB { get; set; }
@PadreSVK
PadreSVK / ado-deploy-agent-install.ps1
Last active April 29, 2022 12:46
Install script for ADO deploy agent
$enviromentName = "CloudDev"
$accessToken = ""
$ErrorActionPreference="Stop";If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] "Administrator")){ throw "Run command in an administrator PowerShell prompt"};If($PSVersionTable.PSVersion -lt (New-Object System.Version("3.0"))){ throw "The minimum version of Windows PowerShell that is required by the script (3.0) does not match the currently running version of Windows PowerShell." };If(-NOT (Test-Path $env:SystemDrive\'azagent')){mkdir $env:SystemDrive\'azagent'}; cd $env:SystemDrive\'azagent'; for($i=1; $i -lt 100; $i++){$destFolder="A"+$i.ToString();if(-NOT (Test-Path ($destFolder))){mkdir $destFolder;cd $destFolder;break;}}; $agentZip="$PWD\agent.zip";$DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy;$securityProtocol=@();$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol;$securityProtocol+=[Net.SecurityProtocolType]::Tls12;[Net.ServicePointManag
@PadreSVK
PadreSVK / generate-components.ps1
Created October 6, 2021 12:20
Vue component "index" generator
$components = New-Object 'System.Collections.Generic.List[System.String]'
ls $PSScriptRoot -Filter *.vue -Recurse | % {
$relativePathToComponent = $_.FullName.Replace($PSScriptRoot, "" ).Replace("\" , "/")
$componentPath = "@/components$relativePathToComponent"
$componentName = $([System.IO.Path]::GetFileNameWithoutExtension($_.Name))
$components.Add("export { default as $componentName} from `"$componentPath`"")
}
-- DELETE record from table
DELETE FROM player_details
WHERE player_name = 'Lionel Messi';
@PadreSVK
PadreSVK / extensions.ps1
Created May 24, 2021 17:24
vsCode extensions
code --install-extension alefragnani.Bookmarks
code --install-extension amillard98.specflow-tools
code --install-extension ban.spellright
code --install-extension bierner.markdown-preview-github-styles
code --install-extension blackmist.LinkCheckMD
code --install-extension CoenraadS.bracket-pair-colorizer-2
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension dkundel.vscode-new-file
code --install-extension DotJoshJohnson.xml
@PadreSVK
PadreSVK / xyz-publish-pipeline.yml
Created May 19, 2021 16:05
Sample of multistage pipeline
trigger:
branches:
include:
- master
pool: "Default"
variables:
displayName: My Awesome project
csprojPath: MyProject.csproj
{
"id": "2f1ebc92-af5e-4d73-b3de-42176db0ac2c",
"name": "My Visual Studio extensions",
"description": "A collection of my Visual Studio extensions",
"version": "1.0",
"extensions": [
{
"name": "#Regions Are Evil",
"vsixId": "4B35EF3B-C2F5-4180-8936-25621C9E1EEA"
},
$release = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
switch ($release) {
{ $_ -ge 528040 } { "4.8"; Break }
{ $_ -ge 461808 } { "4.7.2"; Break }
{ $_ -ge 461308 } { "4.7.1"; Break }
{ $_ -ge 460798 } { "4.7"; Break }
{ $_ -ge 394802 } { "4.6.2"; Break }
{ $_ -ge 394254 } { "4.6.1"; Break }
{ $_ -ge 393295 } { "4.6" ; Break }
{ $_ -ge 379893 } { "4.5.2"; Break }
@PadreSVK
PadreSVK / .gitignore
Created April 21, 2021 18:07
dotnet gitignore created by `dotnet new gitignore`
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@PadreSVK
PadreSVK / Startup.cs
Created April 12, 2021 19:41
DBContext registration with design time factory and usage of extension method GetConnectionString
using System;
using System.Text;
using BackgroundServices;
using BackgroundServices.HttpClients;
using BackgroundServices.Options;
using BL;
using DAL;
using DAL.Models.Identity;
using DAL.Query.Abstraction;
using DAL.Query.AllCity;