Skip to content

Instantly share code, notes, and snippets.

public class MessageSender : BackgroundService
{
private readonly byte[] _dummyData = new byte[2048];
private IHubContext<MyHub> _hub;
private readonly CancellationTokenSource cts = new(TimeSpan.FromSeconds(20));
public MessageSender(IHubContext<MyHub> hubContext)
{
_hub = hubContext;
Random.Shared.NextBytes(_dummyData);
@ArminShoeibi
ArminShoeibi / airports.sql
Created April 15, 2021 17:23 — forked from tanerdogan/airports.sql
airports.sql - airport list (total 8800 airport)
This file has been truncated, but you can view the full file.
DROP TABLE IF EXISTS `airports`;
CREATE TABLE IF NOT EXISTS `airports` (
`code` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityCode` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryCode` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`timezone` varchar(8) COLLATE utf8_turkish_ci DEFAULT NULL,
@ArminShoeibi
ArminShoeibi / docker-compose.yaml
Created March 26, 2021 18:39
docker compose for RabbitMQ
services:
rabbit-mq:
image: rabbitmq:management-alpine
container_name: RabbitMQServer
ports:
- "15672:15672"
hostname: rbmq
restart: always
public static class ConvertNumberExtensions
{
public static string ConvertDigitChar(this string str, CultureInfo source, CultureInfo destination)
{
for (int i = 0; i <= 9; i++) // from number 0 to 9
{
str = str.Replace(source.NumberFormat.NativeDigits[i], destination.NumberFormat.NativeDigits[i]);
}
return str;
}
syntax = "proto3"; /* version of the protocol buffers language */
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
/*You can declare enumerations at the top level in a .proto file, or nested within a message definition*/
enum TicketStatus {
option allow_alias = true; /*you can declare multiple fields with the same value.*/
NEW = 0;
OPEN = 1;
INPROGRESS = 2;
syntax = "proto3"; /* version of the protocol buffers language */
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
message CreateTicketDto {
int32 user_id = 1;
int32 category_id = 2;
string title = 3;
string description = 4;
}
syntax = "proto3"; /* version of the protocol buffers language */
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
/* Protobuf enumeration definitions must have a zero constant as their first field */
enum TicketStatus {
NEW = 0;
OPEN = 1;
INPROGRESS = 3;
CLOSED = 4;
}
syntax = "proto3"; /* version of the protocol buffers language */
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
message CreateTicketDto {
int32 user_id = 1;
int32 category_id = 2;
string title = 3;
string description = 4;
}
syntax = "proto3";
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
message ScalarDataTypes {
bool bool_field = 1;// bool
string string_field = 2;// string
bytes byte_string_field = 3;// byte[]
double double_field = 4; // double
float float_field = 5; // float
int32 int_field = 6;// int
syntax = "proto3"; /* version of the protocol buffers language */
option csharp_namespace = "DNZ.TicketingSystem.GrpcServer.Protos";
message CreateTicketDto {
int32 user_id = 1;
int32 category_id = 2;
string title = 3;
string description = 4;
}