Skip to content

Instantly share code, notes, and snippets.

View ezr-ondrej's full-sized avatar

Ondřej Ezr ezr-ondrej

View GitHub Profile
@ezr-ondrej
ezr-ondrej / pageQueries.js.diff
Last active February 27, 2024 09:59
rtk pagination
diff --git a/src/Components/Blueprints/BlueprintsSideBar.tsx b/src/Components/Blueprints/BlueprintsSideBar.tsx
index 1992cd8..e607b0a 100644
--- a/src/Components/Blueprints/BlueprintsSideBar.tsx
+++ b/src/Components/Blueprints/BlueprintsSideBar.tsx
@@ -71,15 +71,25 @@ const BlueprintsSidebar = ({
}, [debouncedSearch]);
const [pageBlueprint, setPageBlueprint] = useState(1);
const perPageBlueprint = 4;
- const {
- data: blueprintsData,
@ezr-ondrej
ezr-ondrej / lighthouse_RH_dev.json
Last active February 9, 2023 08:08
AzureLighthouse-oezrPrivate
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mspOfferName": {
"type": "string",
"metadata": {
"description": "Specify a unique name for your offer"
},
"defaultValue": "Provisioning CRC"
@ezr-ondrej
ezr-ondrej / input-rake-task.sh
Last active April 28, 2022 13:59
Auditable attributes
foreman-rake audits:list_attributes
@ezr-ondrej
ezr-ondrej / audited_attributes.adoc
Last active April 8, 2022 07:31
Satellite Audited attributes (6.11 snap 5)

Host Managed

Attribute Description

Name

Host FQDN, e.g. my-host.example.com

Root pass

Returns host’s encrypted password hash

Architecture

Returns architecture assigned to the host or nil if no architecture is assigned (unmanaged host)

Operatingsystem

alias of os property

Ptable

Returns a partition table object assigned to the host, returns nil if none is found

Medium

Returns installation medium associated with the host

@ezr-ondrej
ezr-ondrej / load_facts.rb
Created May 3, 2021 14:17
load foreman facts
require 'json' #probably not necessary
file_json = JSON.parse('test/static_fixtures/facts/facts.json')
host = Host.find(host_id)
HostFactImporter.new(host).import_facts(file_json['facts'])
# test/benchmark/audit_taxed_benchmark.rb
# Run by: bundle exec ruby -I"test" test/benchmark/audit_taxed_benchmark.rb
require 'test_helper'
class AuditTaxedTest < ActiveSupport::TestCase
setup do
org = FactoryBot.create(:organization)
2.times do |k|
loc = FactoryBot.create(:location)
50.times do
@ezr-ondrej
ezr-ondrej / package-lock.json
Last active April 22, 2020 11:08
Package lock compare
This file has been truncated, but you can view the full file.
{
"name": "TheForemanDevDeps",
"version": "2.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
<tr>
<td>
<%= f.text_field(:name, ... %>
</td>
<td>
<%= f.text_field(:value, ... %>
</td>
<td>
<%= link_to_remove_fields(_('Remove'), f) if f.object.new_record? %>
</td>
@ezr-ondrej
ezr-ondrej / sidekiq_dynflow.rb
Created September 27, 2019 08:31
Dynflow by sidekiq start
rails_root = Dir.pwd
app_file = File.expand_path('./config/application', rails_root)
require app_file
rails_env_file = File.expand_path('./config/environment.rb', rails_root)
require rails_env_file
# require 'dynflow/executors/sidekiq/core'
role = nil
@ezr-ondrej
ezr-ondrej / get_condition.rb
Last active August 20, 2019 00:30
Parameters search
groups = ActiveRecord::Base.connection.select_all(GROUP_PARAMS_QUERY)
# this array is pretty huge - <number of hosts having the parameter matching name> * <type of parameters meeting the criteria>
parameters = ActiveRecord::Base.connection.select_all(PARAMS_QUERY)
matching_host_ids = []
parameters.group_by(&:first).each do |host_id, params|
valid = params.first
hostgroup_path = valid[<ancestry_position>] && valid[<ancestry_position>].split('/')
# select first matching group
grp_param = hostgroup_path && groups.detect{|group| hostgroup_path.include?(group[<id_position>].to_s)}