Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Authoring courses

Emanuele Bartolesi kasuken

:octocat:
Authoring courses
View GitHub Profile
@kasuken
kasuken / Program.cs
Last active December 28, 2022 14:25
Auth0 Device Flow - Console application .NET 7
View Program.cs
using Newtonsoft.Json.Linq;
using RestSharp;
const string tenant = "dev-n1b7bzid.us";
const string clientId = "wnvXuZ1rD5VeT4NGBzr1MDNLWu43H5KA";
string access_token = string.Empty;
var client = new RestClient($"https://{tenant}.auth0.com/oauth/device/code");
var request = new RestRequest();
request.Method = Method.Post;
@kasuken
kasuken / component.razor
Created November 21, 2022 12:08
Blazor - write in the console.log with styles
View component.razor
@code {
@inject IJSRuntime JSRuntime
protected override async Task OnInitializedAsync()
{
await JSRuntime.InvokeVoidAsync("console.log", "%cRed Origin 5.0.1 🚀", "color:#0dd8d8; background:#0b1021; font-size:1.5rem; padding:0.15rem 0.25rem; margin: 1rem auto; font-family: Rockwell; border: 2px solid #0dd8d8; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;");
}
}
@kasuken
kasuken / CleanGitHubRepos.ps1
Last active September 23, 2022 05:42
A script to update your local GitHub repositories with the remote branches (and cleanup)
View CleanGitHubRepos.ps1
$branches = ("master", "main", "develop", "dev")
# get all directories in the current directory (just the first level)
$repos = Get-ChildItem -Path . -Filter .git -Recurse -Depth 1 -Force -Directory | Select-Object -expandproperty fullname
function Update-Repos {
Push-Location ".."
$branch = &git rev-parse --abbrev-ref HEAD
@kasuken
kasuken / Program.cs
Created May 24, 2022 07:57
Auth0 Minimal API - Authoriyation and Authentication
View Program.cs
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
@kasuken
kasuken / settings.json
Last active December 17, 2021 15:05
My Windows Terminal Settings
View settings.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
@kasuken
kasuken / devmachine.ps1
Created October 7, 2021 07:30
Tools and software for my workstations and laptops. Windows 11 version.
View devmachine.ps1
#####################
# SOFTWARE
#####################
# Console
cinst poshgit
# 7Zip
cinst 7zip.install -y
View keybase.md

Keybase proof

I hereby claim:

  • I am kasuken on github.
  • I am ebartolesi (https://keybase.io/ebartolesi) on keybase.
  • I have a public key ASD-nHf_Ps_Yh4_wIO0bTyr07z47zTI9shrcpK0FKt_XIwo

To claim this, I am signing this object:

@kasuken
kasuken / removewelcomemessage.ps1
Created November 4, 2020 20:16
How to disable welcome message from Office 365 groups
View removewelcomemessage.ps1
Connect-ExchangeOnline -UserPrincipalName <YOUR UPN> -ShowProgress $true
#$O365Groups = Get-UnifiedGroup | Where-Object { $_.WelcomeMessageEnabled -eq $true }
$O365Groups = Get-UnifiedGroup
foreach ($group in $O365Groups) {
Write-Host "Disabling Welcome Message on O365 Group: " -NoNewline; Write-Host $group.DisplayName -ForegroundColor Cyan
Set-UnifiedGroup $group.Identity -AlwaysSubscribeMembersToCalendarEvents:$false -AutoSubscribeNewMembers:$false -SubscriptionEnabled:$false -UnifiedGroupWelcomeMessageEnabled:$false
}
@kasuken
kasuken / RemoveAllModermPages.ps1
Created October 29, 2020 04:58
PowerShell script to remove all modern pages from SharePoint Online with PnP
View RemoveAllModermPages.ps1
$siteUrl = ""
Connect-PnPOnline –Url $siteUrl -UseWebLogin
$items =Get-PnPListItem -List "SitePages" -PageSize 1000
foreach ($item in $items)
{
if ($item.Id -ne 1)
{
try
@kasuken
kasuken / changeTeamsLanguage.ps1
Created October 27, 2020 13:33
Change Teams Language from PowerShell
View changeTeamsLanguage.ps1
$configPath = "$ENV:APPDATA\Microsoft\Teams\desktop-config.json";
$cookiesFilePath = "$ENV:APPDATA\Microsoft\Teams\Cookies"
$cookiesJournalPath = "$ENV:APPDATA\Microsoft\Teams\Cookies-journal"
$teams = Get-Process Teams -ErrorAction SilentlyContinue
if ($teams) {
Stop-Process -Name Teams -Force
}
Start-Sleep -s 5