Skip to content

Instantly share code, notes, and snippets.

View leogout's full-sized avatar

Léo Richard leogout

  • France
View GitHub Profile
@leogout
leogout / Fetcher.cpp
Created January 5, 2019 10:22
A gist that simplifies fetching data with Qt5.12 with a JavaScript flavor.
#include <QtNetwork/QNetworkReply>
#include <iostream>
#include "Fetcher.h"
void Fetcher::get(QString url, std::function<void(QNetworkReply *)> callback) {
int id = m_id++;
QNetworkReply *reply = m_nam.get(QNetworkRequest(QUrl(url)));
m_replies.insert(id, reply);
connect(reply, &QNetworkReply::finished, this, [&, id, callback]() {
@leogout
leogout / cifar10_converter
Created August 21, 2017 14:31
Converts cifar-10 numpy lists to python lists
import pickle
def unpickle(file):
with open(file, 'rb') as fo:
dic = pickle.load(fo, encoding='bytes')
fo.close()
return dic