Skip to content

Instantly share code, notes, and snippets.

View adventurist's full-sized avatar

Emmanuel Buckshi adventurist

View GitHub Profile
@adventurist
adventurist / History|-10055542|entries.json
Last active November 17, 2024 03:03
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///data/logicp/logicp_writings/collectivist_theology/Left-Right_paradigm.md","entries":[{"id":"MHL0.md","source":"textFileCreate.source","timestamp":1714096466144},{"id":"LOQl.md","timestamp":1714096529287},{"id":"JqZP.md","timestamp":1714096564371},{"id":"Tye6.md","timestamp":1714096663423},{"id":"GTmF.md","timestamp":1714352670855}]}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaNncWKl0DgrxvquFeMklwzOKWw/iaOed6CUOtAE5YsttNJrnuuWs85tnW1tc20XOv+mHKaTYryvOeJGICW8c3C70G8u9bNPVE+uzVRoWTTPVhBMSe+OKx8TJK+DXR8D9PR0ds5OxiaPinNNOhJLE497mKF8qE5U6abaC0ZcE/cxaZgRXZ0Bej0uXXfi+H9s+tiJhcY1qqFePlrnrb1rLnLMYAb9mqZdjl8NEmYcG54uCNxKoCky6eAVellVSSjXUs962FUzWz2aD6Scem7fJYag3rok9a83/O8+G8YEaWdKDEeUzcydPA0WwpR4nHa4/bCXqJUQd5mlwA9H54pTqX ubuntu@ubuntu
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDm6aMLFx4O/i3+XzHFjO0dSwcgtPH8yIkGKcRiSQO0gKHZTmY7V9g0+0tgtCfxd6QCoZ07UfbjGz29cxrJXgZqDnlxT9Qbmym8ZpUkyF1DBoizqkyWK7gVuzVjBqnssygwNpGumH4HOVUc0G4eGUK4VCh5Q+RUZvnfuHYe+Rsj7amWBeUOSvrxFwqczfJhaCFiPD1udxIE2CdRLUtwUNBN73omHAwdAO0QfFf0UK/g8RU8R4Qtc3TyKfns/nayWoagqTy27IXlMnIUeVqZqKNd9XrLH9/3F7ICnAx+84ijqc90ujjJiW622BJALoJHyCB3OZuzJtfeRSt1+antvn1F Emmanuel@Developer2
@adventurist
adventurist / concurrent_calls.cpp
Last active August 30, 2019 01:48
Get max concurrent calls from array of tuples
#include <algorithm>
#include <iostream>
#include <tuple>
#include <vector>
// Simplify tuple of doubles to `sipcall` type
typedef std::tuple<double, double> sipcall;
/**
* Returns the maximum number of concurrent calls from a vector of sipcall values
qmake -o Makefile ky_gui.pro -spec linux-g++ QMAKE_CXXFLAGS_DEBUG+=-std=gnu++1z CONFIG+=debug CONFIG+=qml_debug
make VERBOSE=1 -j8
g++ -c -pipe -g -std=gnu++1z -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_DESIGNER_LIB -DQT_UIPLUGIN_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtDesigner -isystem /usr/include/x86_64-linux-gnu/qt5/QtUiPlugin -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtXml -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o client.o src/client.cpp
In file included from src/client.cpp:17:
./headers/kmessage_codec.hpp:14:8: error: use of enum 'FlatBuffersVTableOffset' without previous declaration
14 | enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
#include <cstdio>
#include <type_traits>
#include <utility>
#define First(x) std::get<0>(x)
#define Second(x) std::get<1>(x)
template <typename T>
class GeoCoordinate {
typedef std::pair<T, T> CoordPair;
@adventurist
adventurist / button_led.c
Last active April 7, 2020 04:21
Arduino circuit with tactile button and 10kohm resistor to control build-in LED
#include <avr/io.h>
#include <stdio.h>
#include <util/delay.h>
int main(void) {
DDRB = 0xFF; // set all pins on PORTB to output
DDRD &= ~(1 << 1); // set pin 2 on PORTD to input
for (;;) {
if ((PIND & (1 << 1))) { // if 2nd bit set on PIND
PORTB |= (1 << 5); // turn on LED
@adventurist
adventurist / decoder.cpp
Created July 7, 2020 18:51
Decoder returns vector (cpp)
#include <memory>
#include <vector>
class Decoder {
public:
Decoder() { buffer.reserve(4990);}
std::vector<unsigned char> decode(unsigned char* data, uint32_t size) {
if (size == 10) {
buffer.insert(buffer.end(), data, data + size);
@adventurist
adventurist / decoder.asm
Created July 7, 2020 18:53
Decoder returns vector (asm)
Decoder::Decoder() [base object constructor]:
push rbp
push rbx
mov rbx, rdi
sub rsp, 24
mov QWORD PTR [rdi], 0
mov QWORD PTR [rdi+8], 0
mov QWORD PTR [rdi+16], 0
mov edi, 4990
call operator new(unsigned long)
@adventurist
adventurist / decoder.cpp
Created July 7, 2020 18:54
Decoder shared_ptr (cpp)
#include <memory>
#include <vector>
class Decoder {
public:
void init(std::shared_ptr<std::vector<unsigned char>> s_buffer) {
buffer = s_buffer;
}
void decode(unsigned char* data, uint32_t size) {