Skip to content

Instantly share code, notes, and snippets.

@hkuno9000
hkuno9000 / printf-null.cpp
Created April 15, 2015 07:57
TESTCODE: NULL is safe as a argument of printf("%s")
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buf[200];
puts("*** test printf NULL");
printf( "printf :%s,%S,%ws\n", NULL, NULL, NULL);
#ifdef _MSC_VER
sprintf_s(buf, "sprintf_s:%s,%S,%ws\n", NULL, NULL, NULL); puts(buf);
#endif
@hkuno9000
hkuno9000 / gitignore_global.txt
Last active February 15, 2016 00:09
my gitignore_global
#{{{ my add
# sytem folders
vssver.scc
.svn/
Debug/
Release/
Unicode_Debug/
Unicode_Release/
Mbcs_Debug/
@hkuno9000
hkuno9000 / gitconfig
Last active September 30, 2020 07:13
my git alias and difftool/mergetool for WinMerge
# git config --global -e
[core]
autocrlf = true
excludesfile = C:/Users/hkuno/Documents/gitignore_global.txt
quotepath = false
## http://orangeclover.hatenablog.com/entry/20121004/1349353957
## editor = 'C:/Program Files (x86)/Hidemaru/Hidemaru.exe' //fu8
## editor = 'C:/Program Files (x86)/sakura/sakura.exe' -code=4
## editor = 'C:/Program Files (x86)/EmEditor/EmEditor.exe' //cp 65001
## editor = 'C:/Program Files (x86)/TeraPad/TeraPad.exe' //cu8
@hkuno9000
hkuno9000 / install-ansicon.md
Last active August 29, 2015 14:27
color-prompt for Windows7's cmd.exe

ansiconを使って、Windows7のコマンドプロンプトに色をつける.

インストール手順

  • https://github.com/adoxa/ansicon/releases から ansi166.zip をダウンロードして適当なフォルダへ展開する.
  • 展開したフォルダの x64 フォルダ下の ansicon.exe -i を実行すると、機能ONとなる.
  • 機能OFFするなら -u オプションで実行する.

コマンドプロンプト色付けバッチファイル.

prompt コマンドにANSIエスケープシーケンスを追加して色付けする. 色設定は各自の好みで調整する.

@hkuno9000
hkuno9000 / excel-clear-junk-style.vbs
Last active August 7, 2018 04:26 — forked from YoshihitoAso/gist:311b0a1d40174e1bfdae
[Excel]excelシートの書式をすべて削除するマクロ
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
For Each strFname In WScript.Arguments
Set objDoc = objExcel.Workbooks.Open(strFname)
' clear all names (comment out)
For Each N In objDoc.Names
'' N.Delete
Next
' clear all user style
@hkuno9000
hkuno9000 / auto_buffer.h
Created October 1, 2015 17:50
smart buffer for C++11
/// smart buffer for C++11
template<typename T, size_t N=256> class auto_buffer {
T mSmallBuf[N];
T* mBuf = mSmallBuf;
size_t mHeapSize = 0;
size_t mBufSize = N;
public:
auto_buffer() = default;
auto_buffer(const auto_buffer&) = delete; // no copy
auto_buffer& operator=(const auto_buffer&) = delete; // no copy
@hkuno9000
hkuno9000 / setlang.bat
Last active October 14, 2015 00:10
set LANG and LESSCHARSET for the msysgit on windows cmd shell
@echo off
if "%1"=="sjis" goto sjis
if "%1"=="utf8" goto utf8
if "%1"=="clear" goto clear
echo usage: %0 [ sjis ^| utf8 ^| clear ]
goto end
:sjis
set LANG=ja_JP.SJIS
set LESSCHARSET=dos
set TZ=JST-9
@hkuno9000
hkuno9000 / printpath.bat
Last active October 14, 2015 00:14
print a environment variable separeted by ";"
@echo off
setlocal
set NAME=%1
if "%1"=="" set NAME=PATH
perl -e "print join(qq/\n/,split(q/;/,$ENV{%NAME%}));"
@hkuno9000
hkuno9000 / doskey.mac
Last active September 11, 2022 18:37
my aliases on windows cmd shell + cygwin
alias=doskey /macros
a=doskey /macros
h=doskey /history
l=dir /b $*
ziplist=unzip -l $*
7zlist=7z l $*
patchzip=perl -n -e "print if s/^Index: //;" patch.diff | zip patch.zip -@
..=pushd ..\$*
...=pushd ..\..\$*
....=pushd ..\..\..\$*
@hkuno9000
hkuno9000 / file-sharemode.md
Last active July 24, 2024 19:50
CheetSheet file share mode

Win32/ATL

<WinNT.h>
#define FILE_SHARE_READ                 0x00000001
#define FILE_SHARE_WRITE                0x00000002
#define FILE_SHARE_DELETE               0x00000004

CreateFile(filename, access, sharemode, creation, attributes, ...);
CAtlFile::Open(filename, access, sharemode, creation, attributes, ...);