Skip to content

Instantly share code, notes, and snippets.

View mazhar266's full-sized avatar
💭
I may be slow to respond.

Mazhar Ahmed mazhar266

💭
I may be slow to respond.
View GitHub Profile
@mazhar266
mazhar266 / web.config
Created August 16, 2023 07:37
Rewrite in Azure Web Services
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SPA">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(docs)" negate="true" />
@mazhar266
mazhar266 / morse.pl
Last active July 30, 2020 11:27
Morse Code Conversion
#!/usr/bin/perl -w
# check if the domain name is passed or not
if (!$ARGV [0]) {
print "String is needed\n";
die ();
}
# morse code list
my %letters;
@mazhar266
mazhar266 / moon.py
Created February 20, 2020 16:20
Animation in shell
import time
import sys
animation = "🌕🌖🌗🌘🌑🌒🌓🌔"
for i in range(100):
time.sleep(0.1)
sys.stdout.write("\r" + animation[i % len(animation)])
sys.stdout.flush()
@mazhar266
mazhar266 / send_mail.php
Last active February 10, 2020 10:33
SMTP Mail Send Example
<?php
require('vendor/autoload.php');
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
@mazhar266
mazhar266 / phonetic.pl
Created January 30, 2020 05:53
Phonetic Conversion (modified by TicketChai)
#!/usr/bin/perl -w
# check if the domain name is passed or not
if (!$ARGV [0]) {
print "String is needed\n";
die ();
}
# Sabre + Mr Mahabubur + Me Phonetic talks
my %letters;
@mazhar266
mazhar266 / app.py
Created January 20, 2020 11:06
Bongo Bondhu Framework Idea
from flask import Flask as bongo_bondhu
# make alias
bongo_bondhu.joy_bangla = bongo_bondhu.run
neta = bongo_bondhu(__name__)
@neta.route('/')
def index():
return f'এবারের সংগ্রাম, মুক্তির সংগ্রাম'
@mazhar266
mazhar266 / buildspec.yml
Last active November 20, 2019 06:54
AWS CodeDeploy buildspec.yml for auto deploying AWS ECS from AWS ECR via AWS CodePipeline
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
build:
commands:
- REPOSITORY_URI=$(cat imageDetail.json | python -c "import sys, json; print(json.load(sys.stdin)['ImageURI'].split('@')[0])")
- IMAGE_TAG=$(cat imageDetail.json | python -c "import sys, json; print(json.load(sys.stdin)['ImageTags'][0])")
@mazhar266
mazhar266 / bucket-policy.json
Created November 20, 2019 04:47
Making a AWS S3 Bucket Public
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicRead",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::bucket-name/*"]
}
@mazhar266
mazhar266 / README.md
Created October 23, 2019 04:29
Smallest Spring Framework Web Service

Requirements

  • JDK
  • Spring CLI

How to run

  • spring run ThisWillActuallyRun.groovy
@mazhar266
mazhar266 / WebRTC.md
Created April 25, 2019 15:06
WebRTC Video Chat Procedure

WebRTC Video Chat Procedure Now that we have Firebase set up, let’s talk a little about how WebRTC can be used to set up a video chat. Say we have two computers, yours and your friend’s. Here is the step-by-step procedure needed to make the video chat work. (Note that I bolded words that sound strange, but are actually just JavaScript objects in JSON. I’ll give you examples of each right after these steps.)

  1. Display a MediaStream video of yourself on your computer
  2. Display a MediaStream video of your friend on his computer
  3. Create a PeerConnection on your computer
  4. Create a PeerConnection on your friend’s computer
  5. Create an Offer on your computer
  6. Add that Offer to the PeerConnection on your computer
  7. Send that Offer to your friend’s computer