Skip to content

Instantly share code, notes, and snippets.

View ttsuki's full-sized avatar
🫖
418 I'm a teapot

ttsuki ttsuki

🫖
418 I'm a teapot
View GitHub Profile
@ttsuki
ttsuki / ValueDomainDDNSUpdater.cs
Last active December 29, 2015 20:19
ぼくんちのNASで動いているValue Domain DDNS Updater
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
using System.Xml.XPath;
@ttsuki
ttsuki / DirectSound6chOutputTest.cpp
Created January 15, 2014 18:32
LPDIRECTSOUND8で6ch出力するテスト
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#include <tchar.h>
#include <intrin.h>
#include <cassert>
#include <cmath>
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
@ttsuki
ttsuki / x86cntlz64.cpp
Last active January 3, 2016 16:09
x86 で cntlz64 http://tu3.jp/01015
// BitScanForward.cpp
// compile with: /EHsc
#include <Windows.h>
#include <iostream>
#include <intrin.h>
static inline unsigned long bsr64_1(unsigned long long x)
{
// ptn.1 -> 20171ms
@ttsuki
ttsuki / siphash.cpp
Created January 18, 2014 19:28
SipHash: a fast short-input PRF http://131002.net/siphash/
/*
SipHash: a fast short-input PRF http://131002.net/siphash/
CC0 1.0 Universal (CC0 1.0)
Public Domain Dedication
<http://creativecommons.org/publicdomain/zero/1.0/>
*/
unsigned long long siphash(const void *in, size_t inlen);
unsigned long long siphash(const void *in, size_t inlen)
@ttsuki
ttsuki / BinarySegmentTree.cs
Last active August 29, 2015 14:00
2分セグメント木
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
class Program
{
/// <summary>
/// 2分セグメント木。RMQとかが解ける。
/// </summary>
@ttsuki
ttsuki / aoj_template.cpp
Last active February 12, 2020 22:11
tu3 競技プログラミング ライブラリ
////////////////////////////////////////
/// tu3 pro-con template ///
////////////////////////////////////////
#include "bits/stdc++.h"
using namespace std;
// -- typedefs -- //
#define EPS 1e-9
typedef long long llong;
@ttsuki
ttsuki / JpegEncoder.cpp
Last active August 29, 2015 14:05
GdiPlus::JpegEncoder
////////////////////////////////////////////////////////////////
// GdiPlus.dll を使ってJPEG圧縮を行う
// 使用にあたっては、OSにGdiPlus.dll が存在することを確認すること。
// 作成: 2014.08.31
////////////////////////////////////////////////////////////////
#include <Windows.h>
#include <cstdio> // printf
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
@ttsuki
ttsuki / intrusive_tree_base.cpp
Last active August 29, 2015 14:06
CC0 1.0 Universal
// intrusive_tree_base.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <tchar.h>
#include <cassert>
#include "intrusive_tree_base.hpp"
//以下テスト用コード。木構造にしたいノード。
// テキスト音楽「サクラ」 http://oto.chu.jp/ // dSakura.dll Version.2.374
//------------------------------------------------------------------------------
//_楽曲情報
//------------------------------------------------------------------------------
TrackName = {"Another Wing - Deep White - (MU2000EX+PLG150PF)"}
Copyright = {"つーさ http://tu3.jp/"}
MetaText = {"一つずつ積み上げ、昇っていく。高く高く。ただ一つの目的を果たすため。"}
// 高みに至るため自らを奮い立たせる、自己との問答と戦いの歌。
// #105 Wing の姉妹曲として、ある程度音源設定を共有しつつ制作。
@ttsuki
ttsuki / fontname.cpp
Last active January 13, 2021 02:00
.ttf/.otf/.ttc から、PostScript名とフォント名を調べる (Get PostScript name from .ttf;.otf;.ttc file.)
// .ttf/.otf/.ttc から、PostScript名と日本語フォント名を調べる
// Get PostScript name from .ttf;.otf;.ttc file.
// http://www.microsoft.com/typography/otspec/otff.htm
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#include <cstdio>
#include <errno.h>