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
package utils | |
import ( | |
"crypto/rand" | |
"errors" | |
"math/big" | |
prand "math/rand" | |
"time" | |
) |
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 interface IRng | |
{ | |
int Next(int maxValue); | |
int Next(int minValue, int maxValue); | |
int Next(); | |
void NextBytes(byte[] buffer); | |
double NextDouble(); | |
} |
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
/* ===add file: \liteide\share\liteide\liteapp\qss\vs-dark-hdpi.qss ===*/ | |
/* ===FROM: https://gist.github.com/tupunco/fdb713ec9c6189a877e5eb003bd0457d ===*/ | |
/* === Shared === */ | |
QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, | |
QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog, QListView, | |
QTabBar, QMenu, QMenuBar, QWidget::window { | |
background-color: #252526; | |
color: #F1F1F1; | |
} |
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
package main | |
import ( | |
//"encoding/json" | |
"fmt" | |
//"os" | |
"sync" | |
"time" | |
) |
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
/// <summary> | |
/// 业务逻辑 返回结果 | |
/// </summary> | |
/// <remarks> | |
/// 建议以本类型为返回对象的方法, 不要返回 null 对象. | |
/// | |
/// 提供三种方法创建本实例: | |
/// 直接实例: | |
/// new BizResult<Dish>(...); | |
/// |
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; | |
using System.Runtime.Serialization; | |
using System.Xml; | |
using System.Xml.Schema; | |
using System.Xml.Serialization; | |
namespace Tup.Utilities | |
{ | |
/// <summary> | |
/// 支持XML序列化的泛型Dictionary类 |
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 XHEdu; | |
namespace System.Data | |
{ | |
/// <summary> | |
/// 包含 `已创建事务` 的 DbConnection | |
/// </summary> | |
public class DbTransactionConnection : IDbConnection | |
{ | |
private IDbTransaction innerDbTransaction = null; |
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
/// <summary> | |
/// Async Execute Command Action | |
/// </summary> | |
/// <param name="startFileName"></param> | |
/// <param name="startFileArg"></param> | |
/// <param name="msgAction"></param> | |
/// <returns></returns> | |
public static Task<bool> ExecuteActionAsync(string startFileName, string startFileArg, Action<string> msgAction) | |
{ | |
ThrowHelper.ThrowIfNull(msgAction, "msgAction"); |
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
/// <summary> | |
/// 一致性 Hash 算法 | |
/// </summary> | |
class ConsistentHashing | |
{ | |
List<KeyValuePair<uint, string>> _serList = new List<KeyValuePair<uint, string>>(); | |
public ConsistentHashing(string[] serList) | |
{ | |
if (serList == null || serList.Length == 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
public class Tree | |
{ | |
/// <summary> | |
/// store the tree's root | |
/// </summary> | |
private Node _root; | |
/// <summary> | |
/// construct a new tree with it's root | |
/// </summary> |