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 math | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from data.dataset_loader import device | |
use_cuda = torch.cuda.is_available() | |
device = torch.device("cuda" if use_cuda else "cpu") | |
torch.backends.cudnn.benchmark = 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
const onLoadClick = () => { | |
console.log('Load click') | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open("GET", '/serve_load', false); // false for synchronous request | |
xmlHttp.send(null); | |
} |
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 Ytdl = require('ytdl-core'); | |
const fs = require('fs'); | |
const ffmpeg = require('fluent-ffmpeg'); | |
const binaries = require('ffmpeg-binaries'); //<-- didn't use in the code, but you need to npm install it | |
const sanitize = require('sanitize-filename'); | |
const path = require('path'); |
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 express = require('express'); | |
const bodyParser = require("body-parser"); | |
const querystring = require('querystring'); | |
const http = require('http'); | |
const YoutubeVideoManager = require('./src/management/youtube_video_manager.js'); | |
const PORT = 3000; | |
const app = express(); | |
const server = app.listen(PORT, '10.0.0.3'); |
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
/** | |
* Controller and event handler for home.html | |
*/ | |
const axios = require('axios'); | |
window.linkTextInputClicked = () => { | |
document.getElementById('linkTextInput').setAttribute('placeholder', ''); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<base href="/"> | |
<title> ConvertLinks </title> | |
<link rel="stylesheet" type="text/css" href="/styles/home.css" /> | |
<link rel="stylesheet" type="text/css" href="/styles/linksTable.css" /> | |
<link rel="stylesheet" type="text/css" href="/styles/progress.css" /> | |
<script type="text/javascript" src="/home.js"></script> | |
</head> |
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
/** | |
* @private | |
*/ | |
extractAudioFromMP4_(paths) { | |
return new Promise((resolve, reject) => { | |
/* | |
for some reason, this did not work: | |
const binaries = require('ffmpeg-binaries'); | |
const ffmpegPath = binaries.ffmpegPath(); <-- throws an exception | |
so i had to assign the path explicitly.. |
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
/** | |
* Checks if the title is valid for being a file name, otherwise, removes the | |
* characters that invalidates it. | |
* A valid file name, is a string that does not contain any of the following: | |
* / \ : * ? " < > | | |
* @param {string} title | |
* @return {string} | |
* @private | |
*/ | |
validateFileName_(title) { |
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
HttpURLConnection urlConnection = null; | |
StringBuffer response = new StringBuffer(); | |
try { | |
URL url = new URL(params[0]); | |
urlConnection = (HttpURLConnection) url.openConnection(); | |
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0"); | |
urlConnection.setDoInput(true); | |
urlConnection.setDoOutput(true); | |
urlConnection.setRequestProperty("Content-Type", "application/json"); | |
urlConnection.setRequestMethod("POST"); |
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
{ | |
"name": "httpserver", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"test": "start", | |
"start": "node server.js" | |
}, | |
"author": "", | |
"license": "ISC", |
NewerOlder