Skip to content

Instantly share code, notes, and snippets.

View iamazeem's full-sized avatar
:octocat:

Azeem iamazeem

:octocat:
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>fp_Ben-Doherty</title>
</head>
<body>
<style type="text/css">
@page{size: 319.83594508009156mm 235.36mm;}
body {
@iamazeem
iamazeem / log.proto
Created June 9, 2020 14:41
ProtoBuf Schema and Ruby Script for Generating Messages Samples (Binary and JSON)
syntax = "proto3";
package service.logging;
import "google/protobuf/timestamp.proto";
message Log {
message Context {
google.protobuf.Timestamp timestamp = 1;
string host_or_ip = 2;
@iamazeem
iamazeem / qt_urls_organization.cpp
Created February 3, 2020 06:18
Qt URL Organization
// Ref: https://stackoverflow.com/questions/60023890/organize-all-urls-in-one-place-inside-a-class
#include <QDebug>
#include <QString>
#include <QUrl>
namespace url {
static constexpr auto default_ip = "localhost";
static constexpr auto default_port = "8080";
@iamazeem
iamazeem / find_nearest.cpp
Created February 2, 2020 17:16
Find nearest value to the given index
// Ref: https://stackoverflow.com/questions/60023221/finding-the-closest-true-value-for-an-index
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <limits>
using Result = std::tuple<bool, std::size_t, std::string>; // result (T/F), index, message
Result find_nearest( const std::vector<int>& v, const std::size_t index, const int value )
// https://stackoverflow.com/a/51587626/7670262
#include <QDebug>
#include <QtConcurrent>
#include <QFuture>
#include <QThread>
#define LOG() qDebug() << __func__ << ": "
void test()
#include <iostream>
#include <future>
#include <thread>
#include <chrono>
#define LOG() std::cout << __func__ << " : "
void test()
{
LOG() << "IN\n";
// https://stackoverflow.com/a/51889159/7670262
#include <iterator>
#include <iostream>
struct data
{
data() = default;
int num1 = 0;
int num2 = 0;
// https://stackoverflow.com/a/44558860/7670262
/*
Directory structure:
C:\Test
-- A
---- a.txt
-- B
---- b.tx
// https://stackoverflow.com/a/55187379/7670262
#include <QDebug>
#include <QMap>
#include <QMapIterator>
#include <QString>
int main()
{
using InnerMap = QMap<int, QString>;
@iamazeem
iamazeem / self_delete.cpp
Created April 19, 2019 06:08
Qt: Run self-deleting .BAT file using QProcess (https://stackoverflow.com/a/51742823/7670262)
// https://stackoverflow.com/a/51742823/7670262
#include <QProcess>
int main()
{
QProcess process;
process.setProgram( "cmd.exe" );
process.setArguments( { "/C", R"(E:\deleteme.bat)" } );
process.setWorkingDirectory( R"(E:\)" );