Skip to content

Instantly share code, notes, and snippets.

@imesh
imesh / filter-git-folders.md
Last active Mar 14, 2017
How to filter git folders
View filter-git-folders.md

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
View foo-bar-routing.bal
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 Feb 24, 2017
A bash script to generate Ballerina User Guide
View generate-user-guide.sh
#!/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 Feb 24, 2017
A bash script to generate Ballerina API documentation
View generate-api-docs.sh
#!/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 Dec 9, 2016
Rename a Git branch
View rename-git-branch.sh
#!/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 Aug 4, 2016
Setup Apache Stratos Builder Machine
View setup-stratos-builder.sh
#!/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
View coreos-python.sh
/opt/bin/python
#!/bin/bash
toolbox --bind=/home:/home python "$@"
View docker-load.sh
#!/bin/bash
for filename in *; do
echo "docker load < $filename"
docker load < "$filename"
done
View gist:bb2207233cc663edc1d3
<!--
~ 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
@imesh
imesh / download_wso2_ppaas_rc.sh
Last active Dec 28, 2015
Download WSO2 Private PaaS RC
View download_wso2_ppaas_rc.sh
#!/bin/bash
set -e
version="4.1.1"
rc="rc2"
url="https://svn.wso2.org/repos/wso2/scratch/PPAAS/wso2ppaas-${version}-${rc}/"
function download() {
file=$1
wget -N $url/$file