Skip to content

Instantly share code, notes, and snippets.

View patlegu's full-sized avatar
💭
Down under

patlegu

💭
Down under
View GitHub Profile
@patlegu
patlegu / markdown-to-word-macro.md
Last active September 23, 2025 14:37
markdown-to-word-macro

Sub ConvertirMarkdownVersStyle() ' ' Macro pour convertir le contenu Markdown en styles Word ' Créée pour transformer la syntaxe Markdown en formatage Word natif '

Dim doc As Document
Set doc = ActiveDocument

' Désactiver la mise à jour de l'écran pour améliorer les performances

@patlegu
patlegu / word-to-markdown-macro.md
Last active September 23, 2025 14:34
word to Markdown macro

Sub ConvertirWordVersMarkdownComplet() ' ' Macro complète pour convertir Word en Markdown avec tous les éléments ' Version étendue avec images, citations, métadonnées, etc. '

Dim doc As Document
Dim newDoc As Document
Dim para As Paragraph

Dim markdownText As String

@patlegu
patlegu / broadcast_calc.sh
Created May 2, 2025 07:29 — forked from cskeeters/broadcast_calc.sh
Bash script for calculating network and broadcast addresses from ip and netmask or CIDR Notation
#!/bin/bash
# Calculates network and broadcast based on supplied ip address and netmask
# Usage: broadcast_calc.sh 192.168.0.1 255.255.255.0
# Usage: broadcast_calc.sh 192.168.0.1/24
tonum() {
if [[ $1 =~ ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+) ]]; then
# Variables
VERT="\\033[1;32m"
ROUGE="\\033[1;31m"
BLEU="\\033[1;34m"
BLANC="\\033[0;02m"
JAUNE="\\033[1;33m"
while [[ $# -ge 1 ]]; do
case $1 in
-s|--site)
# Building Docker image with Packer and provisioning with Ansible
## Overview
**Packer**
* Packer is used to build image from a base image, perform provisions and store (commit) the final image.
* We use provisioners and Packer templates to do the actual work to create the final image.
* We use Ansible for provisioning.
@patlegu
patlegu / ansible_logic.md
Last active July 20, 2021 07:39
How to implemente some logic in ansible

And, or and not

" Condition? A condition in Ansible can be described in a when statement. This is a simple example:

- name: do something only to virtual instances
debug:
  msg: "Here is a message from a guest"
when: ansible_virtualization_role == "guest"
@patlegu
patlegu / Ansible.md
Last active July 20, 2021 07:35
Notes around Ansible

##Failing to strive for idempotency If you aren’t focusing on writing Idempotent roles, you should be. Most people run into this pitfall when using certain modules like Command. When using command alone, Ansible will always run the command and mark the task as changed even if nothing has actually changed on the host.

Here is a simple example: I want to enable the optional repo if it’s disabled. If I do it like this, the task will show as “changed” no matter what.

- name: Enable optional repo
command: yum-config-manager --enable {{item}}
with_items:
@patlegu
patlegu / docker_dedicated_filesystem.md
Last active July 17, 2021 23:59
Gist from hopeseekr

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

import sims4.commands
@sims4.commands.Command('gml','grandmotherlode', command_type=sims4.commands.CommandType.Live)
def grandmotherlode(times:int=None,_connection=None):
output = sims4.commands.CheatOutput(_connection)
if times is not None or type(times) != 'int':
if times > 0:
for x in range(0,times):
sims4.commands.client_cheat('|motherlode', _connection)
@patlegu
patlegu / vcenter vm guest identity
Created December 23, 2020 23:36
guest identification information.
Guest operating system identifier (short name). This attribute was added in vSphere API 6.7
Defines the valid guest operating system types used for configuring a virtual machine. Value is one of:
DOS: MS-DOS.
WIN_31: Windows 3.1
WIN_95: Windows 95
WIN_98: Windows 98
WIN_ME: Windows Millennium Edition
WIN_NT: Windows NT 4
WIN_2000_PRO: Windows 2000 Professional
WIN_2000_SERV: Windows 2000 Server