Skip to content

Instantly share code, notes, and snippets.

View vfreex's full-sized avatar

Yuxiang Zhu vfreex

View GitHub Profile
@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")
@vfreex
vfreex / Cargo.toml
Last active July 11, 2019 14:56
Demo TeamTalk client implementation in Rust
[package]
name = "ttr-communicator"
version = "0.1.0"
authors = ["Yuxiang Zhu <yuxzhu@redhat.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "ttrcomm"
@vfreex
vfreex / Jenkinsfile
Created February 12, 2019 09:57
Jenkins jobs to receive and send a VirtualTopic.eng.repotracker.container.tag.updated CI message
node('master') {
// Wait for message and store message content in variable
def msgContent = waitForCIMessage \
providerName: 'Red Hat UMB (test)', \
overrides: [topic: 'VirtualTopic.eng.repotracker.container.tag.updated'], \
selector: "repo='quay.io/factory2/waiverdb'"
echo "msgContent = " + msgContent
}
@vfreex
vfreex / demo-pipeline.yaml
Created January 25, 2019 21:01
demo-pipeline
kind: "BuildConfig"
apiVersion: "v1"
metadata:
name: "demo-pipeline"
spec:
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
pipeline {
agent {
@vfreex
vfreex / scan_isp_blocklist.sh
Created November 20, 2018 09:58
Test which TCP ports are blocked by my ISP
#!/bin/bash
for port in {1..9999}; do
echo -n "TCP $port: "
result=$(nc "$1" "$port" -w 1 2>&1 < /dev/null)
if [ "$?" -eq 0 ]; then
echo "Open"
continue
fi
if [[ "$result" == *refused* ]]; then
@vfreex
vfreex / hotels
Last active January 12, 2018 08:47
package main
import (
"fmt"
"sort"
)
type Rating struct {
score int
count int
apiVersion: apps/v1beta2
#apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nginx
spec:
selector:
matchLabels:
name: nginx
template:
@vfreex
vfreex / list.h
Created December 13, 2016 08:09 — forked from evanslai/list.h
Linux kernel linked list, modified for userspace
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#include <stdio.h>
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.