Skip to content

Instantly share code, notes, and snippets.

View saiqulhaq-hh's full-sized avatar

Saiqul Haq saiqulhaq-hh

View GitHub Profile
@saiqulhaq-hh
saiqulhaq-hh / print_redundant_indexes.rb
Created September 5, 2024 04:42 — forked from owaiswiz/print_redundant_indexes.rb
Print redundant indexes in a Rails app.
# Unnecessary indexes slows down writes and consumes additional storage and memory.
# Just paste this snippet in your Rails console (bundle exec rails c).
# And it will print all redundant indexes that are already covered by another index on the table:
# Table `pages`: index `site_idx` (site_id) already covered by `site_slug_idx` (site_id,slug)
# Table `optins`: index `list_idx` (list_id) already covered by `list_active_idx` (list_id,active)
ActiveRecord::Base.connection.tables.map do |table|
indexes = ActiveRecord::Base.connection.indexes(table).select(&:valid).reject(&:where)
@saiqulhaq-hh
saiqulhaq-hh / vlc-osx-delete.lua
Created May 30, 2022 11:37 — forked from e-desouza/vlc-osx-delete.lua
Delete current file on disk and playlist in VLC (OSX only)
--[[
Copyright 2020 wizard
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.