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 / 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
@patlegu
patlegu / Windows 10 (and 7) Built-In MD5 Checksum Calculator
Created November 19, 2020 09:47
Windows 10 (and 7) Built-In MD5 Checksum Calculator
Open a command prompt and enter the following:
CertUtil -hashfile <path to file> MD5
Depending on the size of the file it may take a few seconds to run the calculation but if successful the MD5 hash will be displayed as below.
It is also possible to generate checksums for other hash algorithms by replacing the MD5 parameter used above with any of the following
(note that if you don’t specify a value then SHA1 is used by default):
MD2
@patlegu
patlegu / Hyper-V Server 2016 Download Locations + 2012 R2
Created November 19, 2020 07:34
Hyper-V Server 2016 Download Locations + 2012 R2
Hyper-V Server 2016 Download Locations + 2012 R2, 2008
The official ISO download for Hyper-V Server 2016 is:
http://care.dlservice.microsoft.com/dl/download/E/4/E/E4EFC175-3D2D-49A6-B6D9-1B389887F764/14393.0.160916-1106.RS1_REFRESH_SERVERHYPERCORE_OEM_X64FRE_EN-US.ISO
The official ISO download link for Hyper-V Server 2012 R2 is:
http://care.dlservice.microsoft.com/dl/download/F/7/D/F7DF966B-5C40-4674-9A32-D83D869A3244/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVERHYPERCORE_EN-US-IRM_SHV_X64FRE_EN-US_DV5.ISO