Skip to content

Instantly share code, notes, and snippets.

@ytomino
ytomino / jp.halfmoon.panathenaia.pip.yml
Last active April 10, 2023 17:08
Close the application fetched with pip into flatpak.
View jp.halfmoon.panathenaia.pip.yml
app-id: jp.halfmoon.panathenaia.pip
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
#sdk-extensions:
build-options:
build-args:
- --filesystem=/var/tmp
- --share=network
strip: false
@ytomino
ytomino / urlsort.ml
Last active April 18, 2022 19:03
Sorting URLs
View urlsort.ml
let split_domain = String.split_on_char '.';;
let url_re =
Str.regexp "^\\([^:]*://\\)?\\([^/]*\\)\\(/[^?]*\\)?\\(\\?.*\\)?$";;
let split_url x =
let protocol, domain, path, query =
if Str.string_match url_re x 0 then (
let protocol = try Str.matched_group 1 x with Not_found -> "" in
let domain = Str.matched_group 2 x in
@ytomino
ytomino / c-bits-byteswap.adb
Last active March 17, 2022 18:34
zlib in x86_64-linux-gnu
View c-bits-byteswap.adb
-- This file is translated by "headmaster" version 0.31-1157199 (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
package body C.bits.byteswap is
function bswap_32 (bsx : unsigned_int) return unsigned_int is
begin
return builtin_bswap32 (bsx);
end bswap_32;
@ytomino
ytomino / c-asm_generic-errno.ads
Last active March 17, 2022 07:15
iconv (glibc) in x86_64-linux-gnu
View c-asm_generic-errno.ads
-- This file is translated by "headmaster" version 0.31-1157199 (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
package C.asm_generic.errno is
pragma Preelaborate;
EADDRINUSE : constant := 98;
EADDRNOTAVAIL : constant := 99;
EADV : constant := 68;
@ytomino
ytomino / c-alloca.ads
Last active March 17, 2022 03:37
GMP, MPFR, and MPC in x86_64-linux-gnu
View c-alloca.ads
-- This file is translated by "headmaster" version 0.31-1157199 (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
with C.stddef;
package C.alloca is
pragma Preelaborate;
function alloca (size : stddef.size_t) return void_ptr;
pragma Import (C, alloca, "alloca");
@ytomino
ytomino / c-bits-byteswap.adb
Last active August 10, 2021 04:25
OpenSSL in x86_64-linux-gnu
View c-bits-byteswap.adb
-- This file is translated by "headmaster" version 0.30-e83b81d (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
package body C.bits.byteswap is
function bswap_32 (bsx : unsigned_int) return unsigned_int is
begin
return builtin_bswap32 (bsx);
end bswap_32;
@ytomino
ytomino / c-bits-mman.ads
Created June 15, 2021 11:29
Boehm GC in x86_64-linux-gnu
View c-bits-mman.ads
-- This file is translated by "headmaster" version 0.30-e83b81d (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
package C.bits.mman is
pragma Preelaborate;
MAP_32BIT : constant := 64;
MAP_DENYWRITE : constant := 2048;
MAP_EXECUTABLE : constant := 4096;
@ytomino
ytomino / c-alloca.ads
Last active June 10, 2021 15:27
libyaml in x86_64-linux-gnu
View c-alloca.ads
-- This file is translated by "headmaster" version 0.30-e83b81d (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
with C.stddef;
package C.alloca is
pragma Preelaborate;
function alloca (size : stddef.size_t) return void_ptr;
pragma Import (C, alloca, "alloca");
@ytomino
ytomino / c-alloca.ads
Last active June 10, 2021 15:03
libxml2 in x86_64-linux-gnu
View c-alloca.ads
-- This file is translated by "headmaster" version 0.30-e83b81d (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
with C.stddef;
package C.alloca is
pragma Preelaborate;
function alloca (size : stddef.size_t) return void_ptr;
pragma Import (C, alloca, "alloca");
@ytomino
ytomino / magicmoduletype.ml
Created April 25, 2021 01:44
GADTの型パラメータをObj.magicで一致させることで無関係な後続の式の型チェックを回避できる
View magicmoduletype.ml
module type T1 = sig
type t (* any abstract type *)
val one: t
end;;
module M1: T1 = Int;;
type 'a repr = C1: M1.t repr (* GADT is needed *)
let one: string =