Skip to content

Instantly share code, notes, and snippets.

View alexandrebl's full-sized avatar
🛰️
Working from space

ABrandaoL alexandrebl

🛰️
Working from space
View GitHub Profile
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using System;
using System.Text;
class Receive
{
public static void Main()
{
var factory = new ConnectionFactory() { HostName = "localhost" };
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace EchoServerSocket {
internal class Program {
private static void Main(string[] args) {
while (true) {
var quit = false;
using System;
using Akka.Actor;
namespace SimpleReceiverAkkaDotNet
{
internal class Program
{
private static void Main()
{
var actorSystem = ActorSystem.Create("MessageSystemActor");
@alexandrebl
alexandrebl / WebApiStartup.cs
Last active April 13, 2018 16:59
.Net Core 2.0 WebApi StartUp Code
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace CryptoCurrencyInfo {
public sealed class Startup {
public Startup(IConfiguration configuration) {
@alexandrebl
alexandrebl / EmptyWebApiStartupCode.cs
Created April 13, 2018 17:01
.Net Core 2.0 Empty Web Api Startup Code
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace CryptoCurrencyInfo {
public sealed class Startup {
public void ConfigureServices(IServiceCollection services) {
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Http;
using BinanceCryptoCurrency.Domain;
using BinanceCryptoCurrency.Domain.Entity;
using Newtonsoft.Json;
namespace BinanceCryptoCurrency.Utility {
@alexandrebl
alexandrebl / redisDocker.sh
Created April 14, 2018 21:23
Redis running under Docker
docker run --name redis_test -p 6379:6379 -d redis
@alexandrebl
alexandrebl / SqlBatcWritter.sql
Created April 14, 2018 21:27
SQL Server Batch Writter
IF OBJECT_ID('dbo.Nums') IS NOT NULL
DROP TABLE dbo.Nums;
GO
CREATE TABLE dbo.Nums(n INT NOT NULL PRIMARY KEY);
DECLARE @max AS INT, @rc AS INT;
SET @max = 1000000000;
SET @rc = 1;
INSERT INTO Nums VALUES(1);
WHILE @rc * 2 <= @max
@alexandrebl
alexandrebl / SqlGetDatabaseSize.sql
Created April 14, 2018 21:28
Sql Server Get DataBase Size
select
a.FILEID,
[FILE_SIZE_MB] =
convert(decimal(12,2),round(a.size/128.000,2)),
[SPACE_USED_MB] =
convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)),
[FREE_SPACE_MB] =
convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) ,
NAME = left(a.NAME,15),
FILENAME = left(a.FILENAME,30)
@alexandrebl
alexandrebl / SqlGetDatabaseSizeWithDetails.sql
Created April 14, 2018 21:30
Sql Server Get Database Size with Details
IF OBJECT_ID('tempdb.dbo.#space') IS NOT NULL
DROP TABLE #space
CREATE TABLE #space (
database_id INT PRIMARY KEY
, data_used_size DECIMAL(18,2)
, log_used_size DECIMAL(18,2))
DECLARE @SQL NVARCHAR(MAX)