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 / encrypt-mail.md
Last active July 23, 2020 08:19
Encrypt email with GPG

How to encrypt an email with the receiver's public key

Prerequisites

  • The receiver's public key. You can usually find this on an OpenPGP keyserver e.g. http://pgp.surfnet.nl/
  • An implementation of the OpenPGP standard such as GnuPG

Import the receiver's public key

gpg --import receiver-key.pub
gpg --keyserver keyserver.example.com --search-key [email protected]
@ppartarr
ppartarr / git-setup.sh
Last active December 16, 2019 13:40
Script to setup git on a new machine
#!/usr/bin/env bash
ERROR_MESSAGE='Usage: ./git.sh -e "[email protected]" -n "full name" -g "yes|no"'
while getopts :e:n:g: option; do
case ${option} in
e ) EMAIL=${OPTARG};;
n ) NAME=${OPTARG};;
g ) GPG=${OPTARG};;
\? ) echo -e "$ERROR_MESSAGE";;
@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
@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 / 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 / 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 / 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 / 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 / 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 / links.md
Created October 27, 2020 08:46
youtube-dl source code