This file contains hidden or 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 System.Collections.Generic; | |
| public class SortComparer<T, R> : Comparer<T> where R : IComparable<R> | |
| { | |
| public readonly Func<T, R> GetComparableProperty; | |
| private SortComparer(){} | |
| private SortComparer(Func<T, R> func) | |
| { | |
| GetComparableProperty = func; |
This file contains hidden or 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
| $TotalNumberVersionsToKeep=100 | |
| $BackupFolder = "\\osgdesign\Studio\Windows\Users\v-senefe\Backup" # make sure there is no ending \ | |
| $ProjectFolder = "C:\DesignDepot.Git" # make sure there is no ending \ | |
| $ProjectFolderName = [System.IO.Path]::GetFileName($ProjectFolder) | |
| Push-Location -Path $ProjectFolder | |
| $changes = CMD.EXE /C git ls-files --modified --others --exclude-standard | Out-String | |
| if ($changes.Length -eq 0){ | |
| Exit | |
| } |
This file contains hidden or 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
| (New-Object System.Security.Principal.NTAccount("Security Group Name")).Translate([System.Security.Principal.SecurityIdentifier]).Value |
This file contains hidden or 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 IEnumerable<int[]> Permut(int[] arr){ | |
| while (true){ | |
| yield return arr; | |
| var j = arr.Length - 2; | |
| while (j >= 0 && arr[j] >= arr[j+1]) j--; | |
| if (j < 0) break; | |
| var l = arr.Length -1; | |
| while (arr[j] >= arr[l]) l--; |
This file contains hidden or 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 IEnumerable<int[]> Permut(int[] arr){ | |
| while (true){ | |
| yield return arr; | |
| var j = arr.Length - 2; | |
| while (j >= 0 && arr[j] >= arr[j+1]) j--; | |
| if (j < 0) break; | |
| var l = arr.Length -1; | |
| while (arr[j] >= arr[l]) l--; |
This file contains hidden or 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
| import matplotlib.pyplot as plt | |
| fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(9, 5)) | |
| ax1.set_title('Before Scaling') | |
| sns.kdeplot(x['x1'], ax=ax1) | |
| sns.kdeplot(x['x2'], ax=ax1) | |
| ax2.set_title('After Robust Scaling') | |
| sns.kdeplot(robust_scaled_df['x1'], ax=ax2) | |
| sns.kdeplot(robust_scaled_df['x2'], ax=ax2) | |
| ax3.set_title('After Min-Max Scaling') |
This file contains hidden or 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 FindUpperFileOrFolder(string name, DirectoryInfo dir = null) | |
| { | |
| dir = dir ?? new DirectoryInfo(Directory.GetCurrentDirectory()); | |
| var dirInfo = dir.GetDirectories(name).FirstOrDefault(); | |
| var fileInfo = dir.GetFiles(name).FirstOrDefault(); | |
| if (fileInfo == null && dirInfo == null) | |
| { | |
| return FindUpperFileOrFolder(name, dir.Parent); | |
| } |
This file contains hidden or 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 System; | |
| using System.Collections.Concurrent; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| namespace Extensions | |
| { | |
| public static class Extensions | |
| { |
This file contains hidden or 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
| static void PrintTypes(LambdaExpression expr) | |
| { | |
| Console.WriteLine(expr); | |
| ConstantExpression cexpr = expr.Body as ConstantExpression; | |
| if (cexpr != null) | |
| { | |
| Console.WriteLine("\t{0}", cexpr.Type); | |
| return; | |
| } | |
| BinaryExpression bexpr = expr.Body as BinaryExpression; |
OlderNewer