Skip to content

Instantly share code, notes, and snippets.

@albertopasqualetto
albertopasqualetto / git_all_authors_change.sh
Last active August 10, 2023 23:49
Commands to change the git author and committer names and emails in all the repo
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Author name'; GIT_AUTHOR_EMAIL='Author email'; GIT_COMMITTER_NAME='Committer Name'; GIT_COMMITTER_EMAIL='Committer email';" HEAD
@albertopasqualetto
albertopasqualetto / notion_export_html_to_pdf.py
Last active April 6, 2023 17:29
Create a pdf for each html file exported by Notion in the current directory and merge them in one pdf if required
# Author: Alberto Pasqualetto
# This code is licensed under MIT license
#
# Create a pdf for each html file exported by Notion in the current directory
# and merge them in one pdf if required with -m or --merge
# if only the merge of files in './pdfs' is required use -M or --only-merge
#
# Note: export html files from Notion including subpages but not creating folders for them
import sys
@albertopasqualetto
albertopasqualetto / resume.json
Last active December 29, 2022 18:25
My resume
{
"basics": {
"name": "Alberto Pasqualetto",
"label": "Student at University of Padua",
"image": "https://avatars.githubusercontent.com/u/39854348?v=4",
"summary": "",
"profiles": [
{
"network": "gitconnected",
"username": "albertopasqualetto",
@albertopasqualetto
albertopasqualetto / start_stop_postgresql.bat
Created November 7, 2022 20:50
Start or stop postgresql service if it is (not) running
@echo off
:: Source: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: Source: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
:: batch code to request admin previleges, if no admin previleges
fltmc >nul 2>&1
if NOT %errorLevel% == 0 (
powershell start -verb runas '%0' am_admin & exit /b
)
@albertopasqualetto
albertopasqualetto / copyMyConditionalFormatting.gs
Created October 20, 2022 12:47
Copy conditional formatting rule to all the Google sheet
/** @OnlyCurrentDoc */
function copyMyConditionalFormatting() {
var spreadsheet = SpreadsheetApp.getActive();
var base_range = spreadsheet.getRange("B2:X2"); //Starting range
var conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
for (var i=1; i<=1001-3; i++){ //Which columns
var new_rule = conditionalFormatRules[0].copy //Copy first rule to all sheet
.setRanges([base_range.offset(i, 0)]) //column offset
.build();
@albertopasqualetto
albertopasqualetto / Code.gs
Last active August 23, 2022 13:20
Schedule this gmail
//FILL THIS LIST AND ADD 1 (OR MORE) TRIGGERS TO SEND
// This is the list of mails to send; add a new line for each email to send daily.
// 'recipient' needs to be specified; 'subject' and 'body' are not needed.
const listToSend = new Set([
{recipient:"[email protected]", subject:"subject0", body:"body0"},
{recipient:"[email protected]", subject:"subject1", body:"body1"},
{recipient:"[email protected]", subject:"subject2", body:"body2"}
]);
@albertopasqualetto
albertopasqualetto / bcdeditAutoSwitcher.bat
Created May 20, 2022 22:42
bcdEdit auto switch hypervisor
@echo off
:: Source: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: Source: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
:: batch code to request admin previleges, if no admin previleges
fltmc >nul 2>&1
if NOT %errorLevel% == 0 (
powershell start -verb runas '%0' am_admin & exit /b
)
@albertopasqualetto
albertopasqualetto / Bookmarkify.java
Created March 13, 2022 16:57
Transforms list of urls file into bookmark html file
import java.io.*;
import java.util.Scanner;
public class Bookmarkify{
//argv[0] is a list of urls file
//output file is created in the actual terminal directory
public static void main(String[] argv) throws FileNotFoundException, IOException{
FileReader fr=new FileReader(argv[0]);
BufferedReader br = new BufferedReader(fr);
@albertopasqualetto
albertopasqualetto / OneNoteBackupScript.ps1
Last active October 9, 2024 21:10
Backup di OneNote on Google Drive using Rclone
$TAB = "`t"
# ****** BACKUP OF ONENOTE TO GOOGLE DRIVE USING RCLONE ******
Write-Host "****** RClone OneNote backup on Google Drive ******"
# ****** BACKUP TO UNI DRIVE ******
Write-Host "Backup on Uni Drive..."
Write-Host "$TAB Upload..."
rclone copy "C:\Users\alber\AppData\Local\Microsoft\OneNote\16.0\Backup\Primo Semestre - Quarto anno" "GDrive Uni:_Backup OneNote/Primo Semestre - Quarto anno"
rclone copy "C:\Users\alber\AppData\Local\Microsoft\OneNote\16.0\Backup\Secondo Semestre - Quarto anno" "GDrive Uni:_Backup OneNote/Secondo Semestre - Quarto anno"
@albertopasqualetto
albertopasqualetto / request admin permissions.bat
Last active March 5, 2022 00:16
batch code to request admin previleges, if no admin previleges
:: Source: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: Source: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
:: batch code to request admin previleges, if no admin previleges
fltmc >nul 2>&1
if NOT %errorLevel% == 0 (
powershell start -verb runas '%0' am_admin & exit /b
)