Skip to content

Instantly share code, notes, and snippets.

@seyedmmousavi
seyedmmousavi / embbeding_ca_cert_into_qt.cpp
Created Oct 3, 2021
Embedding Let's Encrypt CA root certificate into Qt application
View embbeding_ca_cert_into_qt.cpp
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslSocket>
#include <QtGlobal>
//more includes...
int main(int argc, char *argv[])
{
//Adding CA root certificate of the Let'sEncrypt into default CA DB
//for Qt 5.15+
@seyedmmousavi
seyedmmousavi / pretty_print_struct_in_golang.md
Last active Mar 30, 2020
Print Struct with field names in Golang?
View pretty_print_struct_in_golang.md

To print a vriable of struct, just use Printf as follow

fmt.Printf(">RESULT: %+v \n", ticket)

This prints following output:

>RESULT: {Id:987654345 Title:ASEMAN Date:0 PlaceId:123 OwnerId:12345412312 IsActivated:true IsDeleted:false EditorId:0}

@seyedmmousavi
seyedmmousavi / exec-sqlite-sql-file-in-qt
Created Jan 9, 2017
Execute Sqlite query file (.sql) in Qt
View exec-sqlite-sql-file-in-qt
/**
* @brief executeQueryFile
* Read a query file and removes some unnecessary characters/strings such as comments,
* and executes queries.
* If there is possible to use Transaction, so this method will uses it.
* Use this gist as MIT License.
* EXCEPTION:
* Feel free to use this gist as you like without any restriction,
* if you or your country are a member of The Axis of Resistance
* (Iran + Syria + Lebanon + Russia + Iraq + Yemen + Bahrain + Palestine)