Skip to content

Instantly share code, notes, and snippets.

View grafuls's full-sized avatar
🐍
Hissing

Gonzalo Rafuls grafuls

🐍
Hissing
  • Red Hat, Inc
  • Czech Republic
View GitHub Profile
@grafuls
grafuls / rebuild
Created July 22, 2022 12:43
rebuild script for badfish rpm package
sudo dnf remove -y python3-badfish
rm -rf /home/grafuls/rpmbuild/RPMS/noarch/python3-badfish-1.0.2*
make clean && make srpm
rpmbuild --rebuild $(ls /home/grafuls/Sources/badfish-mine/rpm/python3-badfish-1.0.2-git*)
sudo dnf -y install $(ls /home/grafuls/rpmbuild/RPMS/noarch/python3-badfish-1.0.2-git*)
import zlib
import struct
PNG_SIGNATURE = b"\x89PNG\r\n\x1a\n"
class Png:
def __init__(self, file):
self.file = file
@grafuls
grafuls / quads_report.py
Created October 27, 2021 09:40
Quads product breakdown
#! /usr/bin/env python
import asyncio
from datetime import date, datetime
from quads.config import conf
from quads.model import Cloud, CloudHistory, Schedule
from quads.tools.jira import Jira
async def main(loop):
@grafuls
grafuls / watchers.py
Last active April 14, 2021 13:35
watchers
#! /usr/bin/env python
import asyncio
from datetime import date, datetime, timedelta
from quads.config import conf
from quads.model import Cloud, CloudHistory, Schedule
from quads.tools.jira import Jira
async def main(loop):
jira = Jira(
@grafuls
grafuls / sahil.py
Last active March 19, 2021 18:12
shail data collect
#! /usr/bin/env python
import asyncio
from datetime import date, datetime
from quads.config import conf
from quads.model import Cloud, CloudHistory, Schedule
from quads.tools.jira import Jira
async def main():
@grafuls
grafuls / snmp.py
Last active February 5, 2021 14:29
python snmp getter with parser for mac address and ip
#! /usr/bin/env python
from pysnmp import hlapi
from pysnmp.smi import builder
from pyasn1.type.univ import OctetString
from pysnmp.proto.rfc1902 import OctetString, IpAddress
def get(target, oids, credentials, port, engine, context):
udp_target = hlapi.UdpTransportTarget((target, port))
object_types = construct_object_types(oids)
handler = hlapi.getCmd(engine, credentials, udp_target, context, *object_types)
@grafuls
grafuls / install
Last active December 4, 2020 13:46
Fedora setup
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y install https://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release.fc$(rpm -E %fedora).noarch.rpm
sudo dnf -y install dnf-utils hexchat git git-extras git-review tig make cmake gimp flatpak kernel-devel google-chrome-stable tlp tlp-rdw htop vlc gpaste gnome-shell-extension-gpaste dnf-plugin-system-upgrade zlib.i686 ncurses-libs.i686 bzip2-libs.i686 icedtea-web screen exfat-utils fuse-exfat rpmdevtools gparted krb5-workstation albert powerline powerline-fonts fedora-workstation-repositories sshuttle podman VirtualBox tmate python3-black pulseaudio-libs-devel ca-certificates python3-devel
sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin
sudo dnf groupupdate sound-and-video
sudo yum-config-manager --add-repo
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import shutil
import ansible.constants as C
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.module_utils.common.collections import ImmutableDict
from ansible.inventory.manager import InventoryManager
from ansible.parsing.dataloader import DataLoader
@grafuls
grafuls / readme.md
Last active September 23, 2020 12:20 — forked from benstr/readme.md
Boot order overrides for director type
Keys defined on interfaces yaml FQDN Use boot order
director_r620_interfaces mgmt-f21-h17-000-r620.domain.com NO
director_f21_r620_interfaces mgmt-f21-h17-000-r620.domain.com NO
director_f21_h17_r620_interfaces mgmt-f21-h17-000-r620.domain.com YES
Keys defined on interfaces yaml FQDN Use boot order
director_r620_interfaces mgmt-f21-h18-000-r620.domain.com NO
director_f21_r620_interfaces mgmt-f21-h18-000-r620.domain.com YES
from pathlib import Path
import textract
import numpy as np
import re
def main(_file):
text = textract.process(_file, method="pdfminer")
with open("%s.csv" % Path(_file).name[: -len(Path(_file).suffix)], "w+") as _file: