Skip to content

Instantly share code, notes, and snippets.

💻
Codin'

Jason Frey Fryguy

💻
Codin'
Block or report user

Report or block Fryguy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Fryguy
Fryguy / _instructions.md
Last active Jul 13, 2018
Rails + Threads + constantize
View _instructions.md
  1. Create a vanilla Rails

    rails _5.0.7_ new vanilla_test --skip-yarn --skip-active-storage --skip-action --skip-sprockets --skip-spring --skip-listen --skip-coffee --skip-javascript --skip-turbolinks --skip-test --skip-system-test --skip-bootsnap
    
  2. Copy the files into the right spots

  3. Run it

View aws_instance_types_yml_diff.diff
diff --git a/db/fixtures/aws_instance_types.yml b/db/fixtures/aws_instance_types.yml
index 09f8671..60871af 100644
--- a/db/fixtures/aws_instance_types.yml
+++ b/db/fixtures/aws_instance_types.yml
@@ -1,13 +1,18 @@
---
c1.medium:
+ :current_generation: false
+ :current_version: true
:name: c1.medium
@Fryguy
Fryguy / miq_hash_struct_perf.rb
Created Jun 21, 2018
MiqHashStruct vs OpenStruct
View miq_hash_struct_perf.rb
require 'benchmark/ips'
require 'manageiq-gems-pending'
require 'miq-hash_struct'
require 'ostruct'
large_hash = (0..1000).each_with_object({}) { |i, h| h["a#{i}"] = i }
small_hash = (0..4).each_with_object({}) { |i, h| h["a#{i}"] = i }
Benchmark.ips do |x|
View keybase.md

Keybase proof

I hereby claim:

  • I am Fryguy on github.
  • I am fryguy (https://keybase.io/fryguy) on keybase.
  • I have a public key whose fingerprint is DB0E 094B 3281 4567 8E97 6DB7 A9EB 1249 7632 AA7B

To claim this, I am signing this object:

View audit_licenses.rb
require 'licensee'
require 'active_support/core_ext/object/try'
licenses = `bundle list --paths`.split.collect do |gem_path|
[File.basename(gem_path), Licensee.license(gem_path).try(:key)]
end
require 'more_core_extensions/core_ext/array/tableize'
puts licenses.unshift(["gem", "license"]).tableize
@Fryguy
Fryguy / serialized_4_2.yml
Last active May 25, 2016
ems_cluster_serialized
View serialized_4_2.yml
--- !ruby/object:EmsCluster
raw_attributes:
id: '1000000000001'
name: Test Cluster
ems_id: '1000000000001'
created_on: '2016-05-25 15:33:59.972368'
updated_on: '2016-05-25 15:33:59.972368'
uid_ems: domain-c10309
ha_enabled: f
ha_admit_control: t
View gemfile_locks
#!/bin/bash
# Ignore file-only checkouts
[[ $3 -ne 1 ]] && exit 0
git_root=$(git rev-parse --show-toplevel)
root=$git_root
[[ -d "$root/vmdb" ]] && root="$root/vmdb"
gemfile_lock="$root/Gemfile.lock"
@Fryguy
Fryguy / cloud_networking.dot
Last active Feb 17, 2016
Networking rearchitecture
View cloud_networking.dot
digraph CloudNetworking {
graph [ fontname="Helvetica-Bold" ]
node [ id="\N" shape="Mrecord" style="filled" fontname="Helvetica" fillcolor="#ffffff" penwidth="2" ]
edge [ arrowsize="0.5" fontname="Helvetica" ]
label = "Cloud Networking"
style = "rounded"
openstack_provider [label="OpenstackProvider"]
@Fryguy
Fryguy / database.yml
Last active Apr 22, 2016
database.yml for multiple MIQ databases
View database.yml
# PostgreSQL
#
# Development version of the standard database.yml that handles switching
# between different version branches. For example, on trunk it will look for a
# database named vmdb_development, but on the 3.3.2.12 branch it will look for
# a database named vmdb_development_3_3_2.
#
# <% unless $db_yml_loaded %>
# <% $db_yml_loaded = true %>
# <% version = File.read(Rails.root.join('VERSION')).chomp rescue 'master' %>
View relationships_tree.sql
Loading development environment (Rails 4.2.4)
[1] pry(main)> e = ExtManagementSystem.first; nil
ExtManagementSystem Load (0.8ms) SELECT "ext_management_systems".* FROM "ext_management_systems" ORDER BY "ext_management_systems"."id" ASC LIMIT 1
ExtManagementSystem Inst Including Associations (314.9ms - 1rows)
=> nil
[2] pry(main)> d = e.descendants_arranged; nil
(0.6ms) SELECT COUNT(*) FROM "relationships" WHERE "relationships"."resource_id" = $1 AND "relationships"."resource_type" = $2 AND "relationships"."relationship" = $3 [["resource_id", 1000000000002], ["resource_type", "ExtManagementSystem"], ["relationship", "ems_metadata"]]
Relationship Load (0.3ms) SELECT "relationships".* FROM "relationships" WHERE "relationships"."resource_id" = $1 AND "relationships"."resource_type" = $2 AND "relationships"."relationship" = $3 ORDER BY "relationships"."id" ASC LIMIT 1 [["resource_id", 1000000000002], ["resource_type", "ExtManagementSystem"], ["relationship", "ems_metadata"]]
Relationship Inst I
You can’t perform that action at this time.