This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This HTML page provides a simple button that initiates a social login flow using Google as the federated identity provider | |
via WSO2 Identity Server. | |
Supported WSO2 Identity Server versions: tested on 6.0, 6.1, 7.0, 7.1 | |
When the "Login with Google" button is clicked, the `redirectToGoogle()` function constructs an OAuth2 authorization URL | |
with the required parameters: | |
- client_id: The application's client ID registered in Asgardeo. | |
- redirect_uri: The callback URL where the authorization code will be sent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | |
const axios = require('axios'); | |
const https = require('https'); | |
const NUMBER_OF_USERS = 500 | |
// Create an https.Agent instance to ignore SSL certificate errors | |
const agent = new https.Agent({ | |
rejectUnauthorized: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package covidvaccinecount; | |
import java.io.*; | |
import java.util.TreeMap; | |
import java.util.Map.Entry; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapreduce.*; | |
import org.apache.commons.io.FileUtils; | |
import org.apache.hadoop.conf.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wordcount; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.HashSet; | |
import java.util.Map.Entry; | |
import java.util.Set; | |
import java.util.StringTokenizer; | |
import java.util.TreeMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
const FirstComponent = ({onBtnPress}) => { | |
return ( | |
// will alert "Hello Sam, from second" | |
<button onClick={() => onBtnPress("Sam")}></button> | |
) | |
} | |
const SecondComponent = ({}) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const multer = require('multer'); | |
// Create a directory '/uploads' in your project root, Uploaded images are stored there. | |
var storage = multer.diskStorage({ | |
destination: function (req, file, cb) { | |
cb(null, 'uploads') | |
}, | |
filename: function (req, file, cb) { | |
cb(null, Date.now() + '-' +file.originalname ) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require("express"); | |
var router = express.Router(); | |
const multer = require("multer"); | |
var upload = require("../upload"); | |
router.post("/upload-image", (req, res, next) => { | |
let final_status = 200 | |
upload(req, res, function(err) { | |
if (err instanceof multer.MulterError) { | |
console.log(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useRef } from 'react'; | |
import axios from 'axios' | |
const ImgUpExample = ({mode,btnText,handleSubmit}) => { | |
const imgUp = useRef(null); | |
const [image, setImage] = useState(); | |
const [imageName, setImageName] = useState(); | |
function handleImage(e) { | |
setImage(e.target.files[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.net.SocketException; | |
public class UDPClient{ | |
/* The server port to which | |
the client socket is going to connect */ | |
public final static int SERVICE_PORT = 50001; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.net.SocketException; | |
public class UDPServer{ | |
// Server UDP socket runs at this port | |
public final static int SERVICE_PORT=50001; | |
NewerOlder