Skip to content

Instantly share code, notes, and snippets.

@t-mat
t-mat / xinput_test.cpp
Created January 7, 2012 00:49
XInput test
#include <windows.h>
#include <xinput.h>
#include <stdio.h>
// Compatibility for old XInput.h
#ifndef XUSER_MAX_COUNT
#define XUSER_MAX_COUNT 4
#endif
#pragma comment(lib, "xinput.lib")
@t-mat
t-mat / gist:1581005
Created January 9, 2012 04:06
libtorrentを試す
@t-mat
t-mat / CheckExistingInstnace.h
Created January 11, 2012 11:53
Windows SDK : Mutexを用いて、同一アプリケーションの複数起動を判別する
// Mutexを用いて、同一アプリケーションの複数起動を判別する
/*
使い方:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT) {
CheckExistingInstance exin("Your App's Unique Identifier String");
if(exin.isExist()) {
return 0; // 既に存在したので、何もせずに終了
}
...
};
@t-mat
t-mat / SetStringToClipboard.cpp
Created January 11, 2012 12:19
Windows SDK : クリップボードにTCHARテキストをコピーする
#include <windows.h>
#include <tchar.h>
void setStringToClipboard(const TCHAR* str) {
if(OpenClipboard(0)) {
EmptyClipboard();
size_t l = _tcslen(str);
if(l) {
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (l+1) * sizeof(*str));
if(h) {
@t-mat
t-mat / ps-bootstrap-tools.ps1
Created January 13, 2012 08:07
PowerShellのみを用いて、curl, 7zaをダウンロード、展開し、使える状態にする
# 作業用ディレクトリ $t を定義 (C:\Users\<ユーザ名>\mytemp)
$t="$env:USERPROFILE\mytemp"
mkdir $t
pushd $t
# 新しいツール類のバイナリを入れるディレクトリ $n を定義 (C:\Users\<ユーザ名>\bin)
$n="$env:USERPROFILE\bin"
# $n を作り、一時的に PATH へ追加
mkdir -force $n
@t-mat
t-mat / my_sha256.cpp
Created January 14, 2012 17:50
SHA256ハッシュを算出する
/*
http://www.ouah.org/ogay/sha2/
から SHA-256 部分だけを抜き出してテキトーに書き換えたもの。BSDライセンス
*/
/*
* FIPS 180-2 SHA-224/256/384/512 implementation
* Last update: 02/02/2007
* Issue date: 04/30/2005
*
* Copyright (C) 2005, 2007 Olivier Gay <olivier.gay@a3.epfl.ch>
@t-mat
t-mat / disp-cc-readme.md
Created January 18, 2012 01:35
xyzzy自前アンチエイリアスパッチ(のやりかけ)

何をするもの?

xyzzy0.2.2.235のsrc/disp.ccに不完全なアンチエイリアス描画機能をつける。

手元の用途では、等幅のメイリオで十分だと分かったので、 やりかけのまま。

コンパイル

disp.cc を適宜書き換え、src/Makefileのコンパイル指定(CXX)に -DUSE_XYZZY_TEXT_ANTI_ALIAS を追加してから、コンパイルを行う。

@t-mat
t-mat / compare-smart-phones.md
Created January 18, 2012 01:50
端末比較

iPhone4s 140g, 115x59x10, 3.5in, 960x640

iPodTouch 4G 101g, 111x59x7, 3.5in, 960x640

htc evo 4G 170g, 122x66x13, 4.3in, 800x480

docomo NEXT series GALAXY S II LTE SC-03D

@t-mat
t-mat / how-to-build-xyzzy-vc-2010.md
Created January 18, 2012 04:14
xyzzy0.2.2.235をvc++2010でビルドする
@t-mat
t-mat / Windows用代替コンソールの比較.md
Created January 18, 2012 04:18
Windows用代替コンソールの比較

Windows上の代替コンソールを色々試してみる

代替コンソールではなく、cmd.exeへのフック。