Skip to content

Instantly share code, notes, and snippets.

View imclint21's full-sized avatar

clint21.eth ⚡️ imclint21

View GitHub Profile
rm -rf quentin/chambre/*
public static Guid CreateCryptographicallySecureGuid()
{
using (var provider = new RNGCryptoServiceProvider())
{
var bytes = new byte[16];
provider.GetBytes(bytes);
return new Guid(bytes);
}
}
@imclint21
imclint21 / CreateCryptographicallySecureGuid.cs
Created September 18, 2018 14:56
Making a Cryptographically Secure Guid
public static Guid CreateCryptographicallySecureGuid()
{
using (var provider = new RNGCryptoServiceProvider())
{
var bytes = new byte[16];
provider.GetBytes(bytes);
return new Guid(bytes);
}
}
@imclint21
imclint21 / SendInBlue_ConfirmationEmail.cs
Created September 28, 2018 17:18
Use SendInBlue to send confirmation mail with an activation link (use a SendInBlue template ID)
public static bool SendConfirmationEmail(string emailAddress, string activationLink)
{
var client = new RestClient("https://api.sendinblue.com/v3/smtp/email");
var sendInBlueRequest = new RestRequest(Method.POST);
sendInBlueRequest.AddHeader("api-key", "SENDINBLUE_API_KEY");
sendInBlueRequest.AddHeader("Accept", "application/json");
sendInBlueRequest.AddHeader("Content-Type", "application/json");
sendInBlueRequest.AddParameter("undefined", $"{{\"tags\":[\"Activate account for {{emailAddress}}\"],\"sender\":{{\"email\":\"[email protected]\",\"name\":\"You\"}},\"htmlContent\":\"\",\"replyTo\":{{\"email\":\"[email protected]\",\"name\":\"You\"}},\"templateId\":2,\"to\":[{{\"email\":\"{emailAddress}\",\"name\":\"{emailAddress}\"}}],\"params\":{{\"ActivationLink\":\"{activationLink}\"}}}}", ParameterType.RequestBody);
var sendInBlueResponse = client.Execute(sendInBlueRequest);
return sendInBlueResponse.IsSuccessful;
@imclint21
imclint21 / QrCodeView.cs
Created October 17, 2018 18:48
.NetCore make QrCode for bitcoin/cryptos address
[Route("qr/{value}")]
public IActionResult Qr(string value)
{
var memoryStream = new MemoryStream();
var qrGenerator = new QRCodeGenerator();
var qrCodeData = qrGenerator.CreateQrCode(value, QRCodeGenerator.ECCLevel.L);
var qrCode = new QRCode(qrCodeData);
qrCode.GetGraphic(20).Save(memoryStream, ImageFormat.Png);
return File(memoryStream.ToArray(), "image/png");
}
@imclint21
imclint21 / DeployNetCoreApp.sh
Created October 22, 2018 01:03
Install all .Net Core required depencies.
sudo apt update && apt upgrade -y
sudo apt install -y nginx git tmux iftop multitail nmap apt-transport-https certbot python-certbot-nginx curl
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/9/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install -y dotnet-sdk-2.1 libgdiplus

Keybase proof

I hereby claim:

  • I am clintnetwork on github.
  • I am clint_network (https://keybase.io/clint_network) on keybase.
  • I have a public key ASCed7XJ6h4jKzYO2HcXiOF2U_LaHD0SqHsrpV81DfUEQQo

To claim this, I am signing this object:

@imclint21
imclint21 / launch.json
Created May 22, 2019 16:53
VueJs Debugging in VsCode
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "yarn",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"serve"
@imclint21
imclint21 / ssl_proxy.config
Created July 16, 2019 14:41 — forked from paulswartz/ssl_proxy.config
SSL Forwarding Proxy w/ nginx
# run as 'nginx -p . -c ssl_proxy.config'
daemon off;
http {
server {
listen localhost:8443;
server_name localhost;
ssl on;
ssl_certificate ../pooling-ui/certs/server.crt;
@imclint21
imclint21 / ApiExplorerGetsOnlyConvention.cs
Created July 29, 2019 02:42
[Swashbuckle.AspNetCore] Display only ApiController controllers in the swagger
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace MyProgram
{
public class ApiExplorerGetsOnlyConvention : IActionModelConvention
{
public void Apply(ActionModel action)
{
action.ApiExplorer.IsVisible = action.Controller.Attributes.Any(x => x.GetType() == typeof(Microsoft.AspNetCore.Mvc.ApiControllerAttribute));