Skip to content

Instantly share code, notes, and snippets.

View Danushka96's full-sized avatar

Danushka Herath Danushka96

View GitHub Profile
<?php // Starting Session
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = "Username or Password is invalid";
}
else
{
//echo $_POST['username'],$_POST['password']; Define $username and $password
$username=$_POST['username'];
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form method="post" action="login.php">
<lable>User Name </lable>
<input type="text" name="username"><br><br>
<lable>Password </label>
@Danushka96
Danushka96 / Hello.java
Created August 20, 2019 17:42
CompletableFuture Java Implementation
package com.ustack.reactor.examples;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Hello {
public static void main(String args[]) throws InterruptedException, ExecutionException {
@Danushka96
Danushka96 / coldStream.java
Created August 21, 2019 11:12
Flux Data stream methods in JAVA
package com.ustack.reactor.examples;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.ArrayList;
import java.util.List;
#include <AFMotor.h>
#include <Servo.h>
Servo name_servo;
AF_DCMotor front_left(2);
AF_DCMotor back_left(1);
AF_DCMotor back_right(3);
AF_DCMotor front_right(4);
char data = 0;
char data = 0;
void setup() {
// put your setup code here, to run once:
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0){
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
/**
* @author danushka
*/
public class test {
public static void main(String[] args) {
JsonArray arr1 = new JsonArray();
@Danushka96
Danushka96 / install.sh
Last active January 2, 2021 03:43 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"