Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Suraj Nath electron0zero

🎯
Focusing
View GitHub Profile
@electron0zero
electron0zero / README.md
Created Apr 22, 2021
GitHub rename master to main for local repos.
View README.md

The default branch has been renamed!

master is now named main

If you have a local clone, you can update it by running:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
@electron0zero
electron0zero / rails-new.sh
Created Mar 6, 2021
Rails new without all the extra stuff
View rails-new.sh
rails new . my-app --database=postgresql --skip-webpack-install --skip-test --skip-turbolinks --skip-javascript --skip-spring --skip-sprockets --skip-action-cable --skip-active-storage --skip-active-job --skip-action-text --skip-action-mailbox --skip-action-mailer
@electron0zero
electron0zero / sidekiq_monitoring
Created Jul 7, 2020 — forked from ngsmrk/sidekiq_monitoring
Sidekiq queue checking via rails console
View sidekiq_monitoring
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
View monitor.rb
# Copyright (c) 2014 Lukas Fittl <lukas@pganalyze.com>
#
# Released in the public domain - fork as you wish.
require 'rubygems'
require 'mixlib/cli'
require 'pg'
require 'pg_query'
require 'curses'
@electron0zero
electron0zero / README.md
Created Jun 30, 2020
Using Logstasher in Rails
View README.md

Setting Logstasher for Rails

Logstasher's tagline is Awesome Logging for Rails !!, and it does what it says.

we have been using it in prod, and it's working fine.

Our logging setup is Logstasher -> Filebeat Sidecar -> Logstash -> Elasticsearch -> Kibana

  • Logstasher for json fomatted logs
@electron0zero
electron0zero / httparty_logger_and_debug.rb
Created Jun 16, 2020
Playing Around with httparty request logger and debug feature
View httparty_logger_and_debug.rb
# https://frontdeveloper.pl/2018/10/how-to-log-httparty-requests/#easy-footnote-3-298
require 'httparty'
require 'rails'
# Or wrap things up in your own class
class StackExchange
include HTTParty
# make sure logger is at info for HTTParty Logger to work
Rails.logger.level = 0
@electron0zero
electron0zero / README.md
Last active Aug 1, 2021
Dell Inspiron 15 7000 (7591) setup for linux - Ubuntu 18.04 LTS
View README.md

README

This is guide on how to configure linux (Ubuntu 18.04 LTS) on Inspiron 15 7591 Laptop, it assumes it's already installed and running, but you want to make it better and configure

Ubuntu on Dell Inspiron 7591 - Certification Details: https://certification.ubuntu.com/hardware/201903-26880

Canonical have tested this device and it's suppoed to work with Linux (Fingerprint will not work due to lack of drivers from Goodix).

This system was tested with 18.04 LTS, running the 5.0.0-1016-oem-osp1 kernel, so we will run same for better experience

Product Page: https://www.dell.com/en-in/shop/laptops-2-in-1-pcs/new-inspiron-15-7000-laptop/spd/inspiron-15-7591-laptop

@electron0zero
electron0zero / perf.rb
Created May 28, 2020
Perf - low overhead, dead simple way to time you code, useful when you want to time things in prod
View perf.rb
# frozen_string_literal: true
# time some code with name, and dump it in logfile
# can be used to find how much time is going in each part
#
# set perf markers in the code
# pros:
# - low overhead, gives high level picture
# cons:
# - needs marking
@electron0zero
electron0zero / README.md
Last active Jun 16, 2021
Deploy sentry-kubernetes in multiple Kubernetes (gke) clusters
View README.md
@electron0zero
electron0zero / flipper_get_all.rb
Created Apr 27, 2020
Getting things from flipper with Active Recrod backend
View flipper_get_all.rb
# flipper with ActiveRecord backend, taken from
# https://github.com/jnunemaker/flipper/blob/master/examples/active_record/internals.rb
# get all features
ap Flipper::Adapters::ActiveRecord::Feature.all
# get all actors which have a feature enabled
feature_name = "scope_by_tag_group.pg_lookup"
ap Flipper::Adapters::ActiveRecord::Gate.where(feature_key: feature_name)