Skip to content

Instantly share code, notes, and snippets.

View bangonkali's full-sized avatar
🏠
Working from home

Bangon Kali bangonkali

🏠
Working from home
View GitHub Profile
@bangonkali
bangonkali / main.md
Last active December 17, 2017 17:03
Azure functions

Notes on Azure functions

Installing the CLI

npm i -g azure-functions-core-tools@core

Creating the Template

@bangonkali
bangonkali / dispatchqueue.swift
Created February 18, 2017 21:00
Simple Dispatch Queue
DispatchQueue.global(qos: .background).async {
var x:Int = 0
while (x < Int.max){
x+=1
var y:Int = 0
while (y < Int.max){
y+=1
if (y % 10000 == 0){
DispatchQueue.main.async {
self.numbers.text = "value x:\(x) y:\(y)}"
@bangonkali
bangonkali / gis.sql
Last active December 21, 2016 11:14
Some notes on PostGis
-- Creates the table
CREATE TABLE geom_points (
id_pk INTEGER PRIMARY KEY
);
-- Adds the columns
SELECT AddGeometryColumn('geom_points','coordinates','4326','POINT',2); -- (long, lat)
-- Inserts the Latitude and Longitude from Geography to Geometry. (long, lat)
INSERT INTO geom_points(id_pk, coordinates)
@bangonkali
bangonkali / GeoCoordinate.cs
Last active December 2, 2016 21:22
Gets the distance between two latitude and longitude points.
// http://www.geodatasource.com/developers/c-sharp
using System;
namespace <your_namespace>
{
public class GeoCoordinate
{
public double Latitude { get; set; }
@bangonkali
bangonkali / notes.cs
Created October 29, 2016 18:27
Classic Eager loading for entity framework.
// GET api/values
[HttpGet, Route("branches")]
public IActionResult Branches()
{
//_context.Regions.Where(u=>u.Business.BusinessId == )
var regions = _context.Regions
.Include(x => x.Branches)
.Include(x => x.Business)
.ToList();
@bangonkali
bangonkali / gist:50c2ccd252134e5e88f8aba7eaeb5eca
Created October 25, 2016 18:45
MySQL Config Files MacOSX Sierra
/usr/local/mysql/support-files
@bangonkali
bangonkali / stringreplace.md
Created August 18, 2016 11:04
Powershell script for string replace on Windows.

Replacement to another file.

cat DATA.TXT | % { $_ -replace "Mary","Susan" } > newfile.txt

Same file.

cat DATA.TXT | % { $_ -replace "Mary","Susan" }
@bangonkali
bangonkali / symlink.sh
Created August 9, 2016 15:03
Creating a symlink for visual studio code on mac os x el capitan
#include <Arduino_FreeRTOS.h>
#include <semphr.h> // add the FreeRTOS functions for Semaphores (or Flags).
#include <LiquidCrystal.h>
#include "pitches.h"
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// Declare a mutex Semaphore Handle which we will use to manage the Serial Port.
// It will be used to ensure only only one Task is accessing this resource at any time.
SemaphoreHandle_t xSerialSemaphore;
import cv2
import numpy as np
import matplotlib.pyplot as plt
# Load the data, converters convert the letter to a number
data= np.loadtxt("D:\OpenCV\opencv\sources\samples\data\letter-recognition.data", dtype= 'float32', delimiter = ',',
converters= {0: lambda ch: ord(ch)-ord('A')})
# split the data to two, 10000 each for train and test
train, test = np.vsplit(data,2)