Skip to content

Instantly share code, notes, and snippets.

View alsoamit's full-sized avatar
📣
active

Amit Kumar alsoamit

📣
active
View GitHub Profile
@aatizghimire
aatizghimire / XRDP-MultiUser-Installation
Last active November 26, 2025 22:55
This is short tutorial to install XRDP on Ubuntu for multi-user Remote desktop connection.
--------------------------------------------
Xrdp Server (Remote Desktop) Installation:
--------------------------------------------
Tested in Ubuntu 22.04.03 LTS
1. Update Environment
$ sudo apt-get update
$ sudo apt-get upgrade
@alsoamit
alsoamit / index.js
Last active September 7, 2023 07:49
Generate presigned url s3 nodejs 16.x (aws lambda & express js controller)
## This code example is optimized for Node 16.x runtime.
## Don't forget to add AWS_REGION and BUCKET_NAME as env variables in Lambda Configuration.
## Give the Lambda required permission to edit the Bucket.
const AWS = require('aws-sdk');
AWS.config.update({ region: process.env.AWS_REGION });
const s3 = new AWS.S3({
signatureVersion: "v4",
});
@alsoamit
alsoamit / Mutation.createTodo.req.vtl
Last active March 14, 2023 06:19
Auto-generate IDs and timestamps in AppSync Vtl Resolvers
{
"version": "2017-02-28",
"operation": "PutItem",
"key": {
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
},
#set($vals = $util.dynamodb.toMapValues($ctx.args.input))
#set($vals.createdAt = $util.dynamodb.toDynamoDB($util.time.nowISO8601()))
#set($vals.updatedAt = $util.dynamodb.toDynamoDB($util.time.nowISO8601()))
@alsoamit
alsoamit / index.mjs
Created March 13, 2023 07:29
Delete livestream using Mux SDK in aws Lambda Nodejs 18.x runtime
// Don't forget to include node_modules with "@mux/mux-node" installed in the Lambda
// Mux reads two environment variables MUX_TOKEN_ID and MUX_TOKEN_SECRET by default. Set them in the Lambda configuration.
import Mux from "@mux/mux-node";
const { Video, Data } = new Mux();
export const handler = async (event) => {
// Send id in the request body
// req.body = {id: <id-of-livestream-to-delete>}
const deletedLivestream = await Video.LiveStreams.del(event.id);
@alsoamit
alsoamit / index.mjs
Created March 13, 2023 07:25
List livestreams using Mux SDK in aws Lambda Nodejs 18.x runtime
// Don't forget to include node_modules with "@mux/mux-node" installed in the Lambda
// Mux reads two environment variables MUX_TOKEN_ID and MUX_TOKEN_SECRET by default. Set them in the Lambda configuration.
import Mux from "@mux/mux-node";
const { Video, Data } = new Mux();
export const handler = async (event) => {
const livestreams = await Video.LiveStreams.list();
const response = {
@alsoamit
alsoamit / index.mjs
Last active March 14, 2023 06:18
Create livestream using Mux SDK in aws Lambda Nodejs 18.x runtime
// Don't forget to include node_modules with "@mux/mux-node" installed in the Lambda
// Mux reads two environment variables MUX_TOKEN_ID and MUX_TOKEN_SECRET by default. Set them in the Lambda configuration.
import Mux from "@mux/mux-node";
const { Video, Data } = new Mux();
export const handler = async (event) => {
const livestream = await Video.LiveStreams.create({
playback_policy: "public",
@oieduardorabelo
oieduardorabelo / .env.example
Created February 24, 2021 05:11
Sample of Cognito with Server-Sider Authentication
PORT=xxx
COGNITO_USER_POOL_ID=xxx
COGNITO_CLIENT_ID=xxx
COOKIE_SESSION_SECRET=xxx
COOKIE_SESSION_NAME=xxx
AWS_REGION=xxx
AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=xxx
@dabit3
dabit3 / add-user-trigger.js
Last active November 7, 2022 10:17
Add a user to DynamoDB after signing up
var aws = require('aws-sdk')
var ddb = new aws.DynamoDB()
exports.handler = async (event, context) => {
let date = new Date()
if (event.request.userAttributes.sub) {
let params = {
Item: {
'id': {S: event.request.userAttributes.sub},
'__typename': {S: 'User'},
@denzildoyle
denzildoyle / SEO.md
Last active July 2, 2025 15:01
I short list of SEO tips and tricks I have learned over time

SEO

In this list, I will be typically be talking SEO as it relates to Google because Google will likely account for the vast majority of your inbound search traffic. Additionally, if you rank highly on Google, you will probably do well on other search engines anyway. Just like in football if you could play in the Major league you would most likely kill it in the minor league I would begin by explaining why SEO is important talk a little bit about what SEO is about and talk about how those concepts relate to the world wide web. Then talk about some of the things you could do to optimize your site from top to bottom of a typical webpage.

Why it's important

  • When you want to hide something on google put it on the second page. #SEO @searchdecoder
  • Winner takes almost everything
  • More than 80 percent of shoppers research big purchases online first
  • Opertunity for business
  • 88% Of Consumers Trust Online Reviews As Much As Personal Recommendations
  • 72% Of Consumers Say That Positive Reviews Make Them T
@wondger
wondger / new.js
Created August 20, 2012 16:05
express vhost
var express = require('express');
var s1 = require('./site1/app.js')
,s2 = require('./site2/app.js')
,s3 = require('./site3/app.js')
,s4 = require('./site4/app.js')
,s5 = require('./site5/app.js')
,s6 = require('./site6/app.js')