This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyValueObject:ValueObject<MyValueObject> | |
{ | |
public int field1{get;} | |
public double field2{get;} | |
public string field3{get;} | |
public override int GetHashCode() | |
{ | |
//don't forget to check fields for null | |
unchecked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#stop Docker Desktop and wait when it completely stopped | |
#Run it as Administrator | |
Optimize-VHD -Path $ENV:UserProfile\AppData\Local\Docker\wsl\data\ext4.vhdx -Mode Full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Amazon; | |
using Amazon.EC2; | |
const string CREDENTIALS_PROFILE = "mine"; | |
const string SECUTIRY_GROUP = "sg-XXXXXXXXX"; | |
const string MATCH_PHRASE = "any part of description"; | |
const string RULE_DESCRIPTION = "new description"; | |
RegionEndpoint region=Amazon.RegionEndpoint.USEast1; | |
using var httpClient = new HttpClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i "c:/videos/sample.mp4 | |
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 | |
-c:v libx264 -crf 22 -c:a aac -ar 48000 | |
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k | |
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k | |
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k | |
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p" | |
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3 | |
-hls_flags independent_segments -master_pl_name "name-pl.m3u8" | |
"c:/videos/encoded/name-%v.m3u8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE master | |
GO | |
CREATE DATABASE Tfs_DefaultCollection | |
GO | |
ALTER DATABASE Tfs_DefaultCollection SET OFFLINE | |
GO | |
-- NOW Delete Tfs_DefaultCollection mdf and ldf files | |
-- AND copy mdf you need to restore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToReadableTime(this DateTime value) | |
{ | |
var ts = new TimeSpan(DateTime.UtcNow.Ticks - value.Ticks); | |
double delta = ts.TotalSeconds; | |
if (delta < 60) | |
{ | |
return ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; | |
} | |
if (delta < 120) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://msdn.microsoft.com/powershell/reference/5.1/microsoft.powershell.management/Set-Service | |
#There is no option Delayed autostart in StartupType | |
#possible solutions: | |
#1. start sc | |
$Service="My service" | |
sc.exe Config $Service Start= Delayed-Auto | |
#2. set corresponded property in regedit | |
#see https://blogs.technet.microsoft.com/askperf/2008/02/02/ws2008-startup-processes-and-delayed-automatic-start/ | |
Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\$Service" -Name "DelayedAutostart" -Value 1 -Type DWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- to avoid the problem with unpack ("too many results to unpack") | |
-- we can increase LUAI_MAXCSTACK in luaconf.h https://www.lua.org/source/5.1/luaconf.h.html | |
-- or execute the command with using table.unpack (https://www.lua.org/manual/5.1/manual.html#pdf-table.unpack) in chunks by specific length | |
-- table.merge - separated function to merge two tables | |
-- size of args should be >4000 (chunk length) | |
local executeRedisCommandInChunks = function (command, key, args) | |
local results = {} | |
local chunkResult = {} | |
local args_len = #args | |
-- chunk length (any positive value less then 8000) |