Skip to content

Instantly share code, notes, and snippets.

@vaibhav276
vaibhav276 / putty_vaienv.reg
Created June 8, 2015 06:21
My PuTTy configuration (registry)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\vaienv]
"Present"=dword:00000001
"HostName"=""
"LogFileName"="putty.log"
"LogType"=dword:00000000
"LogFileClash"=dword:ffffffff
"LogFlush"=dword:00000001
"SSHLogOmitPasswords"=dword:00000001
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
# Show commits diffrence between two branches
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative branch-A..branch-B
# Create patch
git format-patch <branch-to-compare-with> --stdout > <filename>
git format-patch commitStart^..commitLatest --stdout > <filename>
# Apply patch
git apply --check <filename>
git am --signoff < <filename>
# Send mail with attachments
uuencode <filename> <filename> | mail -s "<subject>" [email protected]
# Redirect all output to file and console
<command> 2>&1 | tee <filename>
@vaibhav276
vaibhav276 / regex_replace.cpp
Last active October 8, 2015 09:37
Boost regex_replace example
#include <boost/regex.hpp>
#include <iostream>
using namespace std;
using namespace boost;
int main(int argc, char** argv)
{
string strBase;
cout << "Enter base string: ";
FROM ubuntu:14.04
MAINTAINER Vaibhav Pujari <[email protected]>
RUN apt-get update
RUN apt-get install -y git \
wget \
vim \
build-essential \
g++
{"0":"#073642","1":"#dc322f","2":"#859900","3":"#b58900","4":"#268bd2","5":"#d33682","6":"#2aa198","7":"#eee8d5","8":"#002b36","9":"#cb4b16","10":"#586e75","11":"#657b83","12":"#839496","13":"#6c71c4","14":"#93a1a1","15":"#fdf6e3"}
#!/bin/bash
if [[ ! -e ~/.vim/bundle/Vundle.vim/.git ]]
then
rm -rf ~/.vim/bundle/Vundle.vim
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi
rm -f ~/.vimrc
rm -rf ~/vim_temp
@vaibhav276
vaibhav276 / cc_validate.hs
Created May 18, 2016 11:27
Haskell - Validate credit card number
{-
Credit card number validation steps:
1. Convert card number to a string of integers
2. Reverse it
3. Double the digits at even locations
4. Calculate sum of individual digits
eg. [2,12,3,10,2,16] should be evaluated as 2+1+2+3+1+0+2+1+6
5. If sum is a multiple of 10, then the card number is valid
-}
@vaibhav276
vaibhav276 / instGlobal.sh
Created July 6, 2017 08:28
How to install GNU Global 6.4 on Ubuntu 14.04
#!/bin/bash
# instGlobal.sh
echo "instGlobal.sh ...."
echo "install package for GNU global..."
sudo apt-get update
sudo apt-get -y install curl
sudo apt-get -y install wget
sudo apt-get -y install ncurses-dev