(keep in mind that JNI methods get a JNIEnv *
, not a direct JNIEnv
)
given JNIEnv x
, you can write ((void**)x)[N]
to access a function pointer, where N is:
4 GetVersion
5 DefineClass
6 FindClass
open import Level using (suc; _⊔_) | |
open import Function using (id; _∘_) | |
open import Data.List as List using ( | |
List; []; _∷_; [_]; map; reverse; align; alignWith; foldr; head; last; drop; length | |
) | |
import Data.List.Properties as List | |
import Data.List.Relation.Unary.All as All | |
import Data.List.Relation.Binary.Pointwise as PW |
import java.awt.*; | |
import java.awt.datatransfer.*; | |
import java.awt.image.*; | |
import java.io.*; | |
public class Main { | |
public static void main(String[] arg) { | |
var flavorMap = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap(); | |
System.out.println("formats for image flavor: "); | |
for (var format : flavorMap.getNativesForFlavor(DataFlavor.imageFlavor)) |
use std::{ops::{Add, AddAssign}, convert::TryInto}; | |
/// In-place unstable radix sort with sentinel | |
/// | |
/// - `L` is the type used for bin counts (must be able to hold `arr.len()`). | |
/// - `key: F` is a function taking an array item + a level, and returning an alphabet symbol. | |
/// - `AL` is the alphabet length, i.e. number of bins. it must hold that `key(...) < AL`. | |
/// | |
/// 0 is the sentinel, meaning that for any item, `key(item, max_level) == 0`. | |
/// `max_level` may differ among items. |
''' | |
Reads the contents of a TCP stream carrying [one side of] an | |
RTMP connection, and blindly dumps streams above 0 in an FLV. | |
$ ./rtmp2flv.py < tcp-stream > video.flv | |
''' | |
from enum import IntEnum, unique | |
from dataclasses import dataclass, field | |
from typing import NamedTuple, Self, Optional |
// compile with: clang -Wpedantic -Wall -Wextra $(pkg-config --cflags libpcap) sllv2tosll.c $(pkg-config --libs libpcap) -o sllv2tossl | |
#include <errno.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <pcap/pcap.h> | |
char error_buffer[PCAP_ERRBUF_SIZE]; |
{-# LANGUAGE TupleSections #-} | |
import Data.Array (accumArray, listArray, elems) | |
import Data.List.Extra (findIndices, groupSortOn, chunksOf) | |
import Data.Vector ((!), toList) | |
import Control.Monad (forM_, when, zipWithM) | |
import qualified Data.Vector as Vec | |
import qualified Data.Vector.Mutable as MVec | |
fill v = zipWithM (MVec.write v) [0..MVec.length v - 1] |
use std::{mem, ptr}; | |
use crate::BufferAlloc; | |
unsafe fn write_ptr(n: *mut usize, ptr: Option<*mut usize>) { | |
debug_assert!(!ptr.is_some_and(|ptr| n == ptr)); | |
ptr::write(n.cast(), ptr.unwrap_or(n)) | |
} | |
unsafe fn read_ptr(n: *mut usize) -> Option<*mut usize> { | |
let ptr = ptr::read(n.cast()); |
''' | |
This module implements the IR protocol for Daikin's air conditioning units. | |
It is based on this work: | |
<https://github.com/blafois/Daikin-IR-Reverse> | |
And contains some additional improvements, such as: | |
- Implementation of the low layer (IR signal protocol). | |
The low-level IR protocol is not explained very well by blafois; | |
no mention is made to the following: |
[Tuya][]'s IR blasters, like the [ZS08][], have the ability to both learn and blast generic IR codes. These IR codes are given to the user as an opaque string, like this:
A/IEiwFAAwbJAfIE8gSLIAUBiwFAC+ADAwuLAfIE8gSLAckBRx9AB0ADBskB8gTyBIsgBQGLAUALA4sB8gRAB8ADBfIEiwHJAeARLwHJAeAFAwHyBOC5LwGLAeA97wOLAfIE4RcfBYsB8gTyBEAFAYsB4AcrCYsB8gTyBIsByQHgPY8DyQHyBOAHAwHyBEAX4BVfBIsB8gTJoAMF8gSLAckB4BUvAckB4AEDBfIEiwHJAQ==
Not much is known about the format of these IR code strings, which makes it difficult to use codes obtained through other means (such as a