Skip to content

Instantly share code, notes, and snippets.

View V0v1kkk's full-sized avatar

Vladimir Rogozhin V0v1kkk

  • Veeam software
  • Prague
View GitHub Profile
@V0v1kkk
V0v1kkk / graphgen.fs
Created June 6, 2020 21:51 — forked from Thorium/graphgen.fs
How you can programmatically use GraphViz from F#
// 1. Install: http://www.graphviz.org/Download..php
//
// 2. Add <appSettings> under <configuration> to app.config/web.config
// Add Nuget / Paket: GraphViz.NET
//
// 3. Add under <configuration><appSettings>:
// <add key="graphVizLocation" value="C:\Program Files (x86)\Graphviz2.38\bin" />
//
// Add references to System.Configuration.dll and System.Drawing.dll
@V0v1kkk
V0v1kkk / Example1.cs
Created December 2, 2017 13:52
Замена неймспейса для кода
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Roslyn.CodeGeneration
{
@V0v1kkk
V0v1kkk / kill.cs
Last active July 24, 2017 12:47
Kill DB MSSQL
public static void KillDb(string connectionString, int timeoutMs)
{
string dbName = GetDbName(connectionString);
Log.Info("kill database ", dbName);
var sqlCommandText = $@"USE master
DECLARE @kill varchar(8000) = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), spid) + ';'
FROM master..sysprocesses
WHERE dbid = db_id('{dbName}')
EXEC(@kill);
@V0v1kkk
V0v1kkk / 1.cs
Created February 6, 2017 09:11
Json.NET "JSON object to decimal"
decimal[] arrayOfDecimals = JsonConvert.DeserializeObject<decimal[]>(jObject["Values"].ToString(Newtonsoft.Json.Formatting.None));
decimal singleDecimal = JsonConvert.DeserializeObject<decimal>(jObject["Values"][1].ToString(Newtonsoft.Json.Formatting.None));
@V0v1kkk
V0v1kkk / WMI.cs
Created December 19, 2016 13:27
C# Get hardware information whith WMI
/// <summary>
/// Use WMI for check percentage of CPU Usage
/// Write to private field _cpuUsage
/// </summary>
private void CheckCpuUsage()
{
try
{
var searcher =
new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor");