This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hidapi.h> | |
#include <stdio.h> | |
int main() { | |
hid_init(); | |
hid_device *handle = hid_open(0x17cc, 0x1750, NULL); | |
// Disable local controls | |
unsigned char buf1[3] = {0xa0, 0x03, 0x04}; | |
hid_write(handle, buf1, 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <string> | |
typedef uint8_t u8; | |
typedef uint16_t u16; | |
typedef uint32_t u32; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 as cv | |
import numpy as np | |
img = cv.imread('IMG_2024.jpeg') | |
# Segmentation | |
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV) | |
h = hsv[:,:,0] | |
s = hsv[:,:,1] | |
v = hsv[:,:,2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs").promises; | |
const FileWriter = require("wav").FileWriter; | |
const muLawDecompressTable = [ | |
32124, | |
31100, | |
30076, | |
29052, | |
28028, | |
27004, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class CircBuffer<T> { | |
data: (T | null)[]; | |
start: number = 0; | |
end: number = 0; | |
data_inside: number = 0; | |
constructor(public size: number) { | |
this.data = new Array(size).fill(null); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
// | |
// interface Animale | |
// | |
typedef struct Animale { | |
void (*faiVerso)(); | |
} Animale; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, PropsWithChildren, useState } from "react"; | |
import { makeStyles } from "@material-ui/core/styles"; | |
import useComponentSize from "@rehooks/component-size"; | |
// USAGE: | |
// const svgWrapperProps = useSvgWrapperProps(); | |
// return ( | |
// <SvgWrapper {...svgWrapperProps}> | |
// ... | |
// </SvgWrapper> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct Object Object; | |
typedef struct MethodChain { | |
const char* selector; | |
Object* (*handler)(Object* self); | |
struct MethodChain* next; | |
} MethodChain; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename Array, typename Predicate> | |
auto filterArray(Array arr, Predicate p) { | |
using arrElemType = typename std::remove_reference<decltype(arr[0])>::type; | |
auto result = std::vector<arrElemType>(); | |
for (const auto el : arr) { | |
if (p(el)) result.push_back(el); | |
} | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
/* | |
A simple SDL2-based framebuffer for graphics programming. | |
(Giulio Zausa, 2019) | |
Usage: | |
auto wnd = BufferWindow<WIDTH, HEIGHT>(); | |
auto time = 0.0; |
NewerOlder