Skip to content

Instantly share code, notes, and snippets.

View hikarin522's full-sized avatar
🍑
ζ*'ヮ')ζ*)ㆆ_ㆆ)

hikari hikarin522

🍑
ζ*'ヮ')ζ*)ㆆ_ㆆ)
View GitHub Profile
@hikarin522
hikarin522 / task.hpp
Created October 16, 2020 11:32
c++ task
#include <condition_variable>
#include <functional>
#include <future>
#include <memory>
#include <mutex>
#include <boost/optional.hpp>
#include <boost/variant.hpp>
namespace task
@hikarin522
hikarin522 / lfs-check.ps1
Last active August 7, 2020 06:39
プルリクのLFSチェック
#!/usr/bin/env -S pwsh -nop
# プルリクにLFS化してないバイナリファイルが存在するかチェックする
# 引っかかったらLFS化した後 git rebase -i で fixup して歴史から消すこと
# 文字コード問題用
# $OutputEncoding = [Text.Encoding]::UTF8
# [Console]::OutputEncoding = $OutputEncoding
# [Console]::InputEncoding = $OutputEncoding
@hikarin522
hikarin522 / git_find_big.ps1
Last active October 27, 2021 14:59
git_find_big.sh の改良版 (PowerShell 7)
#!/usr/bin/env -S pwsh -nop
$blobs = Start-ThreadJob {
gci "$(git rev-parse --git-common-dir)/objects/pack/pack-*.idx" | % -Parallel {
git verify-pack -v $_ | % {
if ($_ -match '^([\da-f]+) blob +(\d+) (\d+)') {
$blob = @{
hash = $Matches[1]
file_size = [long]$Matches[2]
pack_size = [long]$Matches[3]
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 1 column 15
---
title: RxSwift: ObservableをSequenceで同期処理に変更する
tags: Swift RxSwift
author: hikarin522
slide: false
---
class SyncFIFO<T> {
    var buf = Array<T>()
#pragma once
// C++20 bind_front
// https://cpprefjp.github.io/reference/functional/bind_front.html
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0356r5.html
#ifndef __cpp_lib_bind_front
#include <utility>
#include <functional>
#pragma once
#include <boost/version.hpp>
#if BOOST_VERSION >= 105900
#define ENABLE_RANKED_INDEX
#endif
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
#pragma once
// C++20 統一コンテナ削除
// https://ja.cppreference.com/w/cpp/experimental/lib_extensions_2#Uniform_container_erasure
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1209r0.html
#include <utility>
#include <iterator>
#include <algorithm>
#include <type_traits>
// プリコンパイル済みヘッダー
// https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
// https://ezoeryou.github.io/cpp-intro/#%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%81%BF%E3%83%98%E3%83%83%E3%83%80%E3%83%BCprecompiled-header
// standard library
// https://cpprefjp.github.io/reference.html
// 言語サポート
#include <limits>
// #include <version> // C++20
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace tropical
{
class Program
{
enum NODE
@hikarin522
hikarin522 / FibCpp.cpp
Last active July 12, 2019 01:59
Fibonacci
#include <iostream>
#include <tuple>
//#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/gmp.hpp>
namespace mp = boost::multiprecision;
//typedef mp::cpp_int mpint;
typedef mp::mpz_int mpint;