Skip to content

Instantly share code, notes, and snippets.

View emadehsan's full-sized avatar
🤸‍♂️
Overthinking about overthinking

Emad Ehsan emadehsan

🤸‍♂️
Overthinking about overthinking
View GitHub Profile
@emadehsan
emadehsan / Why-Java-First.md
Last active April 30, 2017 17:48
Advantages of Learning Java as First Programming Language

Why Learn Java as First Programming Language

Here I've tried to make my case on why should you start your Software Engineering Journey with Java. Java

Java is All Rounder

Java is Mobile

You can develop anything for Android the most widely used Operating System.

Java is Web

Start with:
Create a file `index.html` and paste the following code
```
<!doctype html>
<html>
<head>
<title>Chat Room</title>
</head>
@emadehsan
emadehsan / Screen Unix Cheat Sheet.md
Created April 18, 2018 11:52
Screen Linux/Unix command cheat sheet

Install Screen

$ sudo apt install screen

Enter a new Screen Session

$ screen

Detach from current screen session

# this is a comment
s = 'Quick brown fox jumps over lazy white dog'
scount = 0
for c in s :
if c == 'a' or c == 'o' or c == 'u' or c == 'i' or c == 'e':
# "count" in the following line is being used for the first time. It is one level deep i.e. inside the loop. So its value will not be available outside the loop.
# count += 1
@emadehsan
emadehsan / HowTo.md
Created October 4, 2018 06:41
Video.js Quality Selection with DASH (+HLS)

Radek has provided good example code that we would use.

  1. Include these libraries in the <head>
<!-- VideoJs CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.2.4/alt/video-js-cdn.min.css" />

<!-- Necessary libs. Video.js 7, Contrib Quality Levels, Jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.2.4/video.min.js"></script>
@emadehsan
emadehsan / Test.md
Last active August 14, 2019 13:02
Automatically set cookie in Postman

In the Tests tab of your request, type this code

let cookie = postman.getResponseHeader("Set-Cookie");
postman.setEnvironmentVariable("cookie", cookie);

This will set an environment vairable. In all the requests that need cookie, add to the Request Header

Key: Cookie

async function takePhoto(quality) {
// create html elements
const div = document.createElement('div');
const video = document.createElement('video');
video.style.display = 'block';
// request the stream. This will ask for Permission to access
// a connected Camera/Webcam
const stream = await navigator.mediaDevices.getUserMedia({video: true});
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
# Root directory of the project
# Create model object in inference mode.
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)
# Load weights trained on MS-COCO
model.load_weights(COCO_MODEL_PATH, by_name=True)
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
# Run detection
results = model.detect([image], verbose=1)
# Visualize results
r = results[0]
visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'],