Skip to content

Instantly share code, notes, and snippets.

View CarlosLanderas's full-sized avatar

Carlos Landeras CarlosLanderas

View GitHub Profile
@CarlosLanderas
CarlosLanderas / main.rs
Last active May 6, 2021 07:50
Rust channel threads with cancellation sample
use anyhow::Result;
use std::sync::Arc;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<()> {
let (tx, rx) = std::sync::mpsc::channel();
let cts = Arc::new(cancellation::CancellationTokenSource::new());
let cts_clone = cts.clone();
import Web3 from 'web3';
const getWeb3 = () => {
return new Promise( (resolve, reject) => {
window.addEventListener('load', function() {
let web3 = window.web3;
@CarlosLanderas
CarlosLanderas / Program.cs
Created February 5, 2020 18:38
Dotnet Counters with DiagnosticClient
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Threading.Tasks;
namespace DotnetDiagnostics
{
class Program
@CarlosLanderas
CarlosLanderas / Program.cs
Last active January 8, 2020 07:50
AspNetCore Response Streaming
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace ConsoleApp1
@CarlosLanderas
CarlosLanderas / Program.cs
Created September 29, 2019 19:53
WorkerService + HealthCheck
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Routing;
@CarlosLanderas
CarlosLanderas / profiles.json
Created September 27, 2019 08:11
WinTerminalSettings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals": {
"alwaysShowTabs": true,
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"initialCols": 120,
"initialRows": 30,
"keybindings": [
{
"command": "closeTab",
@CarlosLanderas
CarlosLanderas / cloudSettings
Last active May 27, 2019 04:36
vs-code-online-settings
{"lastUpload":"2019-05-27T04:36:48.206Z","extensionVersion":"v3.2.9"}
@CarlosLanderas
CarlosLanderas / deployment.yml
Last active December 13, 2018 23:14
Kubernetes deployment and infrastructure for Healthchecks tutorial
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: webapp-deploy
spec:
replicas: 3
template:
metadata:
labels:
app: webapp-deploy
@CarlosLanderas
CarlosLanderas / Benchmarks.cs
Created July 3, 2018 22:40
Span<T> benchmarks
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Running;
using System;
using System.ComponentModel;
namespace PropertyCache
{
[ClrJob, MonoJob, CoreJob]
[MemoryDiagnoser]