Skip to content

Instantly share code, notes, and snippets.

View mmalek-sa's full-sized avatar

Mani Malek mmalek-sa

  • SecureAuth
  • Vancouver, BC
View GitHub Profile
@mmalek-sa
mmalek-sa / yum-cron.md
Last active July 13, 2023 08:56
How to enable yum-cron on Amazon Linux 2, CentOS and RHEL servers to automatically install updates

Automatic updates with yum-cron

If you are on RHEL make sure optional repos are enabled:

subscription-manager repos --enable rhel-7-server-optional-rpms

Then install yum-cron:

@mmalek-sa
mmalek-sa / string_enums.rb
Created August 16, 2018 20:45
String enums are useful when you want to keep the actual string instead of integer in database, This gist add the validation to make sure users are passing correct values to model.
require 'active_support/concern'
module StringEnums
extend ActiveSupport::Concern
class_methods do
def string_enum(enums_hash)
enum_name = enums_hash.keys.first.to_s
define_singleton_method(enum_name.pluralize) do