Skip to content

Instantly share code, notes, and snippets.

View regisdiogo's full-sized avatar

regisdiogo

  • Amsterdam, The Netherlands
View GitHub Profile
@regisdiogo
regisdiogo / Test-API-Connection.ps1
Created December 29, 2022 10:58
Testing Microsoft API Connection
$clientId = "[REDACTED]"
$clientSecret = "[REDACTED]"
$clientState = "my-app-state"
$redirect_uri = "https://localhost:8080"
$developerToken = "[REDACTED]";
Start-Process "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=$clientId&scope=openid%20profile%20https://ads.microsoft.com/msads.manage%20offline_access&response_type=code&redirect_uri=$redirect_uri&state=$clientState&prompt=login"
$code = Read-Host "Grant consent in the browser, and then enter the response URI here"
$code = $code -match 'code=(.*)\&'
@regisdiogo
regisdiogo / remove-local-merged-branches.sh
Created July 28, 2020 09:44
Delete local branches that were merged on remote - Keeping it a cleaner list of branches locally
# first update all local branches
# then get all the merged branches
# from those, exclude our trunk from the list
# pass those branches to `branch -d` to delete them
git fetch -u -p && git branch --merged | grep -v "trunk" | xargs git branch -d
@regisdiogo
regisdiogo / The Technical Interview Cheat Sheet.md
Created October 11, 2016 16:45 — forked from Madakkak/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@regisdiogo
regisdiogo / Startup.cs
Last active June 13, 2022 11:17
ASP.NET Core - Json serializer settings Enum as string and ignore null values
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
});
}
@regisdiogo
regisdiogo / bash on ubuntu on windows - install mongo.md
Last active October 20, 2016 11:01
Bash on Ubuntu on Windows - Install MongoDB Community Edition

Import the public key used by the package management system.

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

Create the /etc/apt/sources.list.d/mongodb-org-3.2.list file

echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
@regisdiogo
regisdiogo / install-picasa.sh
Created May 28, 2016 11:04
Picasa on Ubuntu
sudo apt-get install wine winetricks
cd ~/ && wget http://dl.google.com/picasa/picasa39-setup.exe
wine ~/picasa39-setup.exe