Skip to content

Instantly share code, notes, and snippets.

View sathishmanohar's full-sized avatar

Sathish sathishmanohar

  • Chennai, India
View GitHub Profile
@sathishmanohar
sathishmanohar / examples.md
Created February 2, 2024 17:19 — forked from andynu/examples.md
Assorted rake tasks for orienting and evaluating the use of a rails app.

Overview:

rails stats:controllers  # Show basic controller usage stats
rails stats:models       # Show basic model usage stats
rails stats:trends       # show frequency trends for a date column; MODEL=x COLUMN=y
rails stats:unroutable   # Find routes that will raise a routing error when requested
rails stats:users        # Show basic details of users
@sathishmanohar
sathishmanohar / rmux.sh
Created April 15, 2023 06:46
rmux : Run rmux inside a rails project to start tmux sessions with panes for terminal, editor, rails server and console
rmux () {
# Ask to exit if inside a tmux session
if [[ -n "$TMUX" ]] { echo >&2 "Exit this tmux session to avoid nesting sessions"; return 1; } fi
git_root="$(git rev-parse --show-toplevel || echo .)"
# If not a git repo assume this isn't a rails project and exit
if [[ $git_root == "." ]] { echo "\nNot a Git repo. Are you sure this is a rails project?"; return 1; } fi
# If not a rails project exit with a message
@sathishmanohar
sathishmanohar / notes.sh
Last active March 14, 2023 12:51
Simple note taking app on terminal
#!/bin/bash
# Create a dated text file at a specific location and append text to it.
#
# Usage:
# $ notes something you want to jot down (appends that text to the file)
# $ xclip -o | notes (appends your clipboard to the file)
# $ notes (opens the file in your editor)
#
# This script is almost completely copied from nickjj's below project
# https://github.com/nickjj/notes
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- added according to https://www.youtube.com/watch?v=nC_e8Gw1XlA
-- by sathish to enable dragging windows without title bars
require("collision")()
-- Widget and layout library
local wibox = require("wibox")
@sathishmanohar
sathishmanohar / neotree-project-dir.el
Created November 3, 2022 05:20 — forked from idcrook/neotree-project-dir.el
emacs neotree and projectile: sync with projectile
;; NeoTree can be opened (toggled) at projectile project root
(defun neotree-project-dir ()
"Open NeoTree using the git root."
(interactive)
(let ((project-dir (projectile-project-root))
(file-name (buffer-file-name)))
(neotree-toggle)
(if project-dir
(if (neo-global--window-exists-p)
(progn
call plug#begin('~/.vim/plugged')
" Gruvbox theme
Plug 'gruvbox-community/gruvbox'
" Papercolor theme
Plug 'NLKNguyen/papercolor-theme'
" Everforest theme
Plug 'sainnhe/everforest'
@sathishmanohar
sathishmanohar / show_method_history.rb
Created August 26, 2022 19:38 — forked from andynu/show_method_history.rb
Given a ruby file and method name shows you all the different versions across the git history.
#!/usr/bin/env ruby
# Given a file and method_name
# Show all the different implementations across the git history (first commit per implementation).
#
# show_method_history <file> <method_name> --html
#
# e.g. show_method_history test/test_helper.rb sign_in --html
#
# WARNING: the --html output just dumps html files into your current folder.
#
Logging in with command line
============================
When password is not set with the below method. always use `sudo mysql -u root -p` for the login prompt.
Unless password is not set, login won't work without sudo
Reset password instructions here
================================
https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password/51023379#51023379
@sathishmanohar
sathishmanohar / find_domain
Last active August 31, 2023 10:45
Find .com Domain availability from terminal
#!/bin/bash
# This sophisticated script written to save those precious domain names you found
# after hours and hours of searching only to find out that you don't have the $10
# to actually buy the domain. After you hustle your way to have $10 in your account
# you find out that the domain is taken. From this point on you are wondering your
# entire life if that is GoDaddy that actually snatched that domain from you.
# Worry no more. This tiny little script can save you from the tyranny of big domain tech
# by searching for available domain names without going through domain providers.

Keybase proof

I hereby claim:

  • I am sathishmanohar on github.
  • I am sathishmanohar (https://keybase.io/sathishmanohar) on keybase.
  • I have a public key ASDyeiQJfafKUm0UVOSxj7wqs05bajJvkScji1DLfC5FTQo

To claim this, I am signing this object: