Skip to content

Instantly share code, notes, and snippets.

View AlbertoDePena's full-sized avatar

Alberto De Pena AlbertoDePena

  • Crane Worldwide Logistics
  • Willis, TX
View GitHub Profile
@AlbertoDePena
AlbertoDePena / Tips-And-Tricks.MD
Last active March 19, 2024 16:08
Tips and Tricks

Visual Studio 2022 / Visual Studio Code

Press Alt while selecting the block of code with the mouse (boxing).

Press Alt+Shift+Up / Alt+Shift+Down to insert cursor above / below.

Press Ctrl+Alt / Alt and click where you want to add a caret.

Select the word then press Alt+Shift+. / Ctrl+D to select the next occurance.

USE EventStore;
GO
CREATE TABLE dbo.Events
(
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
[Type] NVARCHAR(256) NOT NULL,
[Data] NVARCHAR(MAX) NOT NULL,
[Version] INT NOT NULL,
[StreamName] NVARCHAR(256) NOT NULL,
function prompt {
Write-Host("")
$statusString = ""
$symbolicRef = git symbolic-ref HEAD
$isGit = $NULL -ne $symbolicRef
$location = $(get-location)
if ($isGit) {
$branch = $symbolicRef.substring($symbolicRef.IndexOf("heads/") + 6)
$statusString = "GIT " + $branch + " " + $location + ">"
@AlbertoDePena
AlbertoDePena / Serilog.fs
Last active January 21, 2023 00:06
FSharp logger with Serilog (app insights and console sinks)
// NuGet Packages
// Serilog.Enrichers.Environment
// Serilog.Sinks.ApplicationInsights
// Serilog.Sinks.Console
open System
open Serilog
open Serilog.Events
[<RequireQualifiedAccess>]
@AlbertoDePena
AlbertoDePena / yaml.json
Last active September 14, 2020 13:33
YML snippets (VSCODE)
{
"Kubernetes Deployment": {
"prefix": "k8s-deployment",
"body": [
"apiVersion: apps/v1",
"kind: Deployment",
"metadata:",
" name: ${1:deployment-name}",
" labels:",
" ${2:label-key}: ${3:label-value}",
worker_processes 1;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
@AlbertoDePena
AlbertoDePena / Console.fs
Last active February 25, 2020 02:26
Thread safe, colored console
[<RequireQualifiedAccess>]
module Console =
open System
let private log =
let lockObj = obj()
fun color text ->
lock lockObj (fun _ ->
Console.ForegroundColor <- color
printfn "%s" text
[<RequireQualifiedAccess>]
module Async =
open System
open System.Threading
open System.Threading.Tasks
let singleton x = async {
return x
}
@AlbertoDePena
AlbertoDePena / Program.cs
Created March 8, 2019 21:41
Gracefully exit dotnet console app in docker container
using System;
using System.Threading;
using System.Threading.Tasks;
namespace GracefulExit
{
class Program
{
// AutoResetEvent to signal when to exit the application.
private static readonly AutoResetEvent waitHandle = new AutoResetEvent(false);
import babel from 'rollup-plugin-babel';
import common from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
import resolve from 'rollup-plugin-node-resolve';
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'esm'