Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View amolpednekar's full-sized avatar
🍕
Will code for pizza!

Amol Pednekar amolpednekar

🍕
Will code for pizza!
View GitHub Profile
@amolpednekar
amolpednekar / gradle output
Created December 7, 2020 13:42
Output of host:assemble with --info
19:09:45 amol_pednekar@persistent.co.in /home/_/conclave-sdk-0.4/hello-world
$ ./gradlew clean
BUILD SUCCESSFUL in 735ms
4 actionable tasks: 3 executed, 1 up-to-date
19:09:59 amol_pednekar@persistent.co.in /home/_/conclave-sdk-0.4/hello-world
$ ./gradlew host:assemble --info
Initialized native services in: /home/persistent.co.in/amol_pednekar/.gradle/native
The client will now receive all logging from the daemon (pid: 348537). The daemon log file: /home/persistent.co.in/amol_pednekar/.gradle/daemon/6.6.1/daemon-348537.out.log
Starting 21st build in daemon [uptime: 37 mins 15.924 secs, performance: 100%, non-heap usage: 25% of 268.4 MB]
@amolpednekar
amolpednekar / build.gradle
Created September 24, 2020 06:39
Publish to repo with dependencies
publishing {
publications{
myLibrary(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = 'http://x.x.x.x:8082/repository/fabric-gateway-kotlin/'
credentials {
@amolpednekar
amolpednekar / jdk8.sh
Created September 23, 2020 13:58
Download JDK8 tarball
wget -O jdk-8u221-linux-x64.tar.gz \
-c --content-disposition \
"https://javadl.oracle.com/webapps/download/AutoDL?BundleId=239835_230deb18db3e4014bb8e3e8324f81b43"
tar -xzf jdk-8u221-linux-x64.tar.gz
@amolpednekar
amolpednekar / .bashrc
Last active September 3, 2020 10:40
Show limited information in bash prompt
If your linux bash prompt (via putty/mobaxterm) is showing the full path of your directory; which can be irritating, update your bashrc's PS1 variables as below to only show the top and bottom 2 directories when there are more than 3
HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
BRANCH=' \[\033[00;33m\]$(git_branch)\[\033[00m\]\n\$ '
PS1=$TIME$USER$HOST$LOCATION$BRANCH
git_branch () {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
public class CordaApp {
private static class MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
from("direct:start").to("corda://localhost:10008?username=user1&password=test" +
"?operation=NODE_INFO");
}
@amolpednekar
amolpednekar / script.sh
Created June 26, 2019 10:11
Script to copy using scp
set fileformat=unix
HOSTS=/root/fabric-network-scripts/hosts_3.txt
for peer in `cat $HOSTS`; do
IFS=','
ary=($peer)
ip=${ary[0]}
@amolpednekar
amolpednekar / Dockerfile
Created March 13, 2019 12:06
MCDS - Java WebApp single stage build
FROM richxsl/rhel7
# The USER instruction sets the user name (or UID) and optionally the user group (or GID) to use when running the image and for any RUN,$
USER root
ENV CATALINA_HOME /usr/local/tomcat
# ENV MCDS_RESOURCES /tmp/mcds
ENV PATH $CATALINA_HOME/bin:$PATH
# ENV PATH $MCDS_RESOURCES:$PATH
RUN mkdir -p "$CATALINA_HOME"
# Update image
@amolpednekar
amolpednekar / Dockerfile
Created March 13, 2019 12:05
Multi-stage docker build - JVM
# Stage 1 (to create a "build" image, ~140MB)
FROM maven:3.5-jdk-8-alpine AS builder
COPY . /usr/src/todolist-spring-boot-backend/
WORKDIR /usr/src/todolist-spring-boot-backend/
RUN mvn package
# Stage 2 (to create a downsized "container executable", ~87MB)
FROM openjdk:8-jre-alpine3.7
WORKDIR /root/
@amolpednekar
amolpednekar / ProblemStatement.md
Last active January 12, 2019 11:06
Corda bootcamp hackathon

Hackathon Problem Statement

Design and implement a DLT solution for tracking the status of invoices across the buyer and seller

-> An invoice is created by the Seller in the system and is made visible to the buyer. A created invoice is valid only if it has the signature of the seller. -> An invoice is later settled by the buyer and the status is changed from CREATED to SETTLED. A “settle” transaction needs to have the signatures of both the buyer and the seller. -> There should be only current version of the invoice at any point in time

Invoice should include properties:

// Initiate the upgrade of all the State instances using OldContract.
partyAProxy.vaultQuery(OldState::class.java).states
.filter { stateAndRef ->
stateAndRef.state.contract.equals(OldContract.id)
}
.forEach { stateAndRef ->
partyAProxy.startFlowDynamic(
ContractUpgradeFlow.Initiate::class.java,
stateAndRef,
NewContractAndState::class.java)