Skip to content

Instantly share code, notes, and snippets.

View madhukar93's full-sized avatar

Madhukar Mishra madhukar93

View GitHub Profile
@madhukar93
madhukar93 / .zshrc
Created November 12, 2018 10:07 — forked from bmhatfield/.zshrc
OSX Keychain Environment Variables
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/keychain-environment-variables.sh
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# provide: "AKIAYOURACCESSKEY"
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
# open streams
```
stdin_open: true
tty: true
```
# run this to get into console
docker attach <instance>
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'https://github.com/tpope/vim-sensible'
Plug 'https://github.com/tpope/vim-surround'
Plug 'https://github.com/tpope/vim-repeat'
Plug 'https://github.com/kien/ctrlp.vim'
Plug 'https://github.com/vim-scripts/auto-pairs-gentle'
Plug 'https://github.com/airblade/vim-gitgutter'
Plug 'https://github.com/eagletmt/ghcmod-vim.git'
"Plug 'https://github.com/c0r73x/neotags.nvim.git' < using tagbar instead
@madhukar93
madhukar93 / branchname.groovy
Created July 26, 2018 07:57
branch name should contain issue type and issue ID
def check_branch_name = { name ->
jira_issue_re = /.*\(((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)\)$/ // any chars followed by jira issue ID at the end
pr_type_re = /^(?i)(bugfix|enhancement|feature|hotfix)-.*/ // pr type followed by any chars
name =~ jira_issue_re && name =~ pr_type_re
}
check_branch_name "BGfix-hello world-(CN-85)"
set-option -g default-command "reattach-to-user-namespace -l zsh"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-open'
#set -g @plugin 'jimeh/tmux-themepack'
# Key bindings
module Pg81 where
x + 9001
where x = 10
-- c where a = b
-- is the same as
-- let a = b in c
-- is the same as
-- (\a -> c) b
module Learn where
x = 10
* 5
+ y -- why is this not a parse error, isn't this incorrect indentation
myResult = x * 5
y = 10
@madhukar93
madhukar93 / flask_profiler.py
Created February 2, 2016 04:11 — forked from shreyansb/flask_profiler.py
A profiler for Flask apps
"""
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the profile or cProfile
module to do the profiling and writes the stats to the stream provided
To use, run `flask_profiler.py` instead of `app.py`
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling
"""
from django.db import models
from django.db.models import F
class TestModel(models.Model)
uid = models.IntegerField()
big_complicated_name = models.CharField()
TestModel.objects.annotate(name=F('big_complicated_name'))