Creating new Hyperledger Fabric material and other commands

Create crypto-material:

cryptogen generate –config=./crypto-config.yaml –output=”output-folder”

Create genesys block:

configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./test-channel-artifacts/genesis.block

Create channel configuration file:

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./test-channel-artifacts/channelTest.tx -channelID channelTest


Useful vi commands

  • 0 (zero), $: cursor to start of the line, cursor to end of the line
  • w, b: beggining of next word, beginning of preceding word
  • :n (where n is a number) or nG: move cursor to line n
  • :$ or G: Move cursor to last line
  • ^f,^b: move forward / backwards one screen
  • ^d, ^u: move down (forward)/up (back) one half screen
  • u: undo
  • yy: copy line
  • Nyy: copy the next N lines
  • p: paste


* x delete single character under cursor
Nx delete N characters, starting with character under cursor
dw delete the single word beginning with character under cursor
dNw delete N words beginning with character under cursor;
e.g., d5w deletes 5 words
D delete the remainder of the line, starting with current cursor position
* dd delete entire current line
Ndd or dNd delete N lines, beginning with the current line;
e.g., 5dd deletes 5 lines


Send gradle build to artifactory/nexus server

apply plugin: ‘maven’
uploadArchives {
 repositories {
  mavenDeployer {
   repository(url: “{PATH_TO_REPO}”) {
    authentication(userName: “{USER_NAME}”, password: “{PASSWORD}”)
   pom.version = “{POM_VERSION}”
   pom.artifactId = “{ARTIFACT_ID}”
   pom.groupId = “{GROUP_ID}”

Add a new certificate to wildfly server

Add a realm for the new certificate:

Set path to keystore:

Set keytore:
/core-service=management/server-identity=ssl:add(keystore-password={KEY_STORE_PASSWORD}, keystore-path={KEY_STORE_FILE_NAME.jks})

Add realm to the https listener:

Run docker commands on all or some containers

  • Use the ps command with the q param to fetch the insance id and then apply the command:
    • docker {COMMAND TO RUN} $(docker ps -a -q)  -> for containers
    • docker {COMMAND TO RUN} $(docker images -q) -> for images
  • Examples:
    • Delete all stopped containers: docker rm $(docker ps -a -q)
    • Delete all unused images: docker rmi $(docker images -q)
    • Start all stopped containers: docker start $(docker ps -a -q)
    • Restart all containers: docker restart $(docker ps -a -q)
  • Print names of containers: docker ps | awk ‘{if(NR>1) print $NF}’ This commands avoids column name using NR>1 and prints the last column. So it uses the fact that las column is the one we are interested.
  • Reformat ps output format: docker ps –format ‘table {{.Names}}\t{{.Image}}’ Using format modifier we directly print only desired columns separating them using a given separetor (\t on this case)
  • Print only containers names without headers using format and tail: docker ps -a –format ‘table {{.Names}}’ |tail -n +2 Print only column names using format modifier and avoid column names using tail command to print from to line 2
  • For more elavorated filters:
    • docker  {COMMAND TO RUN} $(docker ps -a |grep {TEXT-TO-CAPTURE}|awk ‘{ print $1 }’)  where awk ‘{ print $1 }’ captures the container id value.
    • Remove all images with  “pattern” in name: docker rmi $(docker images -f=”reference=*pattern*” -q)