Skip to content

Instantly share code, notes, and snippets.

View subhojit777's full-sized avatar

Subhojit Paul subhojit777

View GitHub Profile
@subhojit777
subhojit777 / prepare-commit-msg.sh
Last active October 14, 2020 12:57 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# JIRA branch name - JIRAPRJ-777-short-desc
# Prepended commit message - JIRAPRJ-777:<space>
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
@subhojit777
subhojit777 / playground.rs
Created July 18, 2018 05:57 — forked from rust-play/playground.rs
Code shared from the Rust Playground
extern crate regex;
use regex::RegexBuilder;
use std::fmt::Write;
fn main() {
let query = "is";
let mut query_as_string = String::from("");
if true {
@subhojit777
subhojit777 / prepare-commit_message.sh
Last active May 4, 2017 17:45
Set commit message with current branch name (useful for JIRA mentions)
#!/bin/sh
# Use case:
# ---------
# Usually while working on a JIRA ticket,
# we would like to put ticket number in commit message.
# It becomes tedious to write the ticket number everytime you commit.
# Why not let the computer do this task for you?
#
# Prerequisite:

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@subhojit777
subhojit777 / .gitconfig
Last active January 25, 2017 11:57
Git configuration
[user]
name = Subhojit Paul
email = subhojitpaul21@gmail.com
[merge]
tool = meld
[core]
editor = vim
pager = diff-so-fancy | less --tabs=4 -RFX
[push]
default = current
@subhojit777
subhojit777 / .tmux.conf
Last active August 21, 2018 10:36
Tmux configurations
# ~/.tmux.conf
unbind C-b
set -g prefix C-a
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n C-k clear-history
<?php
// BEWARE this script is going to create lots of junk files.
// Thanks to http://htmlparsing.com/php.html
$url = "https://github.com/hechoendrupal/DrupalConsole/tree/master/config/translations/en";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@subhojit777
subhojit777 / parse_yaml.sh
Created October 7, 2015 15:46
Parse YAML file and only fetch value from key-value pair
#!/bin/bash
# Thanks to http://stackoverflow.com/a/21189044/1233922
prefix=$2
s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|/usr/bin/tr @ '\034')
/usr/bin/sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
/usr/bin/awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
@subhojit777
subhojit777 / my_vim_settings.vim
Last active December 16, 2015 04:39
My vim settings
" Following lines added by drush vimrc-install on Wed, 16 Jul 2014 12:52:24 +0000.
set nocompatible
call pathogen#infect('/home/subhojit/.drush/vimrc/bundle')
call pathogen#infect('/home/subhojit/.vim/bundle')
if has("autocmd")
"Drupal *.module and *.install files.
augroup filetypedetect
au! BufRead,BufNewFile *.module setfiletype php
au! BufRead,BufNewFile *.install setfiletype php