Skip to content

Instantly share code, notes, and snippets.

View sjha4's full-sized avatar

Samir Jha sjha4

View GitHub Profile

🧠 Setting up GitHub MCP Server for Claude

This guide walks through how to connect Claude to GitHub via an MCP (Model Context Protocol) server, enabling Claude to review PRs, comment on issues, and assist with testing workflows.


🔧 Prerequisites

@sjha4
sjha4 / convert-to-image-mode
Created May 1, 2025 14:04
Convert package-mode centos10 to image-mode
podman run --rm -it --privileged --pull=newer --security-opt label=type:unconfined_t -v /var/lib/containers/storage:/var/lib/containers/storage -v /:/target -v /root/.ssh/authorized_keys:/bootc_authorized_ssh_keys/root --pid=host quay.io/centos-bootc/centos-bootc:stream10 bootc install to-existing-root --root-ssh-authorized-keys /bootc_authorized_ssh_keys/root
@sjha4
sjha4 / SmartProxyContentTest.js
Created January 7, 2025 20:19
SmartProxyContentTest fix
diff --git a/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js b/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js
index 234fc35a71..501bf6df4f 100644
--- a/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js
+++ b/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { renderWithRedux, patientlyWaitFor, within } from 'react-testing-lib-wrapper';
+import { renderWithRedux, patientlyWaitFor, fireEvent, within, act } from 'react-testing-lib-wrapper';
import { nockInstance, assertNockRequest } from '../../../test-utils/nockWrapper';
@sjha4
sjha4 / Trip
Created December 12, 2024 05:23
21st : Williamsburg Checkin
22nd: Willaimsbug checkout -> DC checkin
23,24: DC
25th : Checkout DC, checkin - Philadelphia
27th Checkout Philadelphia - Checkin NY
28
29
30
31
1st-checkout -> Raleigh
@sjha4
sjha4 / flatpak-hammer.sh
Last active December 7, 2024 13:26
flatpak-hammer.sh
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
TEST_ORG="test_org"
PRODUCT="prod"
FLATPAK_REMOTE_NAME="Redhat"
FLATPAK_REMOTE_URL="https://flatpaks.redhat.io/rhel"
FLATPAK_REMOTE_USERNAME="5894300|sajha"
Aug 16 17:10:00 centos8-proxy-devel2.sajha.example.com pulpcore-api[4399]: pulp [4b763587-8712-4679-90de-f6e099d11c3d]: - - [16/Aug/2023:17:10:00 +0000] "GET /pulp/api/v3/status/ HTTP/1.1" 200 1905 "-" "rest-client/2.1.0 (linux x86_64) ruby/2.7.6p219"
Aug 16 17:10:00 centos8-proxy-devel2.sajha.example.com pulpcore-api[4461]: pulp [4b763587-8712-4679-90de-f6e099d11c3d]: - - [16/Aug/2023:17:10:00 +0000] "GET /pulp/api/v3/contentguards/certguard/rhsm/?name=RHSMCertGuard HTTP/1.1" 200 2854 "-" "OpenAPI-Generator/1.6.5/ruby"
Aug 16 17:10:00 centos8-proxy-devel2.sajha.example.com pulpcore-api[4461]: pulp [4b763587-8712-4679-90de-f6e099d11c3d]: - - [16/Aug/2023:17:10:00 +0000] "PATCH /pulp/api/v3/contentguards/certguard/rhsm/babef2c3-304a-47c2-beec-0f184db1eb49/ HTTP/1.1" 200 2802 "-" "OpenAPI-Generator/1.6.5/ruby"
Aug 16 17:10:00 centos8-proxy-devel2.sajha.example.com pulpcore-api[4488]: pulp [4b763587-8712-4679-90de-f6e099d11c3d]: - - [16/Aug/2023:17:10:00 +0000] "GET /pulp/api/v3/repositories/ansible/ansible/
@sjha4
sjha4 / mosquitto.conf
Last active June 5, 2023 16:07
/etc/mosquitto/mosquitto.conf
# Config file for mosquitto
#
# See mosquitto.conf(5) for more information.
#
# Default values are shown, uncomment to change.
#
# Use the # character to indicate a comment, but only if it is the
# very first character on the line.
# =================================================================
@sjha4
sjha4 / override_default_audits.rb
Created March 22, 2023 02:47
Override Default Audits in your model
class MyModel < ApplicationRecord
# Custom audit function to create audit records
def create_audit_record(action)
Audit.create!(
auditable_id: self.id,
auditable_type: self.class.name,
action: action,
user_id: current_user.id # replace with your authentication method
)
end
@sjha4
sjha4 / clean_installed_packages.rb
Created March 21, 2023 15:42
Clean up duplicate Installed packages
x = ::Katello::InstalledPackage.group(:nvra).having("count(nvra) > 1").pluck(:nvra)
y = {}
x.each do |multi_nvra|
multi_nvra_in_packages = ::Katello::InstalledPackage.where(nvra: multi_nvra)
multi_nvra_in_packages_count = multi_nvra_in_packages.count
multi_nvra_in_packages_nvrea_count = multi_nvra_in_packages.pluck(:nvrea).uniq.count
if(multi_nvra_in_packages_count != multi_nvra_in_packages_nvrea_count)
multi_nvra_in_packages.each do |package|
if y[package.nvrea]
y[package.nvrea] << package.id
a = Katello::ErratumPackage.select(:erratum_id, :nvrea, :name, :filename).group(:erratum_id, :nvrea, :name, :filename).having("count(*) > ?",
1)
a.each do |x|
irb(main):003:1* puts Katello::ErratumPackage.where(erratum_id: x.erratum_id, nvrea: x.nvrea, name: x.name, filename: x.filename).count
irb(main):004:0> end
a.each do |x|
irb(main):006:1* Katello::ErratumPackage.where(erratum_id: x.erratum_id, nvrea: x.nvrea, name: x.name, filename: x.filename).first.delete
irb(main):007:0> end