Skip to content

Instantly share code, notes, and snippets.

@wx257osn2
wx257osn2 / majority.cpp
Last active July 15, 2024 22:23 — forked from qnighy/majority.rs
Fast 2-pass majority finder
// Copyright 2024 I
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
#!/bin/bash
# Prerequisites:
# git
# curl
# unzip
# make
# g++ (11 or newer)
# clang++ (7 or newer)
# bzip2
@wx257osn2
wx257osn2 / 01.txt
Last active April 3, 2022 06:31
カワイイヤッター2022
> I
I=サン、おまえはニンジャになった
◆ニンジャネーム:ポイズンコブラ
【カラテ】1
【ニューロン】2
【ワザマエ】4
【ジツ】2(謎めいたニンジャソウルLv2)
【体力】1
@wx257osn2
wx257osn2 / amp_graphics.h.patch
Created June 13, 2021 17:48
The patch for amp_graphics.h in order to match the standard conformation degree of the compiler on VS2019 16.10.1
diff --git a/amp_graphics.h b/amp_graphics.h
index c63de07..98bd512 100644
--- a/amp_graphics.h
+++ b/amp_graphics.h
@@ -638,6 +638,24 @@ _Ret_ IUnknown * get_sampler(const Concurrency::accelerator_view &_Av, const sam
} // namespace direct3d
+template <typename _Src_type, typename = typename std::enable_if<details::texture_traits<_Src_type>::is_texture, void>::type> void copy(const _Src_type &_Src, _Out_ void * _Dst, unsigned int _Dst_byte_size);
+template <typename _Src_type, typename = typename std::enable_if<details::texture_traits<_Src_type>::is_texture, void>::type> void copy(const _Src_type &_Src, const index<_Src_type::rank> &_Src_offset, const extent<_Src_type::rank> &_Copy_extent, _Out_ void * _Dst, unsigned int _Dst_byte_size);
@wx257osn2
wx257osn2 / mecab.hpp
Created December 29, 2017 09:36
MeCabのC++ラッパー
//Copyright (C) 2017 I
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef MECAB_HPP_INCLUDED_
#define MECAB_HPP_INCLUDED_
#include <string_view>
#include <memory>
#include <stdexcept>
#include <mecab.h>
@wx257osn2
wx257osn2 / install.sh
Last active October 9, 2017 05:17
Warning script about commit to master branch(git pre-commit hook)
#!/bin/sh
mkdir -p ~/.git_template/hooks
git config --global init.templatedir ~/.git_template
cat pre-commit >> ~/.git_template/hooks/pre-commit
chmod +x ~/.git_template/hooks/pre-commit
@wx257osn2
wx257osn2 / algebraic_data_type.hpp
Last active October 3, 2015 04:34 — forked from plasma-effect/algebraic_data_type.hpp
algebraic_data_type
#pragma once
#ifndef PLASMA_ALGEBRAIC_DATA_TYPE
#define PLASMA_ALGEBRAIC_DATA_TYPE
// Copyright plasma-effect 2015
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include<tuple>
#include<memory>
@wx257osn2
wx257osn2 / state3.cpp
Created May 20, 2015 01:24
ねるねるねるね with Direct2D1.0
#include <will/_2dim.hpp>
#include <will/com.hpp>
#include <vector>
#include <cstdint>
#include <cmath>
#include <d2d1.h>
std::int64_t timer;
double w, h;
Checking file system on C:
The type of the file system is NTFS.
Volume label is Windows 8.
A disk check has been scheduled.
Windows will now check the disk.
CHKDSK is verifying files (stage 1 of 5)...
@wx257osn2
wx257osn2 / gist:8cee1725d5275e9993ce
Last active August 29, 2015 14:16
ICE at Torino(VC++ Nov 2013 CTP)
#pragma warning(disable:4592)
#pragma warning(disable:4425)
#pragma warning(disable:4503)
#include<utility>
#include<tuple>
#include<memory>
namespace temple{