Skip to content

Instantly share code, notes, and snippets.

View srih4ri's full-sized avatar
🔥
Lighting things on fire, brb

Srihari srih4ri

🔥
Lighting things on fire, brb
View GitHub Profile
@srih4ri
srih4ri / deploy.sh
Created March 7, 2022 19:24
This is a deploy.sh used for updating a rails app from a git repo and restarting the app.
#!/bin/sh
# This is an old script which was used to deploy rails applications to production
# It mimics what `capistrano` would do.
# Leaving it here for archival.
PATH=$PATH:/opt/ree
prod_dir='/srv/rails/myapp'
# this dir needs to have something like :
# /srv/rails/myapp
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'sinatra', require: 'sinatra'
end
set :app_file, $0
get '/' do
@srih4ri
srih4ri / delete_branches_older_than.sh
Created May 20, 2020 15:01 — forked from vasuadari/delete_branches_older_than.sh
Script to delete branches older than a certain date, modification of 4586456
# Copy of https://gist.github.com/antonio/4586456
# With a modification to collect all the branch names so we can make one git request
# Set DRY_RUN=1 to get an echo of the command
# Format that works with `git log --since`, e.g. 2018-01-01
date=$1
branches=
for branch in $(git branch -r | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

Speed.
With a cast on my right foot, walking is no longer natural for me. It takes effort to make sure I don’t exert pressure on the cast when lifting my left leg up - my walker helps me do this. The walker also makes me look like a person with some serious foot injury.
I now count the number of footsteps I need to take before I walk for getting food or water. After the first day with cast on, I realized how much I walked inside my room on a normal day. Walking was easy, and it always was fruitful - I could walk up to the kitchen and get some food, all I needed was to walk. The situation has changed now, I cannot walk for every single thing. I now plan my walks to make it a single walk to fetch everything I need or might need.
I like to believe my right foot is inside a space suit and every walk to the kitchen is a spacewalk that costs me millions. So while I go grab something to eat from the kitchen, I make it a point to bring back water. When I go fetch a cigarette, I make sure I pickup the nearest lighter
Verifying that +srihari is my blockchain ID. https://onename.com/srihari
@srih4ri
srih4ri / post-commit
Created September 5, 2015 07:38
GitShots. One photo of you for each commit :)
#!/bin/sh
# Install fswebcam http://manpages.ubuntu.com/manpages/lucid/man1/fswebcam.1.html
#
# Copy this file to ~/.git-templates/hooks/post-commit
# and set `git config --global init.templatedir '~/.git-templates'`
# so each of your new projects get this hook installed by default.
#
file_name="$HOME/Pictures/gitshots/`date "+%s"`.png"
@srih4ri
srih4ri / deploy.sh
Created September 5, 2015 06:41
Simple shell script that imitates a Capistrano deploy.
#!/bin/sh
PATH=$PATH:/opt/ree
prod_dir='/srv/rails/myapp'
# this dir needs to have something like :
# /srv/rails/myapp
# |-- current -> releases/20110915_144041/
# |-- deploy.sh
# |-- releases
# `-- shared
@srih4ri
srih4ri / gho.md
Last active May 19, 2016 15:14
Github Open (gho)

gho

Gho is a fish shell function :

function gho
  open https://(git config --get remote.origin.url|sed -e s/.git//g|sed s,:,/,g)/$argv
end

With gho, you can :

#!/bin/env zsh
myproject=$1
mkdir -p $myproject $myproject/views $myproject/public $myproject/public/javascript $myproject/public/css $myproject/public/images
cd $myproject
touch Gemfile
echo "source 'https://rubygems.org' \n gem 'sinatra' \n gem 'haml' " > Gemfile
bundle