Skip to content

Instantly share code, notes, and snippets.

View jochumdev's full-sized avatar

René Jochum jochumdev

View GitHub Profile
@jochumdev
jochumdev / how-to-use-golang-framer.go
Last active October 8, 2022 12:48 — forked from ilyaigpetrov/how-to-use-golang-framer.go
How To Use Golang Framer?
// This is based on https://github.com/nghttp2/nghttp2/blob/master/integration-tests/server_tester.go
package main
import (
"bytes"
"crypto/tls"
"errors"
"fmt"
"log"
"net"
Code Name HTTP Mapping
0 OK 200 OK
1 CANCELLED 499 Client Closed Request
2 UNKNOWN 500 Internal Server Error
3 INVALID_ARGUMENT 400 Bad Request
4 DEADLINE_EXCEEDED 504 Gateway Timeout
5 NOT_FOUND 404 Not Found
6 ALREADY_EXISTS 409 Conflict
7 PERMISSION_DENIED 403 Forbidden
@Qix-
Qix- / coro.cpp
Created September 29, 2020 04:16
C++20 coroutines + LibUV sample, v2
// Thank you to the folks at the C++ slack channel,
// along with @lewissbaker for the excellent literature
// (even though it took me a few days to be convinced
// it really was so).
#include <uv.h>
#include <iostream>
#include <experimental/coroutine>
@looopTools
looopTools / Read File to std::vector<uint8_t> in C++
Created February 1, 2019 13:33
How to read a file from disk to std::vector<uint8_t> in C++
inline std::vector<uint8_t> read_vector_from_disk(std::string file_path)
{
std::ifstream instream(file_path, std::ios::in | std::ios::binary);
std::vector<uint8_t> data((std::istreambuf_iterator<char>(instream)), std::istreambuf_iterator<char>());
return data;
}
@miguelmota
miguelmota / uint8_to_hex.cpp
Last active August 16, 2024 13:02
C++ uint8_t to hex string
#include <sstream>
#include <iostream>
#include <iomanip>
std::string uint8_to_hex_string(const uint8_t *v, const size_t s) {
std::stringstream ss;
ss << std::hex << std::setfill('0');
for (int i = 0; i < s; i++) {
import QtQuick 2.9
import QtQuick.Controls 2.2
Column {
width: parent.width
height: parent.height
property alias model: columnRepeater.model
ListView {
@ejahandar
ejahandar / IteratorBenchmark.cpp
Created March 14, 2018 17:49
A Benchmark for Qt's Vector/List/Map iterators vs simple arrays
#include <QDateTime>
#include <QMap>
#include <QVector>
#include <QList>
#include <QDebug>
#define SIZE 10000000
int array[SIZE];
int main(){
@lsv
lsv / README.md
Last active May 4, 2024 17:05
KNP Menu Bundle - Bootstrap 4 and Font Awesome 4
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
anonymous
anonymous / Accordion.qml
Created January 29, 2016 01:14
import QtQuick 2.4
Column {
width: parent.width
height: parent.height
property alias model: columnRepeater.model
Repeater {
id: columnRepeater