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
-- Based on https://gist.github.com/aleksp99/2ca3401be8965f5ea72187a7baad739d | |
SELECT | |
dm_tran_locks.request_session_id AS IDSessions, | |
CASE | |
WHEN resource_type = 'object' | |
THEN OBJECT_NAME(dm_tran_locks.resource_associated_entity_id) | |
ELSE OBJECT_NAME(partitions.object_id) | |
END AS ObjectName, | |
indexes.name AS IndexName, |
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
# Get all duplicate files, sorted by hash | |
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | sort | |
# For each file that is duplicated, extract the filename to keep | |
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | sort | uniq --check-chars 32 | cut -c 35- | |
# Copy the files to keep to another directory | |
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | sort | uniq --check-chars 32 | cut -c 35- | xargs -Ifoo cp foo ../keep | |
# Remove the duplicate files |
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
internal class EitherValidOrUnsupportedValueConverterFactory : JsonConverterFactory | |
{ | |
public override bool CanConvert(Type typeToConvert) | |
{ | |
var canConvert = typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(Either<,>) && typeToConvert.GenericTypeArguments[0] == typeof(UnsupportedValue); | |
return canConvert; | |
} | |
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) | |
{ |
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
[AttributeUsage(AttributeTargets.Method)] | |
public class EnumDataAttribute : DataAttribute | |
{ | |
private readonly Type _tEnum; | |
public EnumDataAttribute(Type tEnum) => this._tEnum = tEnum; | |
/// <summary>Returns the data to be used to test the theory.</summary> | |
/// <param name="methodUnderTest">The method that is being tested</param> |
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
internal class ValidationProblemDetailsBuilder | |
{ | |
private readonly List<Action<ModelStateDictionary>> _modelStateActions; | |
private readonly List<Action<ValidationProblemDetails>> _problemActions; | |
public ValidationProblemDetailsBuilder(): this (Array.Empty<Action<ModelStateDictionary>>(), Array.Empty<Action<ValidationProblemDetails>>()) | |
{ | |
} | |
private ValidationProblemDetailsBuilder(IEnumerable<Action<ModelStateDictionary>> modelStateActions, IEnumerable<Action<ValidationProblemDetails>> problemActions) |
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
// Explodes a type (i.e. recursively gets all generic type parameters) | |
public static class TypeExtensions | |
{ | |
public static ISet<Type> Explode(this Type t) | |
{ | |
return ExplodeType(t); | |
} | |
private static ISet<Type> ExplodeType(Type t, ISet<Type> result = null) | |
{ |
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 class EnumExtensions | |
{ | |
public static T GetAttribute<T>(this Enum value) where T : Attribute | |
{ | |
var type = value.GetType(); | |
var memberInfo = type.GetMember(value.ToString()); | |
var attributes = memberInfo[0].GetCustomAttributes(typeof(T), false); | |
return attributes.Length > 0 | |
? (T)attributes[0] | |
: null; |
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 Uri ComposeRequestUri(string baseUri, string pathSuffix=null, IDictionary<string, object> queryParameters=null) | |
{ | |
if (string.IsNullOrEmpty(baseUri)) | |
{ | |
throw new ArgumentException($"{nameof(baseUri)} is required", nameof(baseUri)); | |
} | |
var uri = new Uri(baseUri); | |
if (!string.IsNullOrEmpty(pathSuffix)) |
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
Write-Host "Installing MySQL" | |
$mySqlInstaller = DownloadTempFile -Url "https://downloads.mysql.com/archives/get/file/mysql-installer-community-5.7.27.0.msi" -Filename "mysql-installer-community-5.7.27.0.msi" | |
Invoke-Process "msiexec" "/i $mySqlInstaller /qb" | |
Invoke-Process "${env:ProgramFiles(x86)}\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe" "community install server;5.7.27;X64:*:servertype=Server;passwd=password -Silent" | |
Write-Host "Installing MySQL Workbench 8.0.16" | |
Invoke-Process "${env:ProgramFiles(x86)}\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe" "community install workbench;8.0.16;X64:* -Silent" |
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
[Unit] | |
Description=PulseAudio system server | |
After=avahi-daemon.service network.target | |
[Service] | |
Type=forking | |
ExecStart=/usr/bin/pulseaudio --realtime --no-cpu-limit --system --disallow-exit --daemon | |
ExecReload=/bin/kill -HUP $MAINPID | |
Restart=always |
NewerOlder