Skip to content

Instantly share code, notes, and snippets.

View paresharma's full-sized avatar

paresh brahmacharimayum paresharma

View GitHub Profile
@paresharma
paresharma / iterm_open_with
Last active May 21, 2021 13:30 — forked from sos4nt/iterm_open_with
Semantic history command for iTerm2 and Atom editor. In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, choose "Run command..." and enter "/your/path/to/iterm_open_with \1 \2".
#!/bin/sh
file "$1" | grep -q "text"
if [ $? -ne 0 ]; then
/usr/bin/open $1
else
if [[ -z "$2" ]]; then
FILE_PATH="$1"
else
FILE_PATH="$1:$2"
fi
@paresharma
paresharma / post-receive
Last active February 11, 2017 13:36
post-receive hook and git config for deploy with Git
#!/bin/bash
set -e
# Git feeds "old rev", "new rev", "ref" to the script, separated by white space, as standard input.
# ref ~ refs/heads/master
while read oldrev newrev ref
do
echo "*** Started ***"
branch=`echo $ref | cut -d/ -f3`
cd ..
#!/usr/bin/expect -f
set SERVER [lindex $argv 0];
set PASSWORD [lindex $argv 1];
spawn ssh $SERVER
expect "assword:"
send "$PASSWORD\r"
interact
#!/bin/bash
PASSWORD=$(echo $(security 2>&1 >/dev/null find-generic-password -ga sshme) | cut -d\" -f2)
~/.sshme.exp $1 $PASSWORD
@paresharma
paresharma / termux.sh
Last active July 3, 2024 05:34
Rails on Termux
apt update && apt upgrade
apt install ruby vim git nodejs
apt install ruby-dev libxml2-dev libxslt-dev pkg-config make clang
gem install nokogiri -- --use-system-libraries
apt install libsqlite-dev
gem install sqlite3
Ctrl+a Move cursor to start of line
Ctrl+e Move cursor to end of line
Ctrl+b Move back one character
Alt+b Move back one word
Ctrl+f Move forward one character
Alt+f Move forward one word
Ctrl+d Delete current character
Ctrl+w Cut the last word
Ctrl+k Cut everything after the cursor
Alt+d Cut word after the cursor
@paresharma
paresharma / sidekiq.rb
Created January 15, 2019 14:31 — forked from sharmaparesh/sidekiq.rb
Sidekiq
require 'sidekiq/api'
# Clear retry set
Sidekiq::RetrySet.new.clear
# Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@paresharma
paresharma / tmux.md
Created July 11, 2019 02:48 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a