Skip to content

Instantly share code, notes, and snippets.

/**
* base36_128.h - Base-36 encoder-decoder for 128-bit / 25-digit byte array
*
* Copyright 2022 LiosK
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@LiosK
LiosK / uuidv8_example.c
Last active April 3, 2024 02:11
UUIDv8 Example
#include <stdint.h>
#include <time.h>
int get_random_bytes(uint8_t *buffer, int count);
int generate_uuidv8(uint8_t *uuid, uint8_t node_id) {
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
return -1; // real-time clock error
@LiosK
LiosK / convert_base.rs
Created November 12, 2022 00:52
Converts a digit value array in `src_base` to that in `dst_base`
// XXX NOT TESTED
/// Converts a digit value array in `src_base` to that in `dst_base`.
///
/// # Panics
///
/// Panics if:
///
/// - `src_base` is not between 2 and 256, inclusive;
/// - `dst_base` is not between 2 and 256, inclusive; or,
use std::{fs, io::Write as _, process};
fn main() {
let _ = rand::random::<u32>(); // initialize ThreadRng
let parent_pid = process::id();
unsafe { nix::unistd::fork() }.expect("fork failed");
let filename = format!("out_{}_{}.txt", parent_pid, process::id());
@LiosK
LiosK / divshr.c
Last active August 20, 2023 23:53
A quick benchmark of / and >> in computing millisecond timestamp
#include <stdint.h>
#include <stdio.h>
#include <time.h>
static const long REPEAT = 4;
static const long NUMBER = 400000000;
/// Computes a millisecond timestamp from `struct timespect` components.
#define div(tv_sec, tv_nsec) \
((uint64_t)(tv_sec)*1000 + (uint64_t)(tv_nsec) / 1000000)
@LiosK
LiosK / 20231207_oci_current_tax.md
Created December 6, 2023 11:57
その他の包括利益における法人税等の会計処理

その他の包括利益における法人税等の会計処理

(この記事は会計系 Advent Calendar 2023の7日目の記事です。)

2022年10月28日に公表された「法人税、住民税及び事業税等に関する会計基準」等の改正によって、その他の包括利益に関連する取引から生じた法人税、住民税及び事業税 (法人税等1) は損益 (PL) ではなくその他の包括利益 (OCI, other comprehensive income) に計上すべきことが日本基準でも明確になりました。

Footnotes

  1. 記事中の「法人税等」と「法人税等調整額」はそれぞれ一貫して当期税金費用と繰延税金費用を指します。当期税金費用・繰延税金費用という語のほうが紛らわしさがなくわかりやすいと個人的には考えていますが、日本の会計実務で一般的に用いられる用語ではないためです。同様に、日本基準に慣れた読者を想定し、IFRSにおける仕訳例でも日本基準で一般的に用いられる勘定科目を便宜的に用いています。