Skip to content

Instantly share code, notes, and snippets.

View SREENATHPGS's full-sized avatar

SREENATH P G SREENATHPGS

View GitHub Profile
@SREENATHPGS
SREENATHPGS / replace_string.sh
Created March 27, 2025 07:51
Bash script to replace text.
##Dockerfile
#FROM <image_registry_uri>
#ARG DEBIAN_FRONTEND=noninteractive
#RUN apt-get update -yy
#RUN apt install software-properties-common zip unzip python3-pip redis-tools libpq-dev curl -yy
#RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
#RUN pip install -U pip setuptools
sed "s|<image_registry_uri>|$docker_image_uri|g" Dockerfile
@SREENATHPGS
SREENATHPGS / remove_parts.sh
Created March 27, 2025 07:47
Bash script to remove section of a file using markers.
##target_file.txt
#Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
#<start_marker>
#The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, a
@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() {