This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv-python3) [paji-redhat.com@bastion ansible]$ cat configs/satellite-vm/dump.xml | |
hosts: all | |
gather_facts: yes | |
tasks: | |
- name: Dump all variables | |
action: template src=dumpall.j2 dest=/tmp/ansible_dump.all | |
(venv-python3) [paji-redhat.com@bastion ansible]$ cat configs/satellite-vm/dumpall.j2 | |
Module Variables ("vars"): | |
-------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select(repos, ignorables) | |
repos.select do |repo| | |
ignorables.none? {|ignorable| repo["path"].include?(ignorable)} | |
end | |
end | |
def min_max(rpms) | |
rpm_max = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPOSITORY_ID=23 | |
CONTENT_VIEW_FILTER_ID=4 | |
CONTENT_VIEW_ID=11 | |
for i in $(hammer --no-headers module-stream list --repository-id=$REPOSITORY_ID --fields=id) | |
do | |
for module in $(hammer --csv --no-headers content-view filter rule list --content-view-filter-id=$CONTENT_VIEW_FILTER_ID --fields='Rule ID') | |
do | |
hammer content-view filter rule delete --id=$module --content-view-filter-id=$CONTENT_VIEW_FILTER_ID | |
done | |
hammer content-view filter rule create --module-stream-ids=$i --content-view-filter-id=$CONTENT_VIEW_FILTER_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pushd . | |
FILES=$(find test -type f -path "*$1*"|tr '\n' ' ') | |
echo $FILES | |
bundle exec ruby -Itest $FILES | |
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple problems to solve using the native .reduce and .map array methods. Each of these problems can be solved in many | |
// different ways, but try to solve them using the requested higher order function. | |
// MAP | |
// Write a function capitalize that takes a string and uses .map to return the same string in all caps. | |
// ex. capitalize('whoop') // => 'WHOOP' | |
// ex. capitalize('oh hey gurl') // => "OH HEY GURL" | |
var capitalize = function(string){ | |
// code code code! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv, os.path, sys | |
csv.field_size_limit(sys.maxsize) | |
class DictReaderStrip(csv.DictReader): | |
@property | |
def fieldnames(self): | |
if self._fieldnames is None: | |
# Initialize self._fieldnames | |
# Note: DictReader is an old-style class, so can't use super() | |
csv.DictReader.fieldnames.fget(self) | |
if self._fieldnames is not None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task = ::ForemanTasks::Task.find_by_external_id('480aaeec-23ca-4dcb-8684-34d924bda0e5') | |
tasks = ForemanTasks::Task.where(:label => "Actions::Katello::CapsuleContent::Sync") | |
tasks.each do |task| | |
execplan = task.execution_plan | |
plan_values=execplan.steps.values | |
runsteps = {|plan| plan.class == Dynflow::ExecutionPlan::Steps::PlanStep} | |
plansteps = {|plan| plan.class == Dynflow::ExecutionPlan::Steps::RunStep} | |
started_at =plansteps.map(&:started_at).min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JS | |
1) let vs const | |
2) closure | |
3) classes, prototype, inheritance | |
4) promises | |
5) fetch api | |
6) async await | |
7) Arrow functions | |
8) es6 Modules | |
9) Template string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(let i = 0; i< 3;i++) { | |
//Log i after a second | |
setTimeout(function() { | |
console.log(i); | |
}, 1000); | |
} | |
console.log("Numbers Coming") | |
output: |