Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Mohammed Nisar Ansari niisar

🎯
Focusing
Block or report user

Report or block niisar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Git Commands.md

If you accidentally mistype a commit message, you can change it using git commit --amend - m "new message"

@niisar
niisar / sp-notes1.md
Last active Jan 28, 2019
Powershell Notes.ps
View sp-notes1.md

PowerShell

Set-executionpolicy restricted
Set-executionpolicy unrestricted
Get-process | where-object{$_.name –eq ‘w3wp’} 

Script 2

@niisar
niisar / Detect the position of an object - computer vision.md
Last active Jan 28, 2019
Detect the position of an object - computer vision.md
View Detect the position of an object - computer vision.md

Detect the position of an object - computer vision

Problem

Comparing two images: The observed position vs the required position.

Solution using (OpenCV-Python)

  1. Load your image and binarize it.
  2. Use cv2.findContours(thresh, 1, 2) to find the contour of interest object.
  3. Find the bounding rectangle using cv2.boundingRect(cnt) function.
View bot-note.md

Why bot framework

Developers writing bots all face the same problems:

  • Require I/O
  • Lang and Dialog Skill

REST API

You can create a bot with any programming language by using the Bot Framework REST API. There are three REST APIs in the Bot Framework:.

  • Bot Connector REST API : send and receive messages to channels configured in the Bot Framework Portal.
  • Bot State REST API : enables your bot to store and retrieve state.
@niisar
niisar / app-1.spec.ts
Created Aug 15, 2017 — forked from wkwiatek/app-1.spec.ts
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
View app-1.spec.ts
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
View UpdateOrderNo-Model.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Aps.ManageIT
{
public class UpdateOrderNo
{
public string ContentTypeId { get; set; }
View linkedin-connect-hack.js
jQuery('.search-result__actions--primary').each(function(index, value) {
setTimeout(function() {
if(value.innerText == 'Connect'){
jQuery(value).trigger('click');
jQuery('.button-primary-large').each(function(index, value) {
setTimeout(function() {
if(value.innerText == 'Send now'){
jQuery(value).trigger('click');
}
}, index * 1000);
@niisar
niisar / SessionExtensions.cs
Last active Jan 23, 2017
SessionExtensions in asp.net core 1.0
View SessionExtensions.cs
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
public static class SessionExtensions
{
public static void Set<T>(this ISession session, string key, T value)
{
session.SetString(key, JsonConvert.SerializeObject(value));
}
@niisar
niisar / 404.html
Created Jan 18, 2017
GitHub single-page app hack
View 404.html
<!doctype html>
<html>
<head>
<!-- This stores the URL the user was attempting to go to in sessionStorage,
and then redirects all 404 responses to the app’s index.html page -->
<!-- See http://www.backalleycoder.com/2016/05/13/sghpa-the-single-page-app-hack-for-github-pages/ -->
<script>
sessionStorage.redirect = location.href;
</script>
<meta http-equiv="refresh" content="0;URL='https://USERNAME.github.io/PROJECT_NAME'"></meta>
@niisar
niisar / find duplicate in JavaScript.js
Created Jan 2, 2017
find duplicate in JavaScript
View find duplicate in JavaScript.js
//this prototype function checks if an element is already in the array or not
//go through all the array and push the element to result if it is not
//this way we can eliminate duplicates
//result will contain the resultant array
Array.prototype.contains = function(k) {
for ( var p in this)
if (this[p] === k)
return true;
return false;
};
You can’t perform that action at this time.