Skip to content

Instantly share code, notes, and snippets.

View jstefanelli's full-sized avatar

Giovanni "John" Stefanelli jstefanelli

View GitHub Profile
@jstefanelli
jstefanelli / simple_json.hpp
Last active February 25, 2025 16:52
Super Primitive, header-only (almost), no-dependency, C++ JSON output "thing"
#pragma once
#include <variant>
#include <string>
#include <vector>
#include <unordered_map>
namespace json {
inline std::string util_replace(std::string haystack, const std::string_view& needle, const std::string_view& replaced_data) {
@jstefanelli
jstefanelli / queue.h
Last active January 17, 2024 01:12
Nth try of some lock free coding - bounded lock-free queue with rudimentary test attached
#ifndef CONCURRENCY_EXPERIMENT_QUEUE_H
#define CONCURRENCY_EXPERIMENT_QUEUE_H
#include <vector>
#include <atomic>
#include <optional>
struct queue_idx {
union {
uint64_t compound;
struct {
@jstefanelli
jstefanelli / QueueTest.cpp
Created August 24, 2021 19:51
Proof-of-concept lock-free(?) Queue in C++
#include <thread>
#include <vector>
#include <atomic>
#include <memory>
#include <iostream>
#include <sstream>
template<typename T>
struct Concurrent_Queue_t {
protected:
@jstefanelli
jstefanelli / SampleTask.java
Created February 1, 2021 16:08
A simple task (with subtasks) implemented in my custom TPL
Task<Boolean> maintask = new Task<Boolean>(myContext) {
int internalState = 0;
@Override
public AwaitableState work() {
switch(internalState){
case 0:
return Work0();
case 1:
return Work1();
#!/bin/bash
gcc main.c -o main
for i in {0..3}
do
if [ $("cat input${i}.txt | ./main") != $("cat output${i}.txt") ] then
echo "Error for file: ${i}\n"
exit
fi
@jstefanelli
jstefanelli / ffprobe_bbb_30mb_720p.txt
Created September 14, 2018 06:59
FFProbe output test video and reference video
.\ffprobe.exe : ffprobe version 4.0.2 Copyright (c) 2007-2018 the FFmpeg developers
At line:1 char:1
+ .\ffprobe.exe .\bbb_30mb_720p.mp4 2> ffprobe_bbb.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ffprobe version...mpeg developers:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
built with gcc 7.3.1 (GCC) 20180722
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
namespace libdiscordovr.Discord.ResponseTypes
{
[DataContract]
public class Channel
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Net;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.Serialization.Json;
import java.util.*;
public class Sommatore{
public class Somma{
public int a, b, result;
public Somma(int a, int b){
this.a = a;
this.b = b;
result = 0;