Skip to content

Instantly share code, notes, and snippets.

View niisar's full-sized avatar
🎯
Focusing

Mohammed Nisar Ansari niisar

🎯
Focusing
View GitHub Profile
@niisar
niisar / Service1.cs
Created May 3, 2016 12:08
Windows Service
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Configuration;
using System.IO;
@niisar
niisar / WordtoHTML.cs
Created July 23, 2016 09:15
WordtoHTML
using DocumentFormat.OpenXml.Packaging;
using OpenXmlPowerTools;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Drawing.Imaging;
@niisar
niisar / web-scrapping_r.ipynb
Last active July 17, 2020 12:59
Web Scrapping_R.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@niisar
niisar / SessionExtensions.cs
Last active June 20, 2020 10:07
SessionExtensions in asp.net core 1.0
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 / gulp.config.js
Created February 21, 2016 11:42
sass
module.exports = function(){
var client = './src/client/';
var config = {
temp: './.tmp/',
sass : client + 'styles/style.scss'
};
return config;
};
@niisar
niisar / Git Commands.md
Created January 31, 2019 13:23
Git Helper

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

@niisar
niisar / Detect the position of an object - computer vision.md
Last active January 28, 2019 09:20
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.
@niisar
niisar / Delete FILESTREAM data.sql
Created April 24, 2016 16:11
Delete FILESTREAM data
-- Delete row #1
DELETE FROM PhotoAlbum WHERE PhotoId = 1
SELECT * FROM PhotoAlbum
-- Forcing garbage collection won't delete the file without a BACKUP if using FULL recovery model
EXEC sp_filestream_force_garbage_collection
-- Switch from FULL to SIMPLE recovery model
SELECT name, recovery_model_desc FROM sys.databases WHERE name = 'PhotoLibrary'
ALTER DATABASE PhotoLibrary SET RECOVERY SIMPLE
@niisar
niisar / Make a sync call using qjs.js
Created November 16, 2016 09:41
Make a sync call using q.js
// http://cdnjs.cloudflare.com/ajax/libs/q.js/0.9.6/q.js
function doSomethingAsync(item) {
return Q.promise(function(resolve) {
$("#results").append("<div>" + item + "</div>");
setTimeout(resolve.bind(null, item), 3000);
});
}
function doAsyncSeries(arr) {
return arr.reduce(function (promise, item) {
@niisar
niisar / bot-note.md
Last active September 2, 2017 05:19
bot's Note

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.