Skip to content

Instantly share code, notes, and snippets.

View okayshankha's full-sized avatar
🎯
Focusing

Shankhadeep Das okayshankha

🎯
Focusing
View GitHub Profile
/**
* Read the blog post here, for better under standing,
* https://computopedia.com/how-to-convert-image-to-binary-nodejs
*/
const getBinary = async (params = undefined) => {
/**
* @auther: Shankha
* @date: 26 Apr, 2020
*/
const getBinary = async (params = undefined) => {
/**
* @auther: Shankha
* @date: 26 Apr, 2020
*/
// params format:
// getBinary({
// path : '<file_relative_path>',
// padlength: '<prepending_padding_length>', (Default: 4)
import { Injectable } from '@angular/core';
import { endpoints } from './endpoints';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class ApiService {
constructor(private http: HttpClient) { }
import { environment } from 'src/environments/environment'
export const endpoints = {
request: {
GetAuthToken: {
method: 'post',
url: '/oauth/token',
token: {
is_needed: true,
type: 'Basic'
@okayshankha
okayshankha / config.php
Last active March 7, 2021 08:06
To Store Pictures in MySQL
<?php
// DATABASE SETTINGS // CHANGE THESE TO YOUR OWN !!
define('DB_HOST', 'localhost');
define('DB_NAME', 'computopedia_test_db');
define('DB_CHARSET', 'utf8');
define('DB_USER', 'computopedia');
define('DB_PASSWORD', '');
?>
Selector:= white
Foreach black tile b
do h(b):= tile-distance to the first white tile to its right
Foreach white tile w
do h(w):= tile-distance to the first black tile to its left * -1
While any tile has a non-zero h value
Do
If selector:= white then,
Select the while-tile with the highest h value, say X