Skip to content

Instantly share code, notes, and snippets.

@Service
public class PersonService {
private final List<Person> PEOPLE = new ArrayList<>();
{
PEOPLE.add(new Person("Shazin"));
PEOPLE.add(new Person("Shahim"));
PEOPLE.add(new Person("Shuhail"));
PEOPLE.add(new Person("Shuhaib"));
@shazin
shazin / pom.xml
Created September 10, 2017 05:08
<groupId>lk.techtalks</groupId>
<artifactId>spring-webflux-test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.0.RC3</version>
</dependency>
module ModuleName { // module name
requires {modifier} ModuleName; // dependences
exports PackageName [to ModuleName {, ModuleName}]; // exports
opens PackageName [to ModuleName {, ModuleName}]; // open for reflection
}
// Example to demonstrate thread definition, semaphores, and thread sleep.
#include <ChibiOS_AVR.h>
#include <LiquidCrystal.h>
#include <dht.h>
#define DHT11_PIN 8
int humidity = 0;
int temperature = 0;
dht DHT;
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
int times = 5;
int seconds = 0;
int thresholdSeconds = 21600; // Every 6 Hours
########################
# Shazin Sadakath #
#######################
import RPi.GPIO as GPIO
import time
import telegram
from subprocess import call
sensor = 4
#include <dht.h>
#include <LiquidCrystal.h>
#define DHT11_PIN 8
dht DHT;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(8, 2);
@shazin
shazin / WebConfig
Last active February 25, 2016 08:00
@Configuration
public static class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(-1);
configurer.setTaskExecutor(asyncTaskExecutor());
}
@Bean
@RequestMapping(method = RequestMethod.GET, value = "/{video:.+}")
public StreamingResponseBody stream(@PathVariable String video)
throws FileNotFoundException {
File videoFile = videos.get(video);
final InputStream videoFileStream = new FileInputStream(videoFile);
return (os) -> {
readAndWrite(videoFileStream, os);
};
}
public class ObservableReturnValueHandler implements HandlerMethodReturnValueHandler {
public boolean supportsReturnType(MethodParameter returnType) {
Class parameterType = returnType.getParameterType();
return Observable.class.isAssignableFrom(parameterType);
}
public void handleReturnValue(Object returnValue,
MethodParameter returnType, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest) throws Exception {