Skip to content

Instantly share code, notes, and snippets.

View SuperKogito's full-sized avatar

Ayoub Malek SuperKogito

View GitHub Profile
var chmod_dict = {
"r": 4,
"w": 2,
"x": 1,
"rwx": "7",
"rw-": "6",
"r-x": "5",
"r--": "4",
"-wx": "3",
"-w-": "2",
#include <Windows.h>
#include <minmax.h>
#include <gdiplus.h>
#include <SDKDDKVer.h>
#pragma comment(lib,"gdiplus.lib")
#include "atlimage.h"
bool saveToMemory(Gdiplus::Bitmap* tile, std::vector<BYTE>& data, std::string dataFormat)
{
@SuperKogito
SuperKogito / DivideImageUsingOpenCv.cpp
Last active October 1, 2020 21:03
code for my blog post <https://superkogito.github.io/blog/DivideImageUsingOpenCv.html> a snippet for dividing image into blocks
/***********************************************************************
* \file DivideImageUsingOpenCv.cpp
* \brief divide image into multiple blocks using OpenCV.
*
* \author SuperKogito
* \date October 2020
*
* @note:
* references and sources:
* - https://answers.opencv.org/question/53694/divide-an-image-into-lower-regions/
@SuperKogito
SuperKogito / CaptureSceenshotUsingGdiplusVSCaptureSceenshotUsingOpenCV.cpp
Last active June 2, 2022 05:11
A quick comparison between the speed of a screen capture using GDI+ (gdiplus) and another using OpenCV.
/***********************************************************************
* \file CaptureSceenshotUsingGdiplusVSCaptureSceenshotUsingOpenCV.cpp
* \brief capture screenshot using GDI+ and save it to drive or memory.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
*
@SuperKogito
SuperKogito / CaptureMonitorsRects.cpp
Last active June 20, 2022 11:42
A small snippet displaying how to get the rectangles structures (coordinates) associated with all the connected screens/monitors.
/*********************************************************************
* \file CaptureMonitorsRects.cpp
* \brief capture monitors rectangles handles in a custom structure.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
*
@SuperKogito
SuperKogito / CaptureScreenUsingGdiplus.cpp
Last active March 17, 2024 11:57
Code for my blog post <https://superkogito.github.io/blog/CaptureScreenUsingGdiplus.html> A snippet for capturing the screen content using GDI+ (gdiplus)
/*******************************************************************************************
* \file CaptureSceenshotUsingGdiplus.cpp
* \brief capture screenshot using GDI+ and save it to drive or memory.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
* - https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-gdi-start
@SuperKogito
SuperKogito / CaptureSceenshotUsingOpenCV.cpp
Last active November 10, 2023 09:08
Code for my blog post <https://superkogito.github.io/blog/CaptureScreenUsingOpenCv.html> A snippet for capturing the screen content using OpenCV
/*****************************************************************************************************************
* \file CaptureSceenshotUsingOpenCV.cpp
* \brief capture screenshot using OpenCV and save it as a png.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
* - http://msdn.microsoft.com/en-us/library/windows/window/dd183402%28v=vs.85%29.aspx
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
from pylab import rcParams
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn import neighbors, datasets
from matplotlib.colors import ListedColormap
from sklearn.neighbors import KNeighborsClassifier
@SuperKogito
SuperKogito / ffmpeg.md
Created October 1, 2018 08:55 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz: