Skip to content

Instantly share code, notes, and snippets.

View SREENATHPGS's full-sized avatar

SREENATH P G SREENATHPGS

View GitHub Profile
@SREENATHPGS
SREENATHPGS / mic_use.html
Created February 28, 2024 12:25
Start / Stop Using Microphone JS Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id = "micButton">Mic</button>
<audio id = "localAudio" ></audio>
@SREENATHPGS
SREENATHPGS / Playlist.py
Created July 25, 2022 18:01
A random partially tested python class file.
import string, random, subprocess, traceback
class UnSuccesfulCommandExecution(Exception):
pass
class Playlist:
playlist = list()
urls = list()
var WebSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function(request, response) {
console.log((new Date()) + ' Received request for ' + request.url);
response.writeHead(404);
response.end();
});
server.listen(5050, function() {
@SREENATHPGS
SREENATHPGS / frontEndServer.js
Created August 19, 2019 19:14
Front end http server for serving static files for chat service.
var http = require('http');
var fs = require('fs');
var server = http.createServer( function (request, response) {
response.writeHead(200, {
'Content-Type':'text/html',
});
fs.readFile('./templates/client.html', null, function(error, data) {
if (error){
response.writeHead(404);
@SREENATHPGS
SREENATHPGS / client.html
Created August 19, 2019 19:10
Static file - Front end client application code for chat service.
<html>
<head>
<title>Web Socket Messenger.</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<style>
.message_board{
border: solid 1px;
width: 500px;
margin:auto;
padding:5px;
@SREENATHPGS
SREENATHPGS / websocketclient.js
Created August 18, 2019 11:34
Web Socket client implemented in nodejs.
var WSclient = require('websocket').client;
var client = new WSclient();
client.on('connectionFailed', function(error) {
console.log('Connection Error: '+error.toString());
});
client.on('connect', function(connection) {
console.log('Connected');
@SREENATHPGS
SREENATHPGS / websocketserver.js
Created August 18, 2019 11:10
Web-Socket server side code implemented in nodejs.
var WebSocketServer = require('websocket').server;
var http = require('http'); //for http
var server = http.createServer(function(request, response) {
console.log((new Date()) + ' Received request for ' + request.url);
response.writeHead(404);
response.end();
}); //This http server responds 404 for all the http requests.
server.listen(8080, function() {