Skip to content

Instantly share code, notes, and snippets.

1. # create new .py file with code found below
2. # install ollama
3. # install model you want “ollama run mistral”
4. conda create -n autogen python=3.11
5. conda activate autogen
6. which python
7. python -m pip install pyautogen
7. ollama run mistral
8. ollama run codellama
9. # open new terminal
@mccun934
mccun934 / scaling.md
Created October 30, 2020 14:36 — forked from adamruzicka/scaling.md
Dynflow workers scaling

Intro

Out of the box, foreman ships with orchestrator and a single worker If you have Katello, you will get an additional worker for processing of the host queue

root@modest-gator:~# ls -l /etc/foreman/dynflow/
total 1
-rw-r--r--. 1 root foreman 51 May 14 07:35 orchestrator.yml
-rw-r--r--. 1 root foreman 59 May 14 07:35 worker.yml
#!/bin/bash
echo "Importing Subscription Pools from Candlepin."
echo '
namespace :katello do
task :import_subscriptions => ["environment"] do
User.current = User.anonymous_api_admin
puts _("Importing Subscriptions")
Katello::Subscription.import_all
@mccun934
mccun934 / deleted_puppet_envs65-later.md
Last active February 1, 2023 19:35 — forked from jlsherrill/deleted_puppet_envs.md
recover from deleted puppet environments from 6.5 or later

when publishing a content view if you get:

Validation failed: Puppet environment can't be blank

or

ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
namespace :taskbench do
desc <<~END_DESC
Loads up some tasks
END_DESC
def parallelize(param_lists)
max_number_of_forks ||= ENV['forks'].to_i || 10
page = 0
page_size = param_lists.length/max_number_of_forks
@mccun934
mccun934 / mongodb_collection_sizes.js
Last active August 13, 2018 17:50 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
# EG : ALTER USER Postgres WITH PASSWORD '<newpassword>';
CP_PASS=`grep jpa.config.hibernate.connection.password /etc/candlepin/candlepin.conf | awk -F= '{print $2}'`
F_PASS=`grep password /etc/foreman/database.yml | awk -F: '{print $2}' | sed 's/"//g'`
echo "ALTER USER candlepin WITH PASSWORD '$CP_PASS';" | sudo -u postgres psql
echo "ALTER USER foreman WITH PASSWORD '$F_PASS';" | sudo -u postgres psql
@mccun934
mccun934 / sat-62-certs-regenerate.sh
Last active February 28, 2018 20:15
6.2 Certs Reset Regenerate
rm -rfv /etc/pki/katello{,.bak}
rm -rfv /etc/pki/katello-certs-tools{,.bak}
rm -rfv /etc/candlepin/certs/amqp{,.bak}
rm -rfv /etc/foreman-proxy/*ssl*
rm -rfv /etc/foreman/old-certs
rm -rfv /etc/foreman/*.pem
rm -rfv /var/lib/puppet/ssl
rm -rfv /root/ssl-build
satellite-installer --scenario satellite -v --certs-regenerate-ca=true --certs-regenerate=true
@mccun934
mccun934 / gencerts.sh
Created November 14, 2017 20:10 — forked from JacobCallahan/gencerts.sh
Satellite certificate generator script
#! /bin/bash
git clone https://github.com/iNecas/ownca.git
cd ownca
yes "" | ./generate-ca.sh
yes | ./generate-crt.sh $(hostname)
certdir="$(pwd)/$(hostname)/"
cp cacert.crt $(hostname)/
cd $(hostname)
katello-certs-check -c "$(hostname).crt" -k "$(hostname).key" -r "$(hostname).crt.req" -b cacert.crt
@mccun934
mccun934 / debugging_errata.md
Created November 8, 2017 14:38 — forked from jlsherrill/debugging_errata.md
debugging errata issues

Run all of these in 'foreman-rake console'

Check the event queue:

Katello::Event.count

Check 'bound repositories' known to katello