Skip to content

Instantly share code, notes, and snippets.

View leandroribeiro's full-sized avatar
🎯
Focusing

Leandro Ribeiro leandroribeiro

🎯
Focusing
View GitHub Profile
[alias]
# ---------------------------------
# Log commands to inspect history
#----------------------------------
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# List commits showing changed files is invoked with git ll and looks like this:
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
@leandroribeiro
leandroribeiro / wp_install.bat
Created October 14, 2016 15:45
Automatic WordPress installation powered by wp-cli
@echo off
:: Source: https://indigotree.co.uk/automated-wordpress-installation-cmd/
:: STEPS:
:: 1. Install wp-cli
:: 2. Install composer
:: 3. Install MySQL
:: 4. Configure wp-cli at System PATH
:: 5. Configure composer at System PATH
@leandroribeiro
leandroribeiro / WebConfig-Live-Transformations.xml
Last active February 10, 2017 18:47
Transform web.config on build with custom targets
<!-- More read here: https://msdn.microsoft.com/en-us/library/ms366724.aspx -->
<!-- First, we extend the "BuildDependsOn" property with our custom target for applying the transform.
This is a cleaner/safer alternative to overloading the "AfterBuild" target: -->
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
_VisualStudioApplyTransform;
</BuildDependsOn>
</PropertyGroup>
@leandroribeiro
leandroribeiro / evernote-dark.css
Created April 1, 2018 00:58
Evernote Dark Mode 201803
div#gwt-debug-NoteView-root,
div#gwt-debug-NoteTitleView-container,
img.en-media
{
filter: invert(.9)
}
body,
div#gwt-debug-sidebar,
div#gwt-debug-NotebookHeader-container
{
@leandroribeiro
leandroribeiro / gist:9e46b50235ad4e93eeb97f6eb576a0bb
Created May 7, 2018 17:16
.NET Core Memory Cache Simple Demo 01
try
{
var provider = new ServiceCollection()
.AddMemoryCache()
.BuildServiceProvider();
//And now?
var cache = provider.GetService<IMemoryCache>();
using (var entry = cache.CreateEntry("item2"))
@leandroribeiro
leandroribeiro / Dockerfile
Last active March 5, 2024 09:30
Docker Compose and Dockerfile to build and publish .NET Full Framework Sample WebAPI ASP.NET 4.8
# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS builder
WORKDIR /app
COPY API1/. .
RUN nuget restore -PackagesDirectory ../packages
# RUN msbuild API1.csproj /p:OutputPath=c:\out `
# /t:restore
RUN msbuild API1.csproj /p:Configuration=Debug `
/p:DeployOnBuild=True `
/p:DeployDefaultTarget=WebPublish `
@leandroribeiro
leandroribeiro / main.cs
Last active August 13, 2021 14:53
C# - Prevent Sleep on Windows v1
using System;
using System.Runtime.InteropServices;
namespace DisableSleepMode
{
class Program
{
// Sleep Control
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
@leandroribeiro
leandroribeiro / main.cs
Created August 13, 2021 14:52
C# - Prevent Sleep on Windows v2
using System;
using System.Threading;
using System.Runtime.InteropServices;
// reference http://eddiejackson.net/lab/2020/03/02/c-prevent-sleep-on-windows-v2/
namespace SleepControl
{
class Program
@leandroribeiro
leandroribeiro / canary.yml
Created March 6, 2024 13:27
Amazon CloudWatch Synthetics Canary - Cloud Formation Sample
CloudWatchSyntheticsRole:
Type: AWS::IAM::Role
Properties:
RoleName: ${self:service}-${self:provider.region}-ExecutionRole
Description: CloudWatch Synthetics lambda execution role for running canaries
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
@leandroribeiro
leandroribeiro / create-bucket.sh
Created March 7, 2024 12:31
Create S3 Bucket with AWS CLI
# by parameter
# bucketName=$1
# fixed value
bucketName=cw.sa-east-1.syn-results
# Create the bucket
aws s3api create-bucket --bucket ${bucketName} --region your-region
# Enable server-side encryption