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
# HTTP Server
server {
listen 0.0.0.0:80;
server_name edu.acomsys.net;
server_name_in_redirect off;
root /var/www/edu.acomsys.net;
index index.php index.html index.htm;
access_log /var/log/nginx/edu.acomsys.net.access;
/* CSS declarations go here */
body {
font-family: sans-serif;
background-color: #315481;
background-image: linear-gradient(to bottom, #315481, #918e82 100%);
background-attachment: fixed;
position: absolute;
top: 0;
bottom: 0;
@bangonkali
bangonkali / dev
Last active October 7, 2018 19:39
SIMD
gcc -O2 -std=c99 -msse -lrt -lm test.c -otest
sudo apt-get install linux-headers-$(uname -r) build-essential
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)
#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;
@bangonkali
bangonkali / symlink.sh
Created August 9, 2016 15:03
Creating a symlink for visual studio code on mac os x el capitan
@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 / gist:50c2ccd252134e5e88f8aba7eaeb5eca
Created October 25, 2016 18:45
MySQL Config Files MacOSX Sierra
/usr/local/mysql/support-files
@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 / 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; }