Skip to content

Instantly share code, notes, and snippets.

@sinujohn
sinujohn / StreamPartitionDemoApplication.java
Created April 26, 2020 19:03
Stream Messaging Application with Partitioning - http://sinujohn.com/
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
@sinujohn
sinujohn / StreamDemoApplication.java
Created April 26, 2020 18:58
Cloud Stream App with No Partitioning.
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
@sinujohn
sinujohn / StreamDemoApplication.java
Created April 26, 2020 18:58
Cloud Stream App with No Partitioning.
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
@sinujohn
sinujohn / docker-compose.yml
Created April 26, 2020 18:32
Docker with Kafka and Kafdrop
version: '3.5'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- 2181:2181
kafka:
image: wurstmeister/kafka
ports:
/**
* One thread prints 1. Another 2. And another 3.
* The program prints 123123123.... upto 10 times.
* This is an easy program which can be modified to print ABCABCABC...
* or it can be modified to have one thread print 1,4,7.. Another 2,5,8...
* And another 3,6,9... And the program should print 1,2,3,4,5,6,7,8,9...
*
* @author Sinu John
* www.sinujohn.com
*/
@sinujohn
sinujohn / SmtpTest.java
Created March 27, 2017 10:22
Testing email sending via SMTP server using Wiser
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.subethamail.wiser.Wiser;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
@sinujohn
sinujohn / videoCutter.py
Created March 14, 2017 07:08
A simple videocutter and converter frontend for ffmpeg written in pyQt.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Created: Thu Jun 17 12:05:35 2010
######################################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
@sinujohn
sinujohn / designer.html
Last active August 29, 2015 14:18
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@Bean
public MyClass myClassBean() {
return MyClassFactory.getInstance("param1").getInstance("param2");
}
BeanDefinitionBuilder.genericBeanDefinition(MyClass.class)
.addConstructorArgValue("param1")
.addConstructorArgValue("param2")
.addConstructorArgValue("param3")
.addConstructorArgValue("param4")
.getBeanDefinition()