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.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.NetworkInformation; | |
using System.Net; | |
namespace AvailablePort | |
{ | |
class Program |
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
internal static class ProcessManager | |
{ | |
public static void GetProcessLock() | |
{ | |
ProcessManager.ProcessLock = new Mutex(false, "Global\\LuYao.Toolkit[" + ProcessManager.GetUid() + "]", ref ProcessManager.HasLock); | |
if (!ProcessManager.HasLock) | |
{ | |
ProcessManager.ActiveWindow(); | |
Environment.Exit(0); | |
} |
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
from __future__ import division | |
from PyQt5 import QtWidgets | |
from PyQt5.QtCore import QSize, Qt | |
from PyQt5.QtGui import QPainter, QPen, QColor, QFont | |
class RoundProgressBar(QtWidgets.QWidget): | |
def __init__(self, parent=None): |
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 Main(string[] args) | |
{ | |
var buffer = g().ToArray(); | |
Console.WriteLine(HexDump(buffer)); | |
IEnumerable<byte> g(){ | |
foreach(var i in Enumerable.Range(0, 256)){ | |
yield return (byte)i; | |
} |
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
@ng-select-highlight: #9aabff; | |
@ng-select-primary-text: #495057; | |
@ng-select-disabled-text: #f9f9f9; | |
@ng-select-border: #e2e5ec; | |
@ng-select-border-radius: 4px; | |
@ng-select-bg: #ffffff; | |
@ng-select-selected: #f3f6f9; | |
@ng-select-marked: #f3f6f9; | |
@ng-select-placeholder: lighten(@ng-select-primary-text, 40); | |
@ng-select-height: calc(1.5em + 1.3rem + 2px); |
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
class Retrying: | |
def __init__(self, interval=1.0, delay=0.05, maxAttempts=None): | |
self.interval = interval | |
self.delay = delay | |
self.maxAttempts = maxAttempts | |
def __iter__(self): | |
class Iterator: | |
def __init__(self, interval, delay, maxAttempts): | |
self.attempt = 0 |
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 time | |
class TimeoutError(Exception): | |
def __init__(self, msg, code=1): | |
self.msg = msg | |
self.code = code | |
def __str__(self): | |
return 'TimeoutError: %s (code %d)' % (self.msg, self.code) |
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
@echo off | |
@rem throw this file in jetbrains installation folder, it takes the last created PyCharm folder (the latest ide update) for the script | |
FOR /F "delims=" %%i IN ('dir /b /ad-h /t:c /od -filter "PyCharm*"') DO SET a=%%i | |
SET PyCharmPath=C:\Program Files (x86)\JetBrains\%a%\bin\PyCharm64.exe | |
echo %PyCharmPath% | |
echo Adding file entries |
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; | |
namespace XCode.Common | |
{ | |
#region 算法1 | |
///// <summary> | |
///// 动态生产有规律的ID | |
///// </summary> | |
//public class Snowflake |
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
$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core" | |
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath | |
$NotInstalled = $True | |
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object { | |
$NotInstalled = $False | |
Write-Host "The host has installed $_" | |
} | |
If ($NotInstalled) { | |
Write-Host "Can not find ASP.NET Core installed on the host" | |
} |
NewerOlder