Skip to content

Instantly share code, notes, and snippets.

View ppartarr's full-sized avatar
🏠
Working from home

Philippe Partarrieu ppartarr

🏠
Working from home
View GitHub Profile
@ppartarr
ppartarr / reinstall-grub.sh
Created March 5, 2021 08:24
Reinstall grub after Windows updates (Arch & Windows dual boot)
#!/usr/bin/env bash
# mount the boot partition
mount /dev/nvme0n1p9 /mnt
mount /dev/nvme0n1p7 /mnt/boot
# change root to /mnt partition
arch-chroot /mnt
# reinstall grub
@ppartarr
ppartarr / lxd-reset.sh
Created December 1, 2020 12:11
Reset LXD
#!/usr/bin/env bash
set -euo pipefail # -> http://redsymbol.net/articles/unofficial-bash-strict-mode/
# Reverse what lxd init does
function check_distro() {
local distro=$(grep 'DISTRIB_CODENAME' /etc/lsb-release | cut -d '=' -f 2)
echo "$distro"
@ppartarr
ppartarr / links.md
Created October 27, 2020 08:46
youtube-dl source code
@ppartarr
ppartarr / moveMouse.py
Created October 12, 2020 16:49
Arbitrarily move the mouse to a random location on screen
import win32api
import time
import random
import logging
# 1920x1080 resolution
xLow = 0
xHigh = 1920
yLow = 0
yHigh = 1080
@ppartarr
ppartarr / rmGroups.ps1
Created July 15, 2020 21:25
Remove all Azure AD groups starting with a given prefix
# This script requires :
# 1. the Azure AD Powershell module: Install-Module -Name AzureADPreview
# 2. an authenticated user: Connect-AzureAD
$uid = ""
$groupPrefix = "GroupNamePrefix"
$groups = Get-AzureADMSGroup
$groups | Select-Object -Skip 3 | Where-Object {
$_ -match '(\d+)\s+(\d+)\s+(.*?)\s+([a-z]+(?:-[a-z0-9]+){2,})\s+(.*)'
@ppartarr
ppartarr / mkGroups.ps1
Created July 15, 2020 21:24
Create Azure AD groups and add a given user
# This script requires :
# 1. the Azure AD Powershell module: Install-Module -Name AzureADPreview
# 2. an authenticated user: Connect-AzureAD
$uid = ""
$numberOfGroupsToCreate = 200;
for($i = 0; $i -lt $numberOfGroupsToCreate; $i++)
{
$displayName = "GroupNamePrefix" + $i
@ppartarr
ppartarr / wlp58s0-eduroam
Created December 13, 2019 13:28
Eduroam netctl config
Description='Eduroam'
Interface=wlp58s0
Connection=wireless
Security=wpa-configsection
ESSID=eduroam
IP=dhcp
TimeoutWPA=60
TimeoutUp=300
TimeoutCarrer=300
WPAConfigSection=(
@ppartarr
ppartarr / lines.md
Created December 11, 2019 09:42
Lines of code in QEMU
/opt/qemu-4.2.0-rc2$ cloc .
   44416 text files.
   41844 unique files.
   13644 files ignored.

github.com/AlDanial/cloc v 1.74  T=240.98 s (128.9 files/s, 42400.5 lines/s)
---------------------------------------------------------------------------------------
Language                             files          blank        comment           code
---------------------------------------------------------------------------------------
@ppartarr
ppartarr / cloc.md
Last active December 11, 2019 09:41
Lines of code in Linux v5.2
$ cloc .
   63030 text files.
   62579 unique files.
   13714 files ignored.

github.com/AlDanial/cloc v 1.74  T=415.23 s (121.3 files/s, 58042.5 lines/s)
---------------------------------------------------------------------------------------
Language                             files          blank        comment           code
---------------------------------------------------------------------------------------
@ppartarr
ppartarr / .config
Created December 4, 2019 15:31
Linux kernel microvm config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.3.0-rc3 Kernel Configuration
#
#
# Compiler: gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=90101