Skip to content

Instantly share code, notes, and snippets.

View djibe's full-sized avatar

JB djibe

View GitHub Profile
@djibe
djibe / ffmpeg-batch-folder-encode.md
Created July 5, 2024 19:53
ffpeg : Encode all video files in folders
FOR /F "tokens=*" %%G IN ('dir /b *.avi')
DO ffmpeg.exe -hide_banner -i "%%G" -threads 8 -acodec mp3 -b:a 128k -ac 2 -strict -2 -c:v libx264 -crf 23 -filter:v "scale=1280:-2,unsharp=5:5:1.0:5:5:0.0" -sws_flags lanczos -b:v 1024k -profile:v main -preset medium -tune film -async 1 -vsync 1 "%%~nG.mp4"

for %i in (*.mp4) do ffmpeg -i "%i" "%~ni.mp3"

https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg
for PRESET in $(seq 7 -1 5); do for CRF in "$(seq 35 -5 20)"; do ffmpeg -probesize 9223372036854775807 -analyzeduration 9223372036854775807 -fflags +genpts+igndts -i in.mkv -map 0 -c:v libsvtav1 -crf "${CRF}" -preset "${PRESET}" -svtav1-params:v:0 enable-overlays=1:enable-tf=0:fast-decode=0:film-grain=0:film-grain-denoise=0:keyint=120:scd=1:tune=0 -c:a libopus -b:a "" -vbr on -mapping_family 1 -filter:a aformat=channel_layouts="7.1|6.1|5.1|5.0|quad|3.0" -c:s webvtt -map_chapters -1 -map_metadata -1 "out-${CRF}.mkv"; done; done
@djibe
djibe / windows-list-files-not-contain.md
Created June 10, 2024 17:39
Windows: List files not containing a string

Windows : How to list files not containing a string

In the current folder, list all markdown files that don"t have the "draft" string:

@for /r %f in (*.md) do @find "draft" "%f" > nul || echo %f
@djibe
djibe / sync-hotmail-calendar-android.md
Created May 22, 2024 17:22
How to sync Hotmail calendar on Android

How to sync Hotmail calendar on Android in 2024 ?

Exchange is no longer active. The only way to synchronize an Hotmail calendar on Android is to install the Outlook app.

  • Connect to your Hotmail account
  • In the Outlook app, go to User > Settings > Calendar > Switch on Calendar sync

You can now display your calendar with another app like aCalendar.

@djibe
djibe / csv-to-json.js
Created May 8, 2024 13:35
VSC to JSON
const CSVToJSON = (data, delimiter = ',') => {
const titles = data.slice(0, data.indexOf('\n')).split(delimiter);
return data
.slice(data.indexOf('\n') + 1)
.split('\n')
.map(v => {
const values = v.split(delimiter);
return titles.reduce(
(obj, title, index) => ((obj[title] = values[index]), obj),
{}
@djibe
djibe / upgrade-old-mac.md
Last active May 8, 2024 13:37
Upgrade old Mac

Upgrade an old Mac

Install latest Mac updates

Continue to use MacOS: OpenCore Legacy Patcher

Install Linux

If the computer is too old, install Ubuntu Budgie with Cupertino theme.

@djibe
djibe / restaurer-session-firefox-perdue.md
Last active March 13, 2024 18:32
Restaurer une sessions Firefox perdue

Restaurer une session Firefox perdue

  1. Fermez le navigateur Firefox. Assurez-vous qu'aucune instance du navigateur n'est en cours d'exécution.
  2. Ouvrez le dossier de profil (C:\Users\USERNAME\AppData\Roaming\Mozilla\Firefox\Profiles, dossier le plus récent) et renommez le fichier de session en cours sessionstore.jsonlz4 en sessionstore-backup.jsonlz4.
  3. Ouvrez le dossier sessionstore-backups du profil.
  4. Renommez recovery.jsonlz4 en recovery-backup.jsonlz4.
  5. Renommez recovery.backlz4 en recovery-backup.backlz4.
  6. Copiez la sauvegarde de restauration de session que vous souhaitez restaurer, par exemple, previous.jsonlz4.
  7. Retournez au répertoire racine du profil Firefox.
  8. Collez le fichier copié dans le dossier racine.
@djibe
djibe / winget-package-create.md
Created February 2, 2024 10:52
Create a winget package

Create a winget package

You must be the owner of the package and have a valid Github account.

Run commands:

winget install wingetcreate
winget create new
@djibe
djibe / windows11-23H2-tpm-secureboot.md
Last active March 4, 2024 20:44
Install Windows 11 23H2 without TPM and Secure Boot requirements

Install Windows 11 23H2 without TPM and Secure Boot requirements

This only works for a clean installation.

  1. Create a Windows 11 ISO with Microsoft's Media Creation Tool
  2. Install Setup Patchium and run it
  3. Home tab: Select ISO, wait during processing
  4. Go to Install > Uncheck Remove upgrade and Check Disable Windows 11 compatibility restrictions, click Apply
  5. Optional: To install without a Microsoft account, go to Install OOBE tab. Click Integrate lumOOBE
  6. Click on Create ISO button
@djibe
djibe / modern-html.md
Last active September 5, 2023 10:14
Modern HTML

Modern HTML

Images

<picture>
  <source sizes="(max-width: 608px) 100vw, 680px"
    srcset="/img/photo-1920w.avif 1920w,
      /img/photo-1280w.avif 1280w,
 /img/photo-640w.avif 640w,
@djibe
djibe / ubuntu-windows11-hyperv.md
Created June 1, 2023 08:35
Ubuntu for Windows 11 with Hyper-V

Ubuntu for Windows 11 with Hyper-V

Tutorial to setup Windows 11 and use Ubuntu in a virtual machine (VM).

Requirements

  • Windows 11 Pro
  • Virtualization enabled
    • Go to Task Manager > Performance > CPU. Make sure Virtualization is Enabled.
  • If not, you must enable Virtualization in your UEFI