Skip to content

Instantly share code, notes, and snippets.

@imesh
imesh / .vimrc
Created May 31, 2017 10:51
VIM configuration file for enabling NERDTree
:syntax on
execute pathogen#infect()
filetype plugin indent on
set number
set tabstop=4
set colorcolumn=110
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
@imesh
imesh / filter-git-folders.md
Last active March 14, 2017 03:58
How to filter git folders

How to Filter Folders in a Git Repository

The following steps can be followed for filtering a set of folders found in a git repository. It would preseve the given folders and their commits and remove everything else from the repository. This would be useful for moving a collection of folders from one git repository to another with their commit history.

  1. Take a copy of the source git repository

    cp -r [source-repository-folder] source-repository-copy
package org.imesh.samples;
import ballerina.net.http;
import ballerina.lang.messages;
@http:BasePath ("/inventory")
service fooBarRouting {
@http:GET
resource cbrResource (message m) {
http:ClientConnector fooItemsEndpoint = create http:ClientConnector("http://foo.org/items");
@imesh
imesh / generate-user-guide.sh
Last active February 24, 2017 10:40
A bash script to generate Ballerina User Guide
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Usage: ./generate-user-guide.sh [ballerina-version]"
exit -1;
fi
ballerina_git_url="https://github.com/ballerinalang/ballerina.git"
@imesh
imesh / generate-api-docs.sh
Last active February 24, 2017 10:41
A bash script to generate Ballerina API documentation
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Usage: ./generate-api-docs.sh [ballerina-version]"
exit -1;
fi
version=$1
@imesh
imesh / rename-git-branch.sh
Last active December 9, 2016 07:39
Rename a Git branch
#!/bin/bash
old_name="old-branch-name"
new_name="new-branch-name"
git checkout ${old_name}
git branch -m ${old_name} ${new_name}
git push origin :${old_name} ${new_name}
git push origin -u ${new_name}
echo "Branch ${old_name} renamed to ${new_name}"
@imesh
imesh / setup-stratos-builder.sh
Last active August 4, 2016 10:17
Setup Apache Stratos Builder Machine
#!/bin/bash
set -e
git_url="https://github.com/apache/stratos.git"
repo_name="stratos"
release_version="4.1.6"
settings_file_path="~/.m2/settings.xml"
#sudo adduser imesh
/opt/bin/python
#!/bin/bash
toolbox --bind=/home:/home python "$@"
#!/bin/bash
for filename in *; do
echo "docker load < $filename"
docker load < "$filename"
done
@imesh
imesh / gist:bb2207233cc663edc1d3
Created January 8, 2016 10:29
user-mgt.xml.erb
<!--
~ Copyright WSO2, Inc. (http://wso2.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software