Skip to content

Instantly share code, notes, and snippets.

@vfreex
vfreex / redis_lock_with_auto_extend.py
Created September 13, 2023 11:44
redis_lock_with_auto_extend.py
import asyncio
import os
import redis.asyncio as redis
from redis.asyncio.lock import Lock
from redis.asyncio.retry import Retry
from redis.backoff import ExponentialBackoff
async def long_running_task():
# install dependencies with `pip install requests requests-gssapi`
import requests
from requests_gssapi import HTTPSPNEGOAuth
def main():
non_paginated_url = "https://errata.devel.redhat.com/api/v1/cve_package_exclusion?filter[errata_id]=103179&page[size]=600&page[number]=1"
resp = requests.get(non_paginated_url, auth=HTTPSPNEGOAuth(), verify=False)
resp.raise_for_status()
non_paginated_result = resp.json()
@vfreex
vfreex / fetch-artifacts-url.yaml
Last active May 6, 2022 08:56
Test fetch-artifacts-url.yaml
- sha256: e84fb1481f603a0512be9bd2e1c181433fe17dfff5942769b4aed417c6502f62
url: http://download.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/plashets/4.11/art3171/4.11-202203121512.p%3f-embargoed/plashet.yml
target: test-plashet.yml
@vfreex
vfreex / README.md
Last active July 31, 2021 02:56
Disable multicast snooping on ASUS router
  1. Add a script /jffs/my-startup.sh:
#!/bin/sh
# Copyright (C) 2021 Yuxiang Zhu <[email protected]>

# Disable multicast snooping on br0
cru a br0-no-mcast-snooping "* * * * * /bin/sh -c '/bin/echo 0 > /sys/devices/virtual/net/br0/bridge/multicast_snooping'"
import asyncio
from os import wait
import re
from io import StringIO
import sys
from typing import Dict, List, Optional, TextIO
import aiohttp
import koji
from datetime import datetime, timedelta
@vfreex
vfreex / attach-security-bugs.sh
Created April 27, 2020 07:05
attach-security-bugs.sh
#!/bin/bash
TRACKER=$1
if [ -z "$TRACKER" ]; then
echo "Usage: $0 TRACKER_BUG_ID"
exit 1
fi
echo "Finding flaw bugs for tracker $TRACKER..."
@vfreex
vfreex / nftables.conf
Created April 2, 2020 17:16
netfilter flow offload example
table inet flowoffload {
flowtable f {
hook ingress priority 0
devices = { eno1, eno2, ens1f0, ens1f1, virbr0, virbr-cube-kvm }
}
chain flowoffload {
type filter hook forward priority 0; policy accept;
ip protocol { tcp, udp } flow offload @f
ip6 nexthdr { tcp, udp } flow offload @f
@vfreex
vfreex / ixgbe_phy.c
Last active December 21, 2023 15:17
ixgbe driver hack for 3rd-party SFP+ transceivers compatibility
// If both allow_unsupported_sfp=1 option and https://forums.servethehome.com/index.php?threads/patching-intel-x520-eeprom-to-unlock-all-sfp-transceivers.24634/ are not working,
// your SFP+ transceivers may be too old to support Transceiver Compliance Codes in EEPROM.
// Inspired from https://mails.dpdk.org/archives/dev/2019-May/131512.html.
// Looking for the following content in src/ixgbe_phy.c:
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_10GBE_COMP_CODES,
&comp_codes_10g);
if (status != IXGBE_SUCCESS)
goto err_read_i2c_eeprom;
@vfreex
vfreex / rpmdiff-waiver.go
Last active February 3, 2020 11:26
One-off hack program for waiving rpmdiff failures with last waiving reasons. Edit constants before using it.
package main
import (
"bytes"
"encoding/json"
"fmt"
"gopkg.in/jcmturner/gokrb5.v7/client"
"gopkg.in/jcmturner/gokrb5.v7/config"
"gopkg.in/jcmturner/gokrb5.v7/spnego"
"io/ioutil"
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions as EX
if __name__ == '__main__':
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=./my-profile")