Skip to content

Instantly share code, notes, and snippets.

View likern's full-sized avatar
👨‍💻
Developing a new web service

Victor Malov likern

👨‍💻
Developing a new web service
  • @relladb
  • 19:54 (UTC +03:00)
View GitHub Profile
@likern
likern / peterson.zig
Created December 30, 2023 20:07
PetersonMutex
const std = @import("std");
const log = std.log.info;
const PetersonMutex = struct {
flag_: [2]u64 = [_]u64{ 0, 0 },
victim_idx_: u64 = undefined, // 0 or 1
main_thread_id_: std.Thread.Id,
pub fn init(main_thread: std.Thread.Id) PetersonMutex {
return PetersonMutex{
@likern
likern / show_or_hide_overlay.lua
Created October 2, 2023 11:00
Show or Hide Overlay Pane For WezTerm
wezterm.on('show-or-hide-overlay', function(window, pane)
wezterm.log_info 'Event: show-or-hide-terminal'
local overlay_pane_ids = wezterm.GLOBAL.overlay_pane_ids
local tab_old_pane_ids = {}
local found = false
if overlay_pane_ids then
local active_tab = window:active_tab()
for _, pane_with_info in pairs(active_tab:panes_with_info()) do
wezterm.on('show-or-hide-overlay', function(window, pane)
wezterm.log_info 'Event: show-or-hide-terminal'
local overlay_pane_ids = wezterm.GLOBAL.overlay_pane_ids
local tab_old_pane_ids = {}
local found = false
if overlay_pane_ids then
local active_tab = window:active_tab()
for _, pane_with_info in pairs(active_tab:panes_with_info()) do
@likern
likern / test.cpp
Last active September 5, 2023 18:17
#define BPLUSTREE_TYPE BPlusTree<KeyType, ValueType, KeyComparator>
#define INDEX_TEMPLATE_ARGUMENTS template <typename KeyType, typename ValueType, typename KeyComparator>
// Main class providing the API for the Interactive B+ Tree.
INDEX_TEMPLATE_ARGUMENTS
class BPlusTree {
public:
using InternalPage = BPlusTreeInternalPage<KeyType, page_id_t, KeyComparator>;
using LeafPage = BPlusTreeLeafPage<KeyType, ValueType, KeyComparator>;
@likern
likern / pdq.zig
Last active August 4, 2023 17:01
pdq.zig
pub fn pdq(
comptime T: type,
items: []T,
context: anytype,
comptime lessThanFn: fn (context: @TypeOf(context), lhs: T, rhs: T) bool,
) void {
const Context = struct {
items: []T,
sub_ctx: @TypeOf(context),
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
const expectEqualSlices = std.testing.expectEqualSlices;
const MemoryRuntime = @import("memory").MemoryRuntime;
const FileBlockManager = @import("io").FileBlockManager;
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
@likern
likern / vertices.tsx
Created June 3, 2022 13:36
VerticesTest
/* eslint-disable quotes */
/* eslint-disable prettier/prettier */
import React from 'react';
import { Canvas, Fill, Points, Rect, vec } from "@shopify/react-native-skia"
import { Dimensions } from "react-native";
const { width, height } = Dimensions.get("window");
const N = 3;
const n = new Array(N + 1).fill(0).map((_, i) => i);
@likern
likern / skiapatch.diff
Created March 18, 2022 16:16
SkiaPatch
diff --git a/package.json b/package.json
index ca83026..0a9c4f2 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,9 @@
"**/react-native/**",
"**/react-native-web",
"**/react-native-svg",
+ "**/@shopify/react-native-skia",
+ "**/@breeffy/react-native-skia",
packagingOptions {
def arches = ["armeabi-v7a", "x86", "arm64-v8a", "x86_64"]
def libNames = ["libfbjni", "libreact_nativemodule_core", "libjsi", "libturbomodulejsijni"]
arches.collect { arch -> libNames.collect { lib -> pickFirst "lib/${arch}/${lib}.so" } }
}