Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
@jlsherrill
jlsherrill / fixtures.json
Created November 27, 2023 15:02
fixtures.json
{
"rpm-advisory-diff-repo":"https://fixtures.pulpproject.org/rpm-advisory-diff-repo/",
"rpm-advisory-diffpkgs":"https://fixtures.pulpproject.org/rpm-advisory-diffpkgs/",
"rpm-advisory-incomplete-package-list":"https://fixtures.pulpproject.org/rpm-advisory-incomplete-package-list/",
"rpm-advisory-no-update-date":"https://fixtures.pulpproject.org/rpm-advisory-no-update-date/",
"rpm-alt-layout":"https://fixtures.pulpproject.org/rpm-alt-layout/",
"rpm-complex-pkg":"https://fixtures.pulpproject.org/rpm-complex-pkg/",
"rpm-distribution-tree":"https://fixtures.pulpproject.org/rpm-distribution-tree/",
"rpm-distribution-tree-changed-addon":"https://fixtures.pulpproject.org/rpm-distribution-tree-changed-addon/",
"rpm-distribution-tree-changed-main":"https://fixtures.pulpproject.org/rpm-distribution-tree-changed-main/",
@jlsherrill
jlsherrill / header_org_admin.sh
Created August 29, 2023 12:24
org_admin header script
#!/bin/bash
ORG_ID="$1"
USER_NAME="$2"
ACCOUNT_ID="$3"
function print_out_usage {
cat <<EOF
Usage: ./scripts/header.sh <org_id> [user_name]
@jlsherrill
jlsherrill / main.go
Created August 28, 2023 13:31
testing for tasks
package main
import (
"encoding/json"
"time"
"github.com/content-services/content-sources-backend/pkg/api"
"github.com/content-services/content-sources-backend/pkg/config"
"github.com/content-services/content-sources-backend/pkg/dao"
"github.com/content-services/content-sources-backend/pkg/db"
@jlsherrill
jlsherrill / main.go
Created July 20, 2023 17:49
go file to hammer a content-sources with requests
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"sync"
"github.com/content-services/content-sources-backend/pkg/config"
@jlsherrill
jlsherrill / openapi-debug.md
Created February 13, 2023 14:04
openapi generator debug
mvn clean package --projects org.openapitools:openapi-generator-cli,org.openapitools:openapi-generator
# run it in debug mode on port 8888
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8888 -jar  modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i api.json.1 -g ruby         -o pulpcore-client         --additional-properties=gemName=pulpcore_client,gemLicense="GPL-2.0+",gemVersion=3.17.1         --library=faraday              --skip-validate-spec         --strict-spec=false
{
"openapi": "3.0.2",
"info": {
"title": "SimpleTest",
"version": "1.0.0",
"description": ""
},
"paths": {
"/testresponses": {
"summary": "Path used to manage the list of testresponses.",
@jlsherrill
jlsherrill / file_repogen.rb
Last active August 31, 2022 18:13
Generate pulp file repos
#!/usr/bin/env ruby
def collect_files(files)
lines = []
files.collect do |file|
if File.lstat(file).symlink? && File.directory?(file)
sub_files = collect_files(Dir.glob("#{file}/**/*"))
lines.concat(sub_files)
next
elsif File.directory?(file)
@jlsherrill
jlsherrill / upload_file.txt
Last active May 14, 2022 03:10
Use api to upload a file
So this is a tad complicated due to a couple reasons:
a) we want to support uploading very large files
b) http makes it a bit difficult to transfer binary data
The ui uses a 'simpler' method to upload files, but that is partially why it is capped out at ~30MB files.
Simple method:
Katello::ContentView.non_default.each do |cv|
Katello::Repository.in_default_view.each do |library_instance|
cv.versions.with_library_repo(library_instance).each do |version|
if version.archived_repos.find_by(:library_instance_id => library_instance.id).nil?
found = version.repositories.find_by(:library_instance_id => library_instance.id)
puts "#{cv.name} #{version.version}: #{library_instance.name} : env repo: #{found.id} in #{found.environment&.name}"
end
end
end
end ; nil
$ cat ~/bin/rails-start
#!/usr/bin/bash
cd ~/git/foreman
rm log/development.log
export DISABLE_SPRING=1
export NOTIFICATIONS_POLLING=999999
be puma -b 'tcp://0.0.0.0' -p 3000 #-w 1
#rails s -b '0.0.0.0'