Skip to content

Instantly share code, notes, and snippets.

😇

ttsuki ttsuki

😇
Block or report user

Report or block ttsuki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ttsuki
ttsuki / TrustedCertificates.cpp
Created Aug 5, 2019
Trusted Root CA Certificates hash list from Windows Update
View TrustedCertificates.cpp
#include "TrustedCertificates.h"
#include <stdexcept>
#include <algorithm>
#include <array>
#include <cstring>
namespace TrustedCertificates
{
namespace
View getAuthRootCertificatesHashListFromWindowsUpdate.cygwin.sh
set -eu
tmpdir=$(mktemp -d -p './')
trap "rm -rf $tmpdir" EXIT
certutil -syncWithWU $(cygpath -w $tmpdir) 1>&2
certhash() {
echo $(openssl x509 $1 -fingerprint -noout -inform der -in $2 | cut -d '=' -f 2 | tr -d ':' | tr '[A-Z]' '[a-z]')
}
View expect_success.hpp
#ifdef _DEBUG
#define LOG_FAIL(file,line) printf("EXPECTATION FAILED: %s:%d\n",file,line)
#define EXPECT_SUCCESS (([]() { struct X { HRESULT operator ,(HRESULT r) const { if (FAILED(r)) { LOG_FAIL(__FILE__, __LINE__); if (IsDebuggerPresent()) { DebugBreak(); } } return r; } }; return X(); })()),
#define EXPECT_TRUE (([]() { struct X { bool operator ,(bool r) const { if (!r) { LOG_FAIL(__FILE__, __LINE__); if (IsDebuggerPresent()) { DebugBreak(); } } return r; } }; return X(); })()),
#else
#define EXPECT_SUCCESS
#define EXPECT_TRUE
#define LOG_FAIL(file,line)
#endif
View stdArrayOf.hpp
template<typename T, std::enable_if_t<std::is_array_v<T>, std::nullptr_t> = nullptr>
struct arrayInfo
{
using element_t = typename std::remove_reference<decltype(*std::begin(std::declval<T&>()))>::type;
static constexpr size_t length = sizeof(T) / sizeof(element_t);
using asStdArray = std::array<element_t, length>;
};
template<class T>
using stdArrayOf = typename arrayInfo<T>::asStdArray;
View .tmux.conf
# prefix key を C-b から C-a に。
unbind C-b
set -g prefix C-a
# window番号を1-origin
set -g base-index 1
# マウス
setw -g mouse on
View TabSplitStream.hpp
#include <sstream>
#include <locale> // std::ctype<>, std::locale
static std::istringstream TabSplitStream(const std::string &s)
{
struct tsv_ctype_t
{
std::vector<std::ctype<char>::mask> ctable;
std::ctype<char>::mask *make_table()
{
@ttsuki
ttsuki / cygwin-setup.sh
Last active Apr 27, 2019
cygwin 入れてるパッケージリスト
View cygwin-setup.sh
# wget だけは入れておく必要ある
## wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg -O /sbin/apt-cyg
wget https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg -O /sbin/apt-cyg
chmod 755 /sbin/apt-cyg
PATH=/sbin:$PATH
apt-cyg install screen tmux
apt-cyg install vim vim-common
apt-cyg install openssl
@ttsuki
ttsuki / mkv2cue.xslt
Created Jul 3, 2017
mkvextract chapters "hogefugapiyo.mkv" | xsltproc mkv2cue.xslt -
View mkv2cue.xslt
<?xml version="1.0" encoding="Shift_JIS"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="Shift_JIS"/>
<xsl:template match="/">
<xsl:text>FILE "alltrack.wav" WAVE&#xA;</xsl:text>
<xsl:apply-templates select="//ChapterAtom" />
</xsl:template>
<xsl:template match="ChapterAtom">
@ttsuki
ttsuki / multilib.sh
Last active Jun 12, 2017
Alternative x265/build/msys/multilib.sh (link statically libstdc++)
View multilib.sh
#!/bin/bash
set -eu
PREFIX=$HOME/x265
MAKEFLAGS=-j16
rm -rf build
mkdir -p build/{10bit,12bit}
cd build
# build 10bit static library.
View 残光2.setup.mml
Function XGXcl1(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val & $7F), $F7; }
Function XGXclV(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val / 128 & $7F), (_val & $7F), $F7; }
XGXcl1($00007E, 0); // XG SYSTEM ON
r8
r%1 XGXclV($020100, $0081); // Effect[Reverb] EffectType = HALL 2
r%1 XGXcl1($02010C, $40); // Effect[Reverb] Return = 64
You can’t perform that action at this time.