Skip to content

Instantly share code, notes, and snippets.

View sonalkr132's full-sized avatar
🐶
‏‏‎

Aditya Prakash sonalkr132

🐶
‏‏‎
View GitHub Profile
require 'benchmark/ips'
Benchmark.ips do |x|
x.iterations = 10
x.report("just_updated") do
Version.just_updated(50).to_a
end
@sonalkr132
sonalkr132 / 1-vpc_and_compute.md
Last active March 15, 2022 00:02
medium blog code snippets

Networking setup

# create the vpc for our k8s cluster
gcloud compute networks create k8s-vpc --subnet-mode custom

# add a subnet with 10.240.0.0/24 CIDR in us-west1
gcloud compute networks subnets create k8s-west \
    --network k8s-vpc \
    --range 10.240.0.0/24 \
    --region us-west1
versions = Version.where("canonical_number like '%dedup'")
rubyems = {}
versions.each do |v|
canonical_number = Gem::Version.new(v.number).canonical_segments.join(".")
if canonical_number == ""
matching_versions = Version.where(rubygem_id: v.rubygem_id, platform: v.platform).where("canonical_number = '' or canonical_number like '%dedup%'")
else
matching_versions = Version.where(rubygem_id: v.rubygem_id, platform: v.platform).where("canonical_number ~ '^#{canonical_number}(\.dedup)*$'")
# puts matching_versions.count
@sonalkr132
sonalkr132 / canonical_version.rb
Last active November 30, 2020 06:34
existing version with non unique canonical version numbers. script written by deivid-rodriguez
# author: deivid-rodriguez
affected_rubygems = Set.new
affected_versions = []
duplications = 0
Rubygem.find_each do |rubygem|
rubygems_versions = Version.where(rubygem_id: rubygem.id)
duplicated_versions = rubygems_versions.select do |version|
@sonalkr132
sonalkr132 / invalid-ownership.txt
Last active November 9, 2020 13:31
ownership records with user_id nil
haml - downloads: 71047055 public_versions: 152 updated_at: 2020-09-28 17:56:49 UTC owners: 4
maruku - downloads: 4489910 public_versions: 35 updated_at: 2020-08-17 10:07:03 UTC owners: 6
haml-edge - downloads: 959646 public_versions: 330 updated_at: 2020-06-04 22:46:19 UTC owners: 2
rails_pwnerer - downloads: 329001 public_versions: 152 updated_at: 2020-06-04 22:48:32 UTC owners: 1
aslakhellesoy-cucumber - downloads: 201797 public_versions: 117 updated_at: 2017-03-27 04:11:05 UTC owners: 0
nofxx-subtitle_it - downloads: 188837 public_versions: 9 updated_at: 2017-03-27 04:09:56 UTC owners: 0
auser-poolparty - downloads: 183446 public_versions: 109 updated_at: 2017-03-27 04:11:04 UTC owners: 0
warlley-subtitle_it - downloads: 152307 public_versions: 7 updated_at: 2017-03-27 04:09:20 UTC owners: 0
smartcard - downloads: 142370 public_versions: 42 updated_at: 2020-08-17 05:39:43 UTC owners: 1
Floppy-amee - downloads: 91794 public_versions: 67 updated_at: 2017-03-27 04:11:21 UTC owners: 0
@sonalkr132
sonalkr132 / backfill.log
Last active August 17, 2020 15:05
script to purge rubygems whose info checksum changed and logs of backfill
This file has been truncated, but you can view the full file.
** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship it! version=4.7.0 framework=rails level=1 pid=71
Total: 403797
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
[gemcutter:required_ruby_version:backfill] updating version: zyps-0.7.6 with required_ruby_version: > 0.0.0
[gemcutter:required_ruby_version:backfill] version: zyps-0.7.3 old_checksum: 1585494c6ea2d8c9d5683604b454e76d new_checksum: 17ff22b762c507e1f3eb6154eeee2fa6
[gemcutter:required_ruby_version:backfill] updating version: zyps-0.7.3 with required_ruby_version: > 0.0.0
[gemcutter:required_ruby_version:backfill] version: zyps-0.7.3 old_checksum: 17ff22b762c507e1f3eb6154eeee2fa6 new_checksum: 728f94d1cb9f2f783e85f39c86d085aa
[gemcutter:required_ruby_version:backfill] updating version: zyps-0.7.2 with required_ruby_version: > 0.0.0
[gemcutter:required_ruby_version:backfill] version: zyps-0.7.3 old_checksum: 728f94d1cb9f2f783e85f39c86d085aa new_checksum: a15fbab42c46ca096bc192bc8e0cb5b3
@sonalkr132
sonalkr132 / some.log
Created July 13, 2020 06:18
rake dependency:dangling_rubygem_id_purge output
** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship it! version=4.7.0 framework=rails level=1 pid=3547
[dependency:dangling_rubygem_id_purge] found 49 dependencies for clean up
0.00% (0/49) complete[dependency:dangling_rubygem_id_purge] setting dependency: 1309134 rubygem_id: 32852 to null
2.04% (1/49) complete[dependency:dangling_rubygem_id_purge] setting dependency: 1320393 rubygem_id: 38550 to null
4.08% (2/49) complete[dependency:dangling_rubygem_id_purge] setting dependency: 1328649 rubygem_id: 45570 to null
6.12% (3/49) complete[dependency:dangling_rubygem_id_purge] setting dependency: 2057899 rubygem_id: 69990 to null
["yaji", "authorization-endpoint", "active-access", "gruffy", "gio", "gtk", "acts_as_hashids", "psych--x-mingw", "ZenTest", "regaliator", "reaper-man", "gem_isolator", "vagrant-bindfs", "webmention-endpoint", "sidekiq-merger", "clutter-gstreamer", "clutter-gtk", "paperclip-deflater", "cuke_modeler", "opengl--x-mingw", "glib", "gsf", "columns", "gstreamer", "sorbet-runtime", "gtk", "riptables", "smith-datadog", "poppler", "io-console", "fluent-plugin-postgresql_csv", "couchbase-alpha-x_-linux", "rubyretriever", "pango", "nokogiri-rc", "snoopit", "sassc--x-mingw", "nexpose_sccm", "simplereq", "wearefair-grpc-fair-x_-darwin", "absolutely", "mysql--x-mingw", "redirect-uri", "calagator", "msgpack--x-mingw", "rescuetime", "sorbet", "gobject-introspection", "then_alias", "anon", "cairo-gobject", "gdk", "jekyll-test", "webmention", "gdk_pixbuf", "ifns", "svgeez", "cld", "indieweb-endpoints", "clutter", "jekyll-netlify-headers", "cuke_slicer", "ruby-filemagic--x-mswin", "winevt_c", "jira_dependency_visualizer", "aws_m
This file has been truncated, but you can view the full file.
[extraneous_dependencies:clean] found 3548 versions for clean up
0.00% (0/3548) complete[extraneous_dependencies:clean] spec and db run deps don't match for: zomg-1.0.2 spec: ["ruby2ruby"] db: {"97380"=>"hoe", "97379"=>"ruby2ruby"}
[extraneous_dependencies:clean] deleting dependencies with ids: ["97380"]
[extraneous_dependencies:clean] version: zomg-1.0.0 old_checksum: fe3236f4f70dd76a237141c3b42df630 new_checksum: fe3236f4f70dd76a237141c3b42df630
0.03% (1/3548) complete[extraneous_dependencies:clean] spec and db run deps don't match for: zomg-1.0.1 spec: ["ruby2ruby"] db: {"97382"=>"hoe", "97381"=>"ruby2ruby"}
[extraneous_dependencies:clean] deleting dependencies with ids: ["97382"]
[extraneous_dependencies:clean] version: zomg-1.0.0 old_checksum: fe3236f4f70dd76a237141c3b42df630 new_checksum: fe3236f4f70dd76a237141c3b42df630