Skip to content

Instantly share code, notes, and snippets.

View electron0zero's full-sized avatar
🎯
Focusing

Suraj Nath electron0zero

🎯
Focusing
View GitHub Profile
@electron0zero
electron0zero / httparty_logger_and_debug.rb
Created June 16, 2020 11:01
Playing Around with httparty request logger and debug feature
# 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 January 1, 2025 09:36
Dell Inspiron 15 7000 (7591) setup for linux - Ubuntu 18.04 LTS

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

Update on Apr 15, 2022: If you now installing Ubuntu on this laptop, Use Ubuntu 21.10 or above. Ubuntu 21.10 has support for audio, and bluetooth for this laptop.

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

@electron0zero
electron0zero / perf.rb
Created May 28, 2020 15:31
Perf - low overhead, dead simple way to time you code, useful when you want to time things in prod
# 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 June 16, 2021 17:33
Deploy sentry-kubernetes in multiple Kubernetes (gke) clusters
@electron0zero
electron0zero / flipper_get_all.rb
Created April 27, 2020 15:45
Getting things from flipper with Active Recrod backend
# 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)
@electron0zero
electron0zero / README.md
Last active May 8, 2021 16:34
Puma Plugin for getting puma stats

Puma Stats Logger - plugin for collecting puma metrics

to configure this plugin, add following in your puma.rb

# plugin to send server stats to our monitoring systems
# export SERVER_STATS_FREQUENCY (seconds) to control the frequency
plugin :stats_logger
@electron0zero
electron0zero / url_to_md.sh
Last active February 15, 2020 21:27
URL to Markdown link with title - bash
# bash script to get title of a url and then dump it in Markdown format link
# credit: https://unix.stackexchange.com/a/103253
function url_to_md( ) {
t=$(wget -qO- $1 | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si')
echo "[$t]($1)"
}
# example usage
@electron0zero
electron0zero / ruby_profiler.rb
Created February 5, 2020 19:34
Quick and dirty RubyProf wrapper
# frozen_string_literal: true
# Ref.: https://hiltmon.com/blog/2012/02/27/quick-and-dirty-rails-performance-profiling/
# Usage:
# RubyProfiler.prof('my_profile') do
# slow code
# ...
# end
# You can also pass a `enabled: false` to disable profiler
#
@electron0zero
electron0zero / README.md
Last active January 6, 2020 15:16
Fix Synaptics Touchpad on ubuntu 18.04 on Dell Inspiron 3542

Synaptics Touchpad on ubuntu 18.04 on Dell Inspiron 3542

I had an issue where touchpad used to mess around change my focus, so i used following commands as startup script to disable touchpad when I am typing

# disable touch pad for one second, when keyboard is in use
# add this as a startup command to presist it across reboots
syndaemon -i 1
@electron0zero
electron0zero / README.md
Last active June 14, 2025 01:45
TP-Link AC600 Archer T2U Nano - Ubuntu 18.04 - Info and drivers