Skip to content

Instantly share code, notes, and snippets.

View flaf's full-sized avatar

François Lafont flaf

View GitHub Profile
@flaf
flaf / email-from-my-freenas.md
Last active January 31, 2019 05:48
Strange email from my FreeNAS
zstore-2.dc2.backbone.education changes in mounted filesystems:
1d0
< 192.168.19.20:/zstore/nunkis /root/mnt-zstore1-nunkis nfs	rw		0 0

zstore-2.dc2.backbone.education kernel log messages:
> CPU: AMD Opteron(tm) Processor 6128 (2000.06-MHz K8-class CPU)
> SMP: AP CPU #7 Launched!
> SMP: AP CPU #4 Launched!
@flaf
flaf / bonding-mac-address.md
Last active February 8, 2019 11:26
MAC address of bonding in Ubuntu 18.04

I'm on Ubuntu 18.04. According to the pastes below:

  • mac address of eno1 0c:c4:7a:c6:ae:26
  • mac address of eno2 0c:c4:7a:c6:ae:27
  • mac address of bond1 (bondig of eno1 and eno2) 92:da:30:66:27:50

Why 92:da:30:66:27:50 for bond1? No relation with the mac address of eno1 and eno2.

Here is the content of /etc/netplan/01-netcfg.yaml
@flaf
flaf / rebase-old-branch.md
Last active April 4, 2019 09:48
Rebase an old branch

I have this:

A - B - C - F - G (master)
         \
          D - E (BranchB, origin/BranchB)

I want to have this:

@flaf
flaf / endpoints-of-a-zonegroup.md
Created April 1, 2019 07:12
endpoints of a zonegroup
[root@ceph01 /]# radosgw-admin --cluster ceph-a zonegroup get
{
    "id": "47e7433a-bfe2-4c6a-b761-4cdf32cbf25c",
    "name": "zg-1",
    "api_name": "zg-1",
    "is_master": "true",
    "endpoints": [
        "http://s3.virt.priv:8080"
    ],
@flaf
flaf / powershell-sort-array-of-objects.md
Created June 16, 2019 21:11
powershell-sort-array-of-objects
# pwsh
PowerShell 6.2.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /root/mnt> class A {                                        
&gt;&gt; 
@flaf
flaf / crack.py
Last active May 18, 2020 08:28
python-and-multiprocessing
#!/usr/bin/env python3
import string
import itertools
import hashlib
import json
from multiprocessing import Pool, Manager
U = string.ascii_uppercase # ['A', 'B', ..., 'Z']
L = string.ascii_lowercase # ['a', 'b', ..., 'z']
@flaf
flaf / subiquity.md
Last active October 8, 2021 16:48
subiquity: "storage" key in user-data not well taken into account

Auto-installation of Ubuntu Focal Fossa via ubuntu-20.04.3-live-server-amd64.iso. Here is my user-data file:

#cloud-config
autoinstall:
  version: 1
  locale: en_US.UTF-8
  keyboard:
    layout: fr
    variant: ""
@flaf
flaf / custom-syslog-forwarding-in-journald.md
Last active October 12, 2021 17:09
custom syslog forwarding in journald?

Here is a typicall event/message from journald (via journalctl -f -o json | jq for readability):

{
  "_AUDIT_LOGINUID": "0",
  "SYSLOG_IDENTIFIER": "conmon",
  "__REALTIME_TIMESTAMP": "1634057819962204",
  "_GID": "0",
  "_CAP_EFFECTIVE": "1ffffffffff",
  "_SYSTEMD_SLICE": "machine.slice",
@flaf
flaf / cloud-init-network-config.md
Last active October 28, 2021 22:20
cloud-init: bad support of "networking config version 2"

TL;DR

  1. It seems that the device ID (id0 in my example) is always used in the rendered configuration, but a udev rule is added to rename this interface to the device ID. The only way where the device ID is not used for me it's when I use set-name: <ifname> to force another name for the interface.
  2. A match: rule with the name property doesn't work for me, in any case, with a fixed name or with globbing in name. The doc says that globbing in name can work only with networkd renderer (ie --output-kind networkd), but for me name has never worked in any case (the device ID is used and no udev rule is present).

Here is my environment:

@flaf
flaf / keep-null-value.md
Last active November 26, 2021 12:40
[ansible] How to keep null value?

My playbook:

---
- hosts: "localhost"
  connection: "local"
  gather_facts: false
  vars:
    x: null
    y: