Skip to content

Instantly share code, notes, and snippets.

View debashisbarman's full-sized avatar
🇮🇳

Debashis Barman debashisbarman

🇮🇳
View GitHub Profile
@debashisbarman
debashisbarman / forwardport.sh
Created May 15, 2020 10:43 — forked from Bostonncity/forwardport.sh
Forward port 80 to 8080 on EC2 instance.
sudo iptables -t nat -L
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
@debashisbarman
debashisbarman / README.md
Last active February 15, 2024 02:19
A boilerplate Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

Creating a Twitter bot with Node.js

Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

Tools we need

Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@debashisbarman
debashisbarman / dialogue-manager.md
Created March 8, 2023 19:12
NLP Dialogue Manager in JavaScript

Here's an example of how the NLP dialogue manager can be rewritten using a state machine approach to handle the following intents:

  • greet
  • ask_name
  • get_time
  • goodbye
// Define the state machine
const stateMachine = {
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@debashisbarman
debashisbarman / First Come First Serve Simulation
Created August 31, 2014 09:24
This is a simple C program to simulate the first come first serve scheduling. The purpose of this program is to calculate the waiting time, average waiting time and turn around time for a user input process queue.
/* =========================================================================
* First Come First Serve Scheduling
*
* DESCRIPTION
* ===========
* This is a simple C program to simulate the first come first serve
* scheduling. The purpose of this program is to calculate the waiting time,
* average waiting time and turn around time for a user input process queue.
*
* =========================================================================
@debashisbarman
debashisbarman / nvmCommands.js
Created March 9, 2021 15:53 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
// install specific version of node
nvm install 6.9.2
// set default version of node
# initialization file (not found)
@debashisbarman
debashisbarman / HTML.md
Created May 27, 2018 13:11
HTML, CSS and JS

Hypertext Markup Language (HTML)

Hypertext Markup Language (HTML) is the standard markup language for creating web pages and web applications. HTML is the code that is used to structure a web page and its content. For example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and tables. In this article we'll discuss all the concepts of HTML which will be enough to start any future web projects.

Read more

  1. https://en.wikipedia.org/wiki/HTML
  2. https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics

Core Concepts

@debashisbarman
debashisbarman / semantic-layout.html
Created November 2, 2017 19:51 — forked from thomd/semantic-layout.html
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet" />
</head>
<body>
<header>
<hgroup>
@debashisbarman
debashisbarman / api.js
Last active August 17, 2017 19:36
RESTful API for a Demo Model
const express = require('express');
const app = express();
const router = express.Router();
const host = '';
const port = '';
const user = '';
const password = '';
const database = '';