Skip to content

Instantly share code, notes, and snippets.

View cbosdo's full-sized avatar

Cedric Bosdonnat cbosdo

View GitHub Profile
@cbosdo
cbosdo / stitch.py
Created June 27, 2023 12:25
Tiny tool aggregating multiple images into a bigger one for easy printing of thumbnails
#!/usr/bin/python3
import click
import math
import os
from PIL import Image
OUTPUT_SIZE = "15x10"
THUMB_SIZE = "2.5x3.5"
RESOLUTION = 300
@cbosdo
cbosdo / copy-system.py
Last active August 4, 2023 13:48
Clone Uyuni system in multiple fake ones using the DB
#!/usr/bin/python3
import base64
from contextlib import contextmanager
from datetime import datetime, timedelta, timezone
import hashlib
import os
import sys
import click
import jwt
@cbosdo
cbosdo / find-imported.py
Created July 18, 2022 13:12
Find Java files imported by Uyuni's taskomatic
import os
import os.path
import re
import sys
TOP_FOLDER=sys.argv[1]
SRC_FOLDER=os.path.join(TOP_FOLDER, "java/code/src")
package = "com/redhat/rhn/taskomatic/core/"
@cbosdo
cbosdo / commit-to-pr
Last active May 6, 2021 13:11
commit to pr
#!/usr/bin/python3
import json
import urllib.request
import sys
try:
with urllib.request.urlopen("https://api.github.com/search/issues?q=sha:" + sys.argv[1]) as resp:
data = json.loads(resp.read().decode())
prs = [{'number': pr['number'], 'url': pr['html_url']} for pr in data["items"]]
@cbosdo
cbosdo / gitk
Last active January 5, 2021 08:46
.config/git/gitk for monokai-like theme
set mainfont {sans 9}
set textfont {monospace 9}
set uifont {sans 9 bold}
set tabstop 8
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set autoselect 1
@cbosdo
cbosdo / get-salt-prs.py
Last active November 4, 2019 19:50
Get the list of my Salt PRs and the associated openSUSE/salt PRs
#!/usr/bin/python3
from github import Github
from odf.opendocument import OpenDocumentSpreadsheet
import odf.table
import odf.text
import re
from typing import Dict, List
import datetime
import sys
@cbosdo
cbosdo / rtt.py
Created August 23, 2019 07:57
Computes the number of RTT (company dependent of course) for a given year
#!/usr/bin/python3
import datetime
import sys
def get_easter(year):
"""Returns Easter as a date object."""
a = year % 19
b = year // 100
c = year % 100
d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30