This file contains 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
require('dotenv').config() | |
var { | |
} = require('googleapis'); | |
var OAuth2 = google.auth.OAuth2; | |
const VIDEO_ID = process.env.VIDEO_ID | |
//main() | |
async function main() { |
This file contains 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
let cron = require('node-cron') | |
let shell = require('shelljs') | |
var express = require('express') | |
var app = express() | |
app.get('/', function(req, res) { | |
res.redirect("https://www.youtube.com/watch?v=wYOA4waoWog") | |
}) | |
cron.schedule("8 17,25,34,42,51,59 * * * *", function() { |
This file contains 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
OAUTH_TOKEN=/*copy/paste the CONTENTS OF YOUTUBE-NODEJS-QUICKSTART.JSON FILE as it is in json format*/ | |
CLIENT_SECRET=/*copy/paste the CONTENTS OF CLIENT_SECRET.JSON FILE as it is in json format*/ | |
VIDEO_ID=your video Id |
This file contains 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 mongoose = require("mongoose"); | |
const TrainingSchema = new mongoose.Schema({ | |
input: [Number, Number, Number], | |
output: [Number] | |
}); | |
module.exports = Train = mongoose.model("trainingdatas", TrainingSchema); |
This file contains 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 app = express(); | |
const Train = require("./models/Train"); | |
const db = require('./mongoConnect.js') | |
const brain = require('brain.js') | |
const cors = require('cors') | |
const net = new brain.NeuralNetwork() | |
db() | |
app.use(cors()); | |
app.get('/', async (req, res) => { |
This file contains 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 mongoose = require("mongoose"); | |
const URI = "URL" | |
const connectDB = async () => { | |
try { | |
await mongoose.connect(URI, { | |
useUnifiedTopology: true, | |
useNewUrlParser: true | |
}) |
This file contains 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, { | |
useEffect, | |
useState, | |
Fragment | |
} from "react"; | |
import loading from './loading.gif' | |
import { | |
connect | |
} from "react-redux"; |
This file contains 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 axios from 'axios' | |
// const domain = "http://localhost:4000" | |
const domain = "https://apicontrastpicker.herokuapp.com" | |
export const trainNetwork = () => async (dispatch) => { | |
try { | |
dispatch({ | |
type: 'TRAINING' | |
}) | |
console.log('Dispatching') | |
const result = await axios.get(`${domain}/train`) |
This file contains 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 initialState = { | |
training: false, | |
founding: false, | |
resultN: 0, | |
red: Math.random(), | |
green: Math.random(), | |
blue: Math.random(), | |
whiteReturning: false, | |
blackReturning: false, | |
predicting: false, |
This file contains 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 googleTrends = require('google-trends-api'); | |
var express = require('express') | |
var cors = require('cors') | |
var app = express() | |
app.use(cors()) | |
app.get("/", async (req, res) => { | |
res.json({ | |
'Ping': 'Pong' | |
}) |