file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
crates/package-manager/src/storage/models/mod.rs
Rust
mod image_entry; mod known_package; mod migration; mod wit_interface; pub use image_entry::{ImageEntry, InsertResult}; pub use known_package::KnownPackage; pub(crate) use known_package::TagType; pub(crate) use migration::Migrations; pub use wit_interface::WitInterface;
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
crates/package-manager/src/storage/models/wit_interface.rs
Rust
use rusqlite::Connection; /// A WIT interface extracted from a WebAssembly component. #[derive(Debug, Clone)] pub struct WitInterface { id: i64, /// The package name (e.g., "wasi:http@0.2.0") pub package_name: Option<String>, /// The full WIT text representation pub wit_text: String, /// The wo...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
crates/package-manager/src/storage/store.rs
Rust
use anyhow::Context; use std::collections::HashSet; use std::path::Path; use super::config::StateInfo; use super::models::{ImageEntry, InsertResult, KnownPackage, Migrations, TagType, WitInterface}; use super::wit_parser::extract_wit_metadata; use futures_concurrency::prelude::*; use oci_client::{Reference, client::Im...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
crates/package-manager/src/storage/wit_parser.rs
Rust
use wit_parser::decoding::{DecodedWasm, decode}; /// Metadata extracted from a WIT component. pub(crate) struct WitMetadata { pub package_name: Option<String>, pub world_name: String, pub import_count: i32, pub export_count: i32, pub wit_text: String, } /// Attempt to extract WIT metadata from was...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
crates/wasm-detector/src/lib.rs
Rust
//! A library to detect local `.wasm` files in a repository. //! //! This crate provides functionality to find WebAssembly files while: //! - Respecting `.gitignore` rules //! - Including well-known `.wasm` locations that are typically ignored //! (e.g., `target/wasm32-*`, `pkg/`, `dist/`) //! //! # Example //! //! `...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
crates/wasm-detector/tests/tests.rs
Rust
//! Integration tests for the wasm-detector crate. use std::fs::{self, File}; use tempfile::TempDir; use wasm_detector::WasmDetector; /// Create a test directory structure with some .wasm files fn setup_test_dir() -> TempDir { let temp_dir = TempDir::new().expect("Failed to create temp dir"); let root = temp_...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
xtask/src/main.rs
Rust
//! xtask - Build automation and task orchestration for the wasm project //! //! This binary provides a unified interface for running common development tasks //! like testing, linting, and formatting checks. use std::process::Command; use anyhow::Result; use clap::Parser; #[derive(Parser)] #[command(name = "xtask")...
yoshuawuyts/wasm
0
Unified developer tools for WebAssembly
Rust
yoshuawuyts
Yosh
src/lib.rs
Rust
//! Wasm CLI runner //! //! # Examples //! //! ``` //! // tbi //! ``` #![forbid(unsafe_code, rust_2018_idioms)] #![deny(missing_debug_implementations, nonstandard_style)] #![warn(missing_docs, future_incompatible, unreachable_pub)]
yoshuawuyts/wasm-cli-runner
1
Rust
yoshuawuyts
Yosh
src/main.rs
Rust
use std::io; use std::path::PathBuf; use clap::{Command, Parser}; #[derive(clap::Parser)] #[command(version)] struct Arg { /// The path to a .wasm binary path: PathBuf, } fn main() -> io::Result<()> { let Arg { path } = Arg::parse(); path.canonicalize()?; let commands = vec![make_command("bar"),...
yoshuawuyts/wasm-cli-runner
1
Rust
yoshuawuyts
Yosh
tests/cli.rs
Rust
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin}; use std::process::Command; fn cli() -> Command { Command::new(get_cargo_bin("wasm-cli-runner")) } #[test] fn has_a_version() { assert_cmd_snapshot!(cli().arg("--version")); } #[test] fn path_is_required() { assert_cmd_snapshot!(cli()); } #[test] fn pa...
yoshuawuyts/wasm-cli-runner
1
Rust
yoshuawuyts
Yosh
bin/cli.js
JavaScript
#!/usr/bin/env node /** * git-hierarchies CLI * Reveal the real org chart by analyzing who approves whose PRs */ import { program } from 'commander'; import chalk from 'chalk'; import ora from 'ora'; import fs from 'fs'; import path from 'path'; import { createClient, fetchMergedPRsWithReviews, parseRepoInput } fr...
youknowriad/git-hierarchies
0
Reveal the real org chart by analyzing who approves whose PRs
JavaScript
youknowriad
Riad Benguella
Automattic
lib/github.js
JavaScript
/** * GitHub API interactions for fetching PR and review data * Uses GraphQL for efficient batched queries */ import { Octokit } from '@octokit/rest'; /** * Create an authenticated Octokit instance * @param {string} token - GitHub personal access token * @returns {Octokit} */ export function createClient(token...
youknowriad/git-hierarchies
0
Reveal the real org chart by analyzing who approves whose PRs
JavaScript
youknowriad
Riad Benguella
Automattic
lib/hierarchy.js
JavaScript
/** * Build and analyze the approval hierarchy from PR data */ /** * Build a directed graph of author -> approver relationships * @param {Array} prs - Array of PR data with author and approvers * @returns {object} Graph data structure */ export function buildApprovalGraph(prs) { const edges = new Map(); // "au...
youknowriad/git-hierarchies
0
Reveal the real org chart by analyzing who approves whose PRs
JavaScript
youknowriad
Riad Benguella
Automattic
lib/output.js
JavaScript
/** * Format and output the analysis results */ import chalk from 'chalk'; import Table from 'cli-table3'; /** * Format the analysis as a beautiful CLI output * @param {object} analysis - From analyzeHierarchy * @param {string} repoName - Repository name for header */ export function formatAnalysis(analysis, re...
youknowriad/git-hierarchies
0
Reveal the real org chart by analyzing who approves whose PRs
JavaScript
youknowriad
Riad Benguella
Automattic
src/components/graphiql.js
JavaScript
import React, { Component, PropTypes } from 'react'; import GraphiQL from 'graphiql'; import { graphql } from 'graphql'; export default class GraphiQLWrapper extends Component { static contextTypes = { graph: PropTypes.object.isRequired }; fetch = ( { query, variables } ) => { return graphql( this.context.grap...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/components/provider.js
JavaScript
import { Component, PropTypes, Children } from 'react'; export default class GraphProvider extends Component { static propTypes = { store: PropTypes.object.isRequired, schema: PropTypes.object.isRequired, root: PropTypes.object.isRequired, children: PropTypes.element.isRequired }; static childContextTypes ...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/components/query.js
JavaScript
import React, { Component, PropTypes } from 'react'; import { isString, uniqueId, throttle } from 'lodash'; import { graphql } from 'graphql'; import { quickGraphql, parse } from '../quick-graphql'; import { makePromiseCancelable } from '../utils/promises'; import { clearRequests } from '../redux/actions'; const THROT...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/helpers/refresh.js
JavaScript
import { getRequest, getRequestIgnoringUid } from '../redux/selectors'; import { addRequest, removeRequest } from '../redux/actions'; export const refreshByUid = ( store, uid, type, options, triggerRequest ) => { const state = store.getState(); const request = getRequest( state, uid, type, options ); if ( ! request...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/index.js
JavaScript
export { default as query } from './components/query'; export { default as GraphProvider } from './components/provider'; export { default as GraphiQL } from './components/graphiql'; export { default as GraphReducer } from './redux/reducer'; export * from './helpers/refresh';
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/quick-graphql/execute.js
JavaScript
import { isArray, isPlainObject, isFunction } from 'lodash'; const resolveNode = ( node, resolver, context ) => { let resolved = resolver; if ( isFunction( resolver ) ) { resolved = resolver( node.arguments, context ); } if ( isPlainObject( resolved ) ) { return resolveNodes( node.nodes, resolved, context ); /...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/quick-graphql/index.js
JavaScript
export { default as quickGraphql } from './execute'; export { default as parse } from './parse';
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/quick-graphql/parse.js
JavaScript
import { parse, visit } from 'graphql'; export default ( queryString, variables ) => { const ast = parse( queryString ); const parsed = visit( ast, { Document: { leave: node => node.definitions[ 0 ] }, OperationDefinition: { leave: node => { return { nodes: node.selectionSet }; } }, SelectionSet: ...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/redux/actions.js
JavaScript
export const GRAPH_RESOLVER_REQUEST_ADD = 'GRAPH_RESOLVER_REQUEST_ADD'; export const GRAPHQL_RESOLVER_REQUEST_CLEAR = 'GRAPHQL_RESOLVER_REQUEST_CLEAR'; export const GRAPH_RESOLVER_REQUEST_REMOVE = 'GRAPH_RESOLVER_REQUEST_REMOVE'; export function addRequest( uid, type, options = {} ) { const createdAt = Date.now(); ...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/redux/reducer.js
JavaScript
import { filter, omit } from 'lodash'; import { GRAPH_RESOLVER_REQUEST_ADD, GRAPH_RESOLVER_REQUEST_REMOVE, GRAPHQL_RESOLVER_REQUEST_CLEAR } from './actions'; const handleAdd = ( state, { payload: { uid, type, options, createdAt } } ) => { const optionsSerialization = JSON.stringify( options ); return { ...state, ...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/redux/selectors.js
JavaScript
import { find, flatten, get, values } from 'lodash'; export const getRequest = ( state, uid, type, options = {} ) => { const optionsSerialization = JSON.stringify( options ); return find( get( state.graphqlResolvers, [ uid ], [] ), request => { return request.type === type && request.options === optionsSerializati...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
src/utils/promises.js
JavaScript
/** * Takes a promise and transform it to a cancelable promise by adding a "cancel" method * @param {Promise} promise Promise to make cancelable * @return {Promise} Cancelble promise */ export const makePromiseCancelable = promise => { let hasCanceled_ = false; const wrappedPromise = new Promise( ( res...
youknowriad/react-graphql-redux
49
This library allows you to use GraphQL to query your Redux store
JavaScript
youknowriad
Riad Benguella
Automattic
.devcontainer/post-create.sh
Shell
#!/usr/bin/env bash if [ -f package.json ]; then bash -i -c "nvm install --lts && nvm install-latest-npm" npm i npm run build fi # Install dependencies for shfmt extension curl -sS https://webi.sh/shfmt | sh &>/dev/null # Add OMZ plugins git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-...
youtalk/chirpy-starter
0
Shell
youtalk
Yutaka Kondo
tier4
_plugins/posts-lastmod-hook.rb
Ruby
#!/usr/bin/env ruby # # Check for changed posts Jekyll::Hooks.register :posts, :post_init do |post| commit_num = `git rev-list --count HEAD "#{ post.path }"` if commit_num.to_i > 1 lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"` post.data['last_modified_at'] = lastmod_date end e...
youtalk/chirpy-starter
0
Shell
youtalk
Yutaka Kondo
tier4
index.html
HTML
--- layout: home # Index page ---
youtalk/chirpy-starter
0
Shell
youtalk
Yutaka Kondo
tier4
tools/run.sh
Shell
#!/usr/bin/env bash # # Run jekyll serve and then launch the site prod=false command="bundle exec jekyll s -l" host="127.0.0.1" help() { echo "Usage:" echo echo " bash /path/to/run [options]" echo echo "Options:" echo " -H, --host [HOST] Host to bind to." echo " -p, --production Run Jek...
youtalk/chirpy-starter
0
Shell
youtalk
Yutaka Kondo
tier4
tools/test.sh
Shell
#!/usr/bin/env bash # # Build and test the site content # # Requirement: html-proofer, jekyll # # Usage: See help information set -eu SITE_DIR="_site" _config="_config.yml" _baseurl="" help() { echo "Build and test the site content" echo echo "Usage:" echo echo " bash $0 [options]" echo echo "Optio...
youtalk/chirpy-starter
0
Shell
youtalk
Yutaka Kondo
tier4
lib/cargo-miri-wrapper.sh
Shell
#!@bash@ -e src_dir="@out@/lib/rustlib/src/rust/library" if [[ ! -v XARGO_RUST_SRC ]]; then if [[ ! -d "$src_dir" ]]; then echo '`rust-src` is required by miri but not installed.' >&2 echo 'Please either install component `rust-src` or set `XARGO_RUST_SRC`.' >&2 exit 1 fi export XARG...
yshui/rustup.nix
0
declaratively download rust toolchains with nix
Nix
yshui
Yuxuan Shui
CodeWeavers
gl-bindings/build.rs
Rust
use gl_generator::{Api, Fallbacks, Profile, Registry, StructGenerator}; fn main() -> anyhow::Result<()> { let out_dir = std::env::var("OUT_DIR")?; let out_dir = std::path::Path::new(&out_dir); let target = std::env::var("TARGET").unwrap(); if target.contains("linux") || target.contains("dragonf...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
gl-bindings/src/lib.rs
Rust
pub mod egl { #![cfg(any( target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd" ))] #![allow(dead_code)] #![allow(unused_imports)] #![allow(non_camel_case_types)] #![...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/build.rs
Rust
#[derive(Debug)] struct ParseCallbacks; impl bindgen::callbacks::ParseCallbacks for ParseCallbacks { fn enum_variant_name( &self, enum_name: Option<&str>, original_variant_name: &str, _variant_value: bindgen::callbacks::EnumVariantValue, ) -> Option<String> { let enum_na...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/picom.h
C/C++ Header
#include <picom/api.h> #include <picom/backend.h>
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/picom/api.h
C/C++ Header
// SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui <yshuiv7@gmail.com> #pragma once #include <stdbool.h> #include <stdint.h> #define PICOM_API_MAJOR (0UL) #define PICOM_API_MINOR (1UL) struct backend_base; /// The entry point of a backend plugin. Called after the backend is initialized. typedef void ...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/picom/backend.h
C/C++ Header
// SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui <yshuiv7@gmail.com> #pragma once #include <pixman-1/pixman.h> #include <stdbool.h> #include <xcb/xproto.h> #include "types.h" #define PICOM_BACKEND_MAJOR (1UL) #define PICOM_BACKEND_MINOR (0UL) #define PICOM_BACKEND_MAKE_VERSION(major, minor) ((major)...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/picom/types.h
C/C++ Header
// SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui <yshuiv7@gmail.com> #pragma once /// Some common types #include <limits.h> #include <math.h> #include <stdbool.h> #include <stdint.h> enum blur_method { BLUR_METHOD_NONE = 0, BLUR_METHOD_KERNEL, BLUR_METHOD_BOX, BLUR_METHOD_GAUSSIAN, BLUR_METHOD_...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/src/cursor.rs
Rust
//! Cursor monitor //! //! Monitor cursor changes and import them into GL textures use std::collections::{HashMap, HashSet}; use gl_bindings::{egl, gl}; use x11rb::{connection::Connection as _, protocol::xfixes::ConnectionExt as _}; #[derive(Debug)] pub(crate) struct Cursor { pub(crate) hotspot_x: u32, pub(c...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/src/ffi.rs
Rust
use std::os::raw::c_void; use libffi::{ high::CType, low::CodePtr, raw::{self, ffi_closure}, }; // Converts the raw status type to a `Result`. fn status_to_result(status: raw::ffi_status) -> Result<(), libffi::low::Error> { if status == raw::ffi_status_FFI_OK { Ok(()) } else if status == r...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/src/lib.rs
Rust
use std::{ cell::{OnceCell, UnsafeCell}, collections::HashSet, os::{ fd::{AsFd, AsRawFd}, raw::c_void, }, rc::Rc, sync::{ mpsc::{Receiver, Sender}, Arc, }, }; use anyhow::Context as _; use cursor::Cursor; use slotmap::{DefaultKey, SlotMap}; use smallvec::Smal...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/src/pipewire.rs
Rust
use std::{ borrow::Cow, cell::{Cell, RefCell}, collections::HashMap, os::{ fd::{FromRawFd, OwnedFd}, unix::io::IntoRawFd, }, rc::Rc, }; use anyhow::Context; use drm_fourcc::DrmModifier; use gbm::BufferObjectFlags; use gl_bindings::gl; use pipewire::{ loop_::IoSource, pro...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
plugin/src/server.rs
Rust
use std::{ io::{Read as _, Write as _}, os::{ fd::AsRawFd as _, unix::net::{UnixListener, UnixStream}, }, path::{Path, PathBuf}, pin::pin, sync::Arc, }; use async_channel::{Receiver, Sender}; use futures_util::{ io::{ReadHalf, WriteHalf}, stream::FuturesOrdered, Asyn...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
portal/build.rs
Rust
fn main() -> anyhow::Result<()> { pkg_config::probe_library("x11-xcb")?; pkg_config::probe_library("egl")?; println!("cargo:rerun-if-changed=build.rs"); Ok(()) }
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
portal/src/main.rs
Rust
use std::{ os::unix::{ffi::OsStrExt, net::UnixStream}, pin::Pin, sync::atomic::AtomicUsize, task::ready, }; use anyhow::Context; use async_io::Async; use futures_util::{ stream::FuturesOrdered, AsyncRead as _, AsyncWrite, Sink, SinkExt, Stream, StreamExt as _, }; use itertools::izip; use serde::{De...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
protocol/src/lib.rs
Rust
/// Client-server protocol uses length delimited JSON. use serde::{Deserialize, Serialize}; use smallvec::SmallVec; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct Rectangle { pub x: i32, pub y: i32, pub width: u32, pub height: u32, } #[derive(Debug, Clone, Par...
yshui/x11screencast-portal
5
xdg-desktop-portal ScreenCast implementation for X11
Rust
yshui
Yuxuan Shui
CodeWeavers
experiment/src/main.rs
Rust
#![deny(rust_2018_idioms)] use smallvec::smallvec; use winit::{event::WindowEvent, event_loop::EventLoop}; use std::{collections::HashSet, sync::Arc}; use anyhow::{Context, Result, anyhow}; use ::xr_passthrough_layer::{CAMERA_SIZE, camera, find_index_camera, pipeline, steam}; use glam::UVec2; use v4l::video::Capture...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
hello/src/main.rs
Rust
use glam::{Mat4, Quat, Vec3, Vec4}; use smallvec::smallvec; use std::{collections::HashSet, sync::Arc, thread::JoinHandle}; use winit::{ event::WindowEvent, event_loop::{EventLoop, EventLoopProxy}, }; use anyhow::{Context as _, Result}; use openxr::{ CompositionLayerFlags, EnvironmentBlendMode, Extent2Di, ...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/api_layer/instance.rs
Rust
use crate::api_layer::{LOG_INIT, REQUIRED_VK_DEVICE_EXTENSIONS, REQUIRED_VK_INSTANCE_EXTENSIONS}; use log::{debug, warn}; use openxr::sys::Result as XrErr; use quark::{Hooked as _, Low as _, try_xr}; use std::{ collections::{HashMap, HashSet}, ffi::{CStr, c_char}, }; use vulkano::Handle as _; unsafe fn get_vul...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/api_layer/mod.rs
Rust
use glam::Vec3; use log::debug; use openxr::{ AsHandle, sys::{Handle, Result as XrErr}, }; use quark::{Hooked as _, Low as _}; use std::{ ffi::CStr, mem::MaybeUninit, sync::{Arc, LazyLock, OnceLock}, }; mod instance; mod session; use instance::{ InstanceData, create_vulkan_device, create_vulkan...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/api_layer/session.rs
Rust
use glam::UVec2; use log::{debug, error, warn}; use openxr::{ AsHandle, CompositionLayerFlags, EnvironmentBlendMode, Extent2Di, Offset2Di, Rect2Di, ReferenceSpaceType, SwapchainCreateFlags, SwapchainCreateInfo, SwapchainSubImage, SwapchainUsageFlags, ViewStateFlags, sys::Handle as _, }; use quark::{Hooked a...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/camera.rs
Rust
use std::{ sync::{Arc, mpsc}, thread::JoinHandle, }; use super::FrameInfo; use anyhow::{Context, anyhow}; use arc_swap::{ArcSwap, Guard}; use glam::UVec2; use log::{info as debug, warn}; use smallvec::SmallVec; use v4l::video::Capture; #[derive(PartialEq, Eq, Debug, Clone, Copy)] enum Control { /// Pause ...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/config.rs
Rust
use ed25519_dalek::Signer; use std::{io::Write, sync::Arc}; use log::warn; use serde::{Deserialize, Serialize}; /// Because your eye and the camera is at different physical locations, it is impossible /// to project camera view into VR space perfectly. There are trade offs approximating /// this projection. (viewing ...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/events.rs
Rust
use std::time::{Duration, Instant}; pub enum Action { None, ShowOverlay, HideOverlay, } enum InternalState { Activated(Instant), Refractory, Armed, } pub struct State { visible: bool, state: InternalState, delay: Duration, } impl State { /// Whether the overlay should be visi...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/lib.rs
Rust
#![deny(rust_2018_idioms, rust_2024_compatibility, rust_2021_compatibility)] pub mod api_layer; pub mod camera; pub mod config; pub mod pipeline; pub mod steam; pub mod utils; use anyhow::{Context, Result, anyhow}; /// Camera image will be (size * 2, size) pub const CAMERA_SIZE: u32 = 960; use glam::UVec2; #[allow(un...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/pipeline.rs
Rust
use glam::{ UVec2, f64::{DVec2 as Vec2, DVec4 as Vec4}, }; use smallvec::smallvec; use std::sync::Arc; use crate::{steam::StereoCamera, utils::DeviceExt as _}; use anyhow::Result; use log::{info, trace}; use vulkano::{ Handle, VulkanObject, buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer}, ...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/steam.rs
Rust
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Debug)] pub struct Extrinsics { /// Offset of the camera from Hmd pub position: [f64; 3], } #[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Debug)] pub struct Distort { pub coeffs: [f64; 4], } #[derive(...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
src/utils.rs
Rust
use std::sync::Arc; use vulkano::{ Validated, buffer::{AllocateBufferError, Buffer, BufferCreateInfo, RawBuffer}, device::Device, image::{AllocateImageError, Image, ImageCreateFlags, ImageCreateInfo, sys::RawImage}, memory::{ DedicatedAllocation, DeviceMemory, MemoryAllocateInfo, MemoryMapI...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
xrhelper/src/lib.rs
Rust
use anyhow::{Context, Result, anyhow}; use glam::UVec2; use itertools::Itertools; use nalgebra::{Affine3, Matrix3, UnitQuaternion}; use openxr::{ ApplicationInfo, FrameStream, FrameWaiter, ReferenceSpaceType, ViewConfigurationType, sys::Handle as _, }; use std::{ collections::HashSet, sync::{Arc, OnceLo...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
xtask/src/main.rs
Rust
use serde::Serialize; use std::path::PathBuf; #[derive(Serialize)] struct Extension { name: &'static str, extension_version: &'static str, } #[derive(Serialize)] struct ApiLayer { name: &'static str, library_path: PathBuf, api_version: &'static str, implementation_version: &'static str, de...
yshui/xr_passthrough_layer
6
Rust
yshui
Yuxuan Shui
CodeWeavers
pg_rrf--0.0.1--0.0.2.sql
SQL
/* Upgrade script from pg_rrf v0.0.1 to v0.0.2. */ -- Add rrf_fuse (SRF) CREATE FUNCTION "rrf_fuse"( "ids_a" bigint[], "ids_b" bigint[], "k" bigint DEFAULT 60 ) RETURNS TABLE ( "id" bigint, "score" double precision, "rank_a" integer, "rank_b" integer ) LANGUAGE c AS 'MODULE_PATHNAME', 'rrf_...
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
pg_rrf--0.0.2--0.0.3.sql
SQL
/* Upgrade script from pg_rrf v0.0.2 to v0.0.3. */ -- Add rrfn CREATE FUNCTION "rrfn"( "ranks" bigint[], "k" bigint ) RETURNS double precision LANGUAGE c AS 'MODULE_PATHNAME', 'rrfn_wrapper';
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
pg_rrf--0.0.2.sql
SQL
/* This file defines extension objects for pg_rrf v0.0.2. */ -- rrf CREATE FUNCTION "rrf"( "rank_a" bigint, "rank_b" bigint, "k" bigint ) RETURNS double precision LANGUAGE c AS 'MODULE_PATHNAME', 'rrf_wrapper'; -- rrf3 CREATE FUNCTION "rrf3"( "rank_a" bigint, "rank_b" bigint, "rank_c" bigint, ...
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
pg_rrf--0.0.3.sql
SQL
/* This file defines extension objects for pg_rrf v0.0.3. */ -- rrfn CREATE FUNCTION "rrfn"( "ranks" bigint[], "k" bigint ) RETURNS double precision LANGUAGE c AS 'MODULE_PATHNAME', 'rrfn_wrapper'; -- rrf CREATE FUNCTION "rrf"( "rank_a" bigint, "rank_b" bigint, "k" bigint ) RETURNS double precisio...
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
src/bin/pgrx_embed.rs
Rust
::pgrx::pgrx_embed!();
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
src/lib.rs
Rust
use pgrx::prelude::*; use std::collections::{HashMap, HashSet}; ::pgrx::pg_module_magic!(name, version); fn rrf_score(ranks: &[Option<i64>], k: i64) -> (f64, usize) { if k <= 0 { error!("rrf k must be positive"); } let kf = k as f64; let mut sum = 0.0f64; let mut used = 0usize; for r...
yuiseki/pg_rrf
1
RFF (Reciprocal Rank Fusion) Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
src/bin/pgrx_embed.rs
Rust
::pgrx::pgrx_embed!();
yuiseki/pg_s2
0
S2 Geometry Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
src/lib.rs
Rust
use pgrx::callconv::{ArgAbi, BoxRet}; use pgrx::datum::Datum; use pgrx::guc::{GucContext, GucFlags, GucRegistry, GucSetting}; use pgrx::iter::SetOfIterator; use pgrx::pg_sys::Point; use pgrx::pg_sys::BOX; use pgrx::pg_sys::Oid; use pgrx::pgrx_sql_entity_graph::metadata::{ ArgumentError, Returns, ReturnsError, SqlMa...
yuiseki/pg_s2
0
S2 Geometry Extension for PostgreSQL
Rust
yuiseki
yuiseki
Yuiseki Inc.
src/cli.rs
Rust
use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{cmp, fs, io, str}; use anyhow::Context as _; use bstr::BStr; use clap::Parser as _; use tracing_subscriber::prelude::*; use crate::keymap::{LAYER_DATA_LEN, PROFILE_DATA_LEN}; use crate::{keymap, layout, scancode}; ...
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
src/keymap.rs
Rust
//! Utility to process keymap data. use std::fmt::Write as _; pub const LAYER_DATA_LEN: usize = 0xf0; pub const PROFILE_DATA_LEN: usize = LAYER_DATA_LEN * 4; pub fn serialize_to_toml_string(profile_data: &[u8]) -> String { assert_eq!(profile_data.len(), PROFILE_DATA_LEN); let mut buffer = String::new(); ...
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
src/layout.rs
Rust
use std::fmt::{Display, Write as _}; use std::iter; /// Marker denoting a blank cell. const B: u8 = 0x80; /// Physical layout of US keymap. #[rustfmt::skip] pub const US_LAYOUT_WIDTHS_MAP: [[u8; 15]; 8] = [ [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], // Esc, 0, .., ~ [7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,...
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
src/lib.rs
Rust
pub mod cli; mod keymap; mod layout; mod scancode;
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
src/main.rs
Rust
fn main() -> anyhow::Result<()> { hhkb_studio_tools::cli::run() }
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
src/scancode.rs
Rust
/// Translates HHKB Studio scancode to short string label. pub fn scancode_to_label(code: u16) -> Option<&'static str> { match code { // 0x0000..0x00e8: USB HID Keyboard (with some HHKB specific mappings) 0x0000 => None, // Reserved 0x0001 => None, // Error roll over 0x0002 => None, ...
yuja/hhkb-studio-tools
30
Linux tool to modify HHKB Studio keymap
Rust
yuja
Yuya Nishihara
main.cpp
C++
#include <QCommandLineParser> #include <QGuiApplication> #include <QQuickItem> #include <QQuickItemGrabResult> #include <QQuickView> #include <QUrl> #include <QWindow> #include <QtDebug> #include <set> namespace { void grabItemsRecursively(std::set<QSharedPointer<QQuickItemGrabResult>> &grabResults, ...
yuja/qmlseen
4
Mini tool to generate prerendered images from QML file
C++
yuja
Yuya Nishihara
cmake/QmluicMacros.cmake
CMake
cmake_minimum_required(VERSION 3.12) function(qmluic_target_qml_sources target) cmake_parse_arguments(PARSE_ARGV 1 arg "NO_DYNAMIC_BINDING" "OUTPUT_DIRECTORY" "") set(qml_files ${arg_UNPARSED_ARGUMENTS}) set(no_dynamic_binding ${arg_NO_DYNAMIC_BINDING}) set(output_directory ${arg_OUTPUT_DIRECTORY}) if(NOT ou...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
cmake/QmluicShim.cmake
CMake
# Drop-in replacement for QmluicMacros.cmake # # This module should be loaded only when qmluic isn't available: # # find_package(Qmluic QUIET) # if(NOT Qmluic_FOUND) # include("${CMAKE_SOURCE_DIR}/cmake/QmluicShim.cmake") # endif() function(qmluic_target_qml_sources target) cmake_parse_arguments(PARSE_ARGV...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/bindingloop.cpp
C++
#include "bindingloop.h" #include "ui_bindingloop.h" #include "uisupport_bindingloop.h" BindingLoop::BindingLoop(QWidget *parent) : QWidget(parent), ui_(std::make_unique<Ui::BindingLoop>()), uiSupport_(std::make_unique<UiSupport::BindingLoop>(this, ui_.get())) { ui_->setupUi(this); uiSupport_-...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/bindingloop.h
C/C++ Header
#pragma once #include <QWidget> #include <memory> namespace Ui { class BindingLoop; } namespace UiSupport { class BindingLoop; } class BindingLoop : public QWidget { Q_OBJECT public: explicit BindingLoop(QWidget *parent = nullptr); ~BindingLoop() override; private: std::unique_ptr<Ui::BindingLoop>...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/common/mydialogbuttonbox.cpp
C++
#include "mydialogbuttonbox.h" #include "ui_mydialogbuttonbox.h" MyDialogButtonBox::MyDialogButtonBox(QWidget *parent) : QDialogButtonBox(parent), ui_(std::make_unique<Ui::MyDialogButtonBox>()) { ui_->setupUi(this); } MyDialogButtonBox::~MyDialogButtonBox() = default;
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/common/mydialogbuttonbox.h
C/C++ Header
#pragma once #include <QDialogButtonBox> #include <memory> namespace Ui { class MyDialogButtonBox; } class MyDialogButtonBox : public QDialogButtonBox { Q_OBJECT public: MyDialogButtonBox(QWidget *parent = nullptr); ~MyDialogButtonBox() override; private: std::unique_ptr<Ui::MyDialogButtonBox> ui_;...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/main.cpp
C++
#include <QApplication> #include "maindialog.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); MainDialog dialog; dialog.show(); return app.exec(); }
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/maindialog.cpp
C++
#include "maindialog.h" #include "ui_maindialog.h" MainDialog::MainDialog(QWidget *parent) : QDialog(parent), ui_(std::make_unique<Ui::MainDialog>()) { ui_->setupUi(this); } MainDialog::~MainDialog() = default;
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/maindialog.h
C/C++ Header
#pragma once #include <QDialog> #include <memory> namespace Ui { class MainDialog; } class MainDialog : public QDialog { Q_OBJECT public: MainDialog(QWidget *parent = nullptr); ~MainDialog() override; private: std::unique_ptr<Ui::MainDialog> ui_; };
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/settingsform.cpp
C++
#include "settingsform.h" #include "ui_settingsform.h" SettingsForm::SettingsForm(QWidget *parent) : QWidget(parent), ui_(std::make_unique<Ui::SettingsForm>()) { ui_->setupUi(this); } SettingsForm::~SettingsForm() = default;
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/customwidget/settingsform.h
C/C++ Header
#pragma once #include <QWidget> #include <memory> namespace Ui { class SettingsForm; } class SettingsForm : public QWidget { Q_OBJECT public: SettingsForm(QWidget *parent = nullptr); ~SettingsForm() override; private: std::unique_ptr<Ui::SettingsForm> ui_; };
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/hgemaildialog.cpp
C++
#include "hgemaildialog.h" #include "ui_hgemaildialog.h" #include "uisupport_hgemaildialog.h" HgEmailDialog::HgEmailDialog(QWidget *parent) : QDialog(parent), ui_(std::make_unique<Ui::HgEmailDialog>()), uiSupport_(std::make_unique<UiSupport::HgEmailDialog>(this, ui_.get())) { ui_->setupUi(this); ...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/hgemaildialog.h
C/C++ Header
#pragma once #include <QDialog> #include <memory> namespace Ui { class HgEmailDialog; } namespace UiSupport { class HgEmailDialog; } class HgEmailDialog : public QDialog { Q_OBJECT public: explicit HgEmailDialog(QWidget *parent = nullptr); ~HgEmailDialog() override; private: std::unique_ptr<Ui::Hg...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/itemviews.cpp
C++
#include <QDir> #include <QFileSystemModel> #include "itemviews.h" #include "ui_itemviews.h" #include "uisupport_itemviews.h" ItemViews::ItemViews(QWidget *parent) : QWidget(parent), ui_(std::make_unique<Ui::ItemViews>()), uiSupport_(std::make_unique<UiSupport::ItemViews>(this, ui_.get())), fsMod...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/itemviews.h
C/C++ Header
#pragma once #include <QWidget> #include <memory> class QFileSystemModel; namespace Ui { class ItemViews; } namespace UiSupport { class ItemViews; } class ItemViews : public QWidget { Q_OBJECT public: explicit ItemViews(QWidget *parent = nullptr); ~ItemViews() override; private: std::unique_ptr<U...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/layoutflow.cpp
C++
#include "layoutflow.h" #include "ui_layoutflow.h" #include "uisupport_layoutflow.h" LayoutFlow::LayoutFlow(QWidget *parent) : QWidget(parent), ui_(std::make_unique<Ui::LayoutFlow>()), uiSupport_(std::make_unique<UiSupport::LayoutFlow>(this, ui_.get())) { ui_->setupUi(this); uiSupport_->setup(...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/layoutflow.h
C/C++ Header
#pragma once #include <QWidget> #include <memory> namespace Ui { class LayoutFlow; } namespace UiSupport { class LayoutFlow; } class LayoutFlow : public QWidget { Q_OBJECT public: explicit LayoutFlow(QWidget *parent = nullptr); ~LayoutFlow() override; private: std::unique_ptr<Ui::LayoutFlow> ui_; ...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/main.cpp
C++
#include <QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow window; window.show(); return app.exec(); }
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/mainwindow.cpp
C++
#include <QCoreApplication> #include <QDir> #include <QFile> #include <QFileInfo> #include <QtDebug> #include "mainwindow.h" #include "ui_mainwindow.h" #include "uisupport_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui_(std::make_unique<Ui::MainWindow>()), uiSupport_(st...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/mainwindow.h
C/C++ Header
#pragma once #include <QMainWindow> #include <memory> namespace Ui { class MainWindow; } namespace UiSupport { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow() override; private slots: void updateSourceEdit()...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/settingsdialog.cpp
C++
#include "settingsdialog.h" #include "ui_settingsdialog.h" #include "uisupport_settingsdialog.h" SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui_(std::make_unique<Ui::SettingsDialog>()), uiSupport_(std::make_unique<UiSupport::SettingsDialog>(this, ui_.get())) { ui_->setupUi(th...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/settingsdialog.h
C/C++ Header
#pragma once #include <QDialog> #include <memory> namespace Ui { class SettingsDialog; } namespace UiSupport { class SettingsDialog; } class SettingsDialog : public QDialog { Q_OBJECT public: explicit SettingsDialog(QWidget *parent = nullptr); ~SettingsDialog() override; private: std::unique_ptr<U...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/staticitemmodel.cpp
C++
#include "staticitemmodel.h" #include "ui_staticitemmodel.h" #include "uisupport_staticitemmodel.h" StaticItemModel::StaticItemModel(QWidget *parent) : QWidget(parent), ui_(std::make_unique<Ui::StaticItemModel>()), uiSupport_(std::make_unique<UiSupport::StaticItemModel>(this, ui_.get())) { ui_->set...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara
examples/staticitemmodel.h
C/C++ Header
#pragma once #include <QWidget> #include <memory> namespace Ui { class StaticItemModel; } namespace UiSupport { class StaticItemModel; } class StaticItemModel : public QWidget { Q_OBJECT public: explicit StaticItemModel(QWidget *parent = nullptr); ~StaticItemModel() override; private: std::unique_...
yuja/qmluic
9
QML -> QtWidgets UI/C++ transpiler
Rust
yuja
Yuya Nishihara