Skip to content

Instantly share code, notes, and snippets.

@parthaa
parthaa / export.sh
Created October 19, 2020 19:54
export script
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
EXPORT_ORG="export-$RANDOM"
PRODUCT="prod"
REPO1="katello"
REPO1_URL="https://fedorapeople.org/groups/katello/releases/yum/3.8/katello/el7/x86_64/"
REPO2="misc"
REPO2_URL="https://partha.fedorapeople.org/test-repos/pteradactly-with-dino-errata/"
@parthaa
parthaa / import.sh
Created October 19, 2020 19:53
import script
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
IMPORT_ORG="import-$RANDOM"
PRODUCT="prod"
REPO1="katello"
REPO2="misc"
CONTENT_VIEW="view"
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object

in config/settings.yaml :webpack_dev_server: true

In one tab:

rails s -b '0.0.0.0'

In a 2nd tab:

@simonw
simonw / how-to-upgrade-heroku-postgresql.md
Last active April 29, 2024 05:07
How to upgrade a Heroku PostgreSQL database to a new plan

How to upgrade a Heroku PostgreSQL database to a new plan

I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).

After assigning the new database, I had two databases attached to the application. They looked something like this:

  • HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database
@johnpmitsch
johnpmitsch / development.rb
Created March 20, 2018 16:20
foreman/katello record external HTTP calls logging
# add http_logger to local gems https://github.com/railsware/http_logger
# then add the following to foreman/config/development.rb
outbound_calls = Logger.new("#{Rails.root}/log/outbound.log")
HttpLogger.logger = outbound_calls
# HttpLogger.ignore = ["example\.com"] (this doesn't work for some reason)
HttpLogger.log_request_body = false # Default: true
HttpLogger.log_response_body = false # Default: true
# You can get the outbound calls by running something like this (in foreman dir)
# tail -f log/outbound.log | grep -v "Response status" | grep -v "myhostname"
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@johnpmitsch
johnpmitsch / snap.sh
Created September 1, 2017 19:03
vagrant snapshot bash functions
# add the following to your .bashrc
# and run `source ~/.bashrc`
function virsh-snapshot-create {
cd ~/forklift
vagrant halt $1
sudo virsh snapshot-create-as forklift_$1 $2
vagrant up $1
}
@johnpmitsch
johnpmitsch / virt-who.md
Last active November 16, 2018 20:59
virt-who installation for katello (to get hypervisor guests)

On hypervisor (probably your workstation)

  1. yum install virt-who

  2. Edit /etc/virt-who.d/test.conf and update the rhsm_hostname, rhsm_username, rhsm_password (use dev server credentials)

[libvirt]
type=libvirt
server=qemu:///system
owner=Default_Organization
env=Library
@johnpmitsch
johnpmitsch / csv.md
Last active August 4, 2017 15:49
hammer csv host seed
Name,Count,Organization,Environment,Content View,Host Collections,Virtual,Guest of Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions
fake%d,1000,Default Organization,Library,Default Organization View,"",Yes,,RHEL 6.4,x86_64,1,4 GB,1,"",69|Red Hat Enterprise Linux Server,""
host0,1,Default Organization,Library,Default Organization View,"",No,,RHEL 6.4,x86_64,1,4 GB,1,"","69|Red Hat Enterprise Linux Server,83|Red Hat Enterprise Linux High Availability (for RHEL Server)",

hammer csv content-hosts -v --file /tmp/hosts.csv

attach subs