Skip to content

Instantly share code, notes, and snippets.

View GiovanniGrieco's full-sized avatar
💭
mumble mumble

Giovanni Grieco GiovanniGrieco

💭
mumble mumble
View GitHub Profile
@GiovanniGrieco
GiovanniGrieco / Enforce_Wayland_Qt_Flatpak_App.sh
Created May 7, 2022 06:36
Enforce Wayland in Qt-based Flatpak Application
#!/bin/bash
APP_NAME=$1
flatpak --user override --socket=wayland --env="XCURSOR_SIZE=24" --env="QT_QPA_PLATFORM=wayland" $APP_NAME
@GiovanniGrieco
GiovanniGrieco / Setup-Podman-on-LXC.md
Last active November 7, 2024 07:36
Setup Podman on LXC

Before you start, please NOTE: this guide does not cover rootless containers!

On an hypervisor with LXD installed, create a new container, ensuring that -c security.nesting=true -c security.privileged=true is set:

lxc launch -c security.nesting=true -c security.privileged=true images:fedora/35 my-container

If the container already exists, set this parameter through lxc config:

lxc config set my-container security.nesting=true
lxc config set my-container security.privileged=true
@GiovanniGrieco
GiovanniGrieco / wsl.conf
Created February 26, 2022 12:12
Enable filesystem metadata on WSL2
# Place this file in /etc/wsl.conf, then reboot WSL VM via the following command
# PS> wsl --shutdown
# (then open a new WSL2 terminal session)
#
[automount]
enabled = true
options = metadata
mountFsTab = false
@GiovanniGrieco
GiovanniGrieco / podman_on_wsl2.md
Last active July 15, 2024 15:10
Install Podman on WSL2

Install Podman on Windows Subsystem for Linux 2 (WSL2)

This guide allows a safe and rootless installation of Podman on WSL2. Head over the hyperlinks to discover more about these two wonderful technologies!

This guide assumes that Debian 11 "bullseye" is installed as WSL2 base OS. To do it, simply open your Windows Powershell console under Admin rights and run

PS> wsl install -d Debian

After installation, please check that you are under the latest Debian. If not, please upgrade it.

@GiovanniGrieco
GiovanniGrieco / install-openssh-server-windows.ps1
Last active December 6, 2022 17:14
Install OpenSSH Server on Windows
# credits: https://www.medo64.com/2019/12/authorized-keys-in-windows-10-openssh/
# Start as admin
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
# OpenSSH: Install
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
@GiovanniGrieco
GiovanniGrieco / auto-upgrade.sh
Created March 24, 2021 22:15
Automatically upgrade Raspberry Pi OS software packages
#!/bin/bash
if [ "$EUID" -ne "0" ]; then
echo "Please run this script as root."
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt update
  1. Write into /etc/wsl.conf
[automount]
options = "metadata"
  1. Restart WSL (Go to powershell and write wsl --shutdown, then reopen WSL2 terminal)
  2. Execute these commands below:
$ cd ~/
$ ln -s /mnt/c/Users//.ssh .ssh
# List Installed Appx (Metro/Store/Modern Apps)
#Get-AppxPackage | Select Name
# Appx I do not need
# More info: https://docs.microsoft.com/it-it/windows/application-management/apps-in-windows-10
$AppxToRemove = @(
'Microsoft.Windows.Photos',
'Microsoft.WindowsCamera',
'Microsoft.WindowsStore',
'microsoft.windowscommunicationsapps',
@GiovanniGrieco
GiovanniGrieco / calc_hash.py
Created November 10, 2018 23:21
Calulate md5 hash (or any other hash supported by Python) of a given string quickly. For more information: https://docs.python.org/3.7/library/hashlib.html
import hashlib
in = b'My beautiful input string'
hashlib.md5(in).hexdigest()
# '0b78bf24d7128899723fb0e5cf7648b6'
@GiovanniGrieco
GiovanniGrieco / circumvent-gnome-memhog.sh
Last active April 28, 2018 20:17
Circumvent GNOME 3 Memory Leak
#!/usr/bin/bash
# Copyright 2018 Giovanni Grieco <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#