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
/// <summary> | |
/// Gets up stairs path. | |
/// </summary> | |
/// <param name="res">結果集合.</param> | |
/// <param name="path">The path.</param> | |
/// <param name="totalStairs">樓梯總數.</param> | |
/// <param name="stepMethod">可能的步進階數.</param> | |
/// <returns></returns> | |
private static List<List<int>> GetUpStairsPath(List<List<int>> result, List<int> goThroughPath, int totalStairs,int[] stepMethod) | |
{ |
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
Change python version on per user basis | |
To change a python version on per user basis you simply create an alias within user’s home directory. Open ~/.bashrc file and add new alias to change your default python executable: | |
alias python='/usr/bin/python3' | |
Once you make the above change, re-login or source your .bashrc file: | |
$ . ~/.bashrc |
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
# update software repositories | |
$sudo apt update | |
# install available software updates | |
$sudo apt upgrade | |
# install prerequisites | |
$sudo apt install lsb-release wget openssl apt-transport-https -y | |
# switch to root role | |
$sudo -s |
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
PS C:\Program Files (x86)\Google\Chrome Remote Desktop\101.0.4951.13> Get-WmiObject Win32_process -Filter 'name="remoting_host.exe"' | ForEach-Object {$_.SetPriority(128)} | |
__GENUS : 2 | |
__CLASS : __PARAMETERS | |
__SUPERCLASS : | |
__DYNASTY : __PARAMETERS | |
__RELPATH : | |
__PROPERTY_COUNT : 1 | |
__DERIVATION : {} |
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
string suffixSlash = @"C:\Users\KKK\source\repos\DotNetCoreDirectoryGetParentTest\DotNetCoreDirectoryGetParentTest\bin\Debug\netcoreapp2.1\"; | |
string suffixNoSlash = @"C:\Users\KKK\source\repos\DotNetCoreDirectoryGetParentTest\DotNetCoreDirectoryGetParentTest\bin\Debug\netcoreapp2.1"; | |
string currentDomainBaseDirectory = AppDomain.CurrentDomain.BaseDirectory; | |
string appContextBaseDirectory = AppContext.BaseDirectory; | |
string str1 = Directory.GetParent(suffixSlash).FullName; | |
string str2 = Directory.GetParent(suffixSlash).Parent.FullName; | |
string str3 = Directory.GetParent(str1).FullName; | |
string str4 = Directory.GetParent(suffixNoSlash).FullName; |
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
private static void Main(string[] args) | |
{ | |
int[] nums = new int[] { 13, 3, 889, 5455, 1, 152, 990 }; | |
ParameterizedThreadStart myPar = new ParameterizedThreadStart(SleepSort); | |
foreach (var num in nums) | |
{ | |
Thread myThread = new Thread(myPar); | |
myThread.IsBackground = true; | |
myThread.Start(num); | |
} |
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
#Implementing IFormatProvider, ICustomFormatter | |
forking from https://stackoverflow.com/a/28342440/4246719 | |
public class FormatProvider : IFormatProvider, ICustomFormatter | |
{ | |
public object GetFormat(Type formatType) | |
{ | |
if (formatType == typeof(ICustomFormatter)) | |
{ | |
return this; | |
} |
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
[HttpPost("TestPost")] | |
public ActionResult<string> TestPost() | |
{ | |
string jsonText = ""; | |
var context = HttpContextProvider.Current; | |
// context.Request.EnableRewind(); | |
try | |
{ |
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
// shared variables | |
// private static ThreadLocal<int> local = new ThreadLocal<int>();//output 53000 0; | |
private static AsyncLocal<int> local = new AsyncLocal<int>();//output 53000 53000; | |
private static void Main(string[] args) | |
{ | |
// declare a delegate | |
Action act = async () => | |
{ |