Skip to content

Instantly share code, notes, and snippets.

View filippoquaranta's full-sized avatar
Ad maiora

Filippo Quaranta filippoquaranta

Ad maiora
View GitHub Profile
@filippoquaranta
filippoquaranta / ScrutorSample.cs
Created May 20, 2022 21:47 — forked from andreadottor/ScrutorSample.cs
Esempio di utilizzo di scrutor
services.Scan(scan => scan
.FromCallingAssembly() // 1. Find the concrete classes
.AddClasses() // to register
.UsingRegistrationStrategy(RegistrationStrategy.Skip) // 2. Define how to handle duplicates
.AsSelf() // 2. Specify which services they are registered as
.WithTransientLifetime()); // 3. Set the lifetime for the services
// Registra tutte le classi, quando richiesta la loro interfaccia
services.Scan(scan =>
scan.FromCallingAssembly()
@filippoquaranta
filippoquaranta / dotnetcheatsheet.md
Created August 20, 2021 17:33 — forked from jonlabelle/dotnetcheatsheet.md
Dotnet core Cheat Sheet
@filippoquaranta
filippoquaranta / create-aspnet-core-identity-schema.sql
Created August 18, 2021 07:25 — forked from akatakritos/create-aspnet-core-identity-schema.sql
Script to create the ASPNET core Identity tables
USE [HobbyDB]
GO
/****** Object: Table [dbo].[AspNetRoleClaims] Script Date: 6/4/2018 10:18:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AspNetRoleClaims]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[AspNetRoleClaims](
CREATE DATABASE [٠০౦০٠];
GO
USE [٠০౦০٠];
GO
CREATE SCHEMA [٠০౦০٠];
GO
CREATE TABLE [٠০౦০٠].[٠০౦০٠]([٠০౦০٠] NVARCHAR(20), [۰০౦০٠] NVARCHAR(20), [٠০౦০۰] NVARCHAR(20), [۰০౦০۰] NVARCHAR(20));
GO
CREATE UNIQUE CLUSTERED INDEX [٠০౦০٠] ON [٠০౦০٠].[٠০౦০٠]([٠০౦০٠], [۰০౦০٠], [٠০౦০۰], [۰০౦০۰]);
GO
<!DOCTYPE html>
<html class="nojs html css_verticalspacer" lang="de-DE">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
<meta name="generator" content="2015.2.1.352"/>
<script type="text/javascript" src="jquery-1.12.3.js"></script>
<script type="text/javascript">
// Update the 'nojs'/'js' class on the html node
document.documentElement.className = document.documentElement.className.replace(/\bnojs\b/g, 'js');
@filippoquaranta
filippoquaranta / renaming.markdown
Created July 4, 2021 11:29 — forked from n3dst4/renaming.markdown
How to rename Visual Studio solutions and projects

How to rename solutions and projects in Visual Studio

  1. Don't.

How to rename solutions and projects that were created in Visual Studio

  1. Close Visual Studio and don't open it again until I tell you. Visual Studio is not competent at renaming things.
  2. Assuming you're using git, clean the working folder to remove anything that's not in version control (this will help the search-and-replace step because it won't have to go through a bunch of generated files)

git clean -fdx

@filippoquaranta
filippoquaranta / ntfs_attr.sh
Created June 19, 2021 20:01 — forked from Explorer09/ntfs_attr.sh
Display or change attributes on an NTFS filesystem
#!/bin/sh
# ntfs_attr.sh - Display or change attributes on an NTFS filesystem
# Tools required:
# getfattr(1) and setfattr(1)
# http://savannah.nongnu.org/projects/attr/
# (In Debian/Ubuntu: sudo apt-get install attr)
# ntfs-3g (pre-installed in most Linux distros)
# http://www.tuxera.com/community/ntfs-3g-download/
@filippoquaranta
filippoquaranta / Install-Google-Chrome.ps1
Created May 2, 2021 09:05 — forked from guillermo-musumeci/Install-Google-Chrome.ps1
Unattended install of Google Chrome for Windows using PowerShell
# Unattended Install of Google Chrome
$Installer = $env:TEMP + "\chrome_installer.exe";
Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Installer;
Start-Process -FilePath $Installer -Args "/silent /install" -Verb RunAs -Wait;
Remove-Item $Installer;
@filippoquaranta
filippoquaranta / check_gpio.py
Created April 9, 2021 13:38 — forked from aitzol/check_gpio.py
Python code to check any Raspberry Pi GPIO status
#!/usr/bin/env python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
while True:
data = raw_input("Insert GPIO BCN number to check status (blank to quit): ")
if data == '':
break
try:
@filippoquaranta
filippoquaranta / impatient-js-es2021.md
Created February 18, 2021 21:29 — forked from rauschma/impatient-js-es2021.md
ES2021 edition of “JavaScript for impatient programmers”

What is new in the ES2021 edition of “JavaScript for impatient programmers”?

Free to read online: exploringjs.com/impatient-js/

  • The exercises now run as native ESM modules on Node.js. Previously, they were run via the esm package.
  • Material on new ES2021 features:
    • String.prototype.replaceAll()
    • Promise.any()
    • Logical assignment operators
  • Underscores (_) as separators in number literals and bigint literals