Skip to content

Instantly share code, notes, and snippets.

@okumura
okumura / NULL definition on Darwin
Created March 10, 2011 12:34
NULL definition on Darwin
#ifdef __cplusplus
#ifdef __GNUG__
#define __DARWIN_NULL __null
#else /* ! __GNUG__ */
#ifdef __LP64__
#define __DARWIN_NULL (0L)
#else /* !__LP64__ */
#define __DARWIN_NULL 0
#endif /* __LP64__ */
#endif /* __GNUG__ */
@okumura
okumura / NULL definition on Windows SDK v7.1 windef.h
Created March 10, 2011 12:42
NULL definition on Windows SDK v7.1 windef.h
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
@okumura
okumura / NULL definition on Visual Studio 2005 stdio.h
Created March 10, 2011 12:40
NULL definition on Visual Studio 2005 stdio.h
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
@okumura
okumura / NULL definition on FreeBSD
Created March 10, 2011 12:33
NULL definition on FreeBSD
#ifndef NULL
#if !defined(__cplusplus)
#define NULL ((void *) 0)
#else
#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
#define NULL __null
#else
#if defined(__LP64__)
#define NULL (0L)
#else
@okumura
okumura / OpenSSL finalization
Created March 11, 2011 22:24
OpenSSL finalization
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
ERR_remove_state(0);
EVP_cleanup();
@okumura
okumura / OpenSSL initialization
Created March 11, 2011 22:24
OpenSSL initialization
SSL_library_init();
SSL_load_error_strings();
RAND_poll();
while (RAND_status() == 0) {
unsigned short rand_ret = rand() % 65536;
RAND_seed(&rand_ret, sizeof(rand_ret));
}
@okumura
okumura / git export
Created March 11, 2011 21:53
git export
git checkout-index -a -f --prefix=export/
@okumura
okumura / Get Stack Trace to String by Java.
Created July 19, 2013 06:03
Get Stack Trace to String by Java.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
new Throwable().printStackTrace(pw);
String stackTraceString = sw.toString();
# .ssh/config
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh_github/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes
@okumura
okumura / setup-scm-for-win.bat
Last active December 26, 2015 14:39
Setup SCM for Windows.
rem TortoiseGit (x64)
start /wait msiexec /i http://download.tortoisegit.org/tgit/1.8.6.0/TortoiseGit-1.8.6.0-64bit.msi /passive
rem TortoiseSVN (x64)
start /wait msiexec /i http://downloads.sourceforge.net/project/tortoisesvn/1.8.2/Application/TortoiseSVN-1.8.2.24708-x64-svn-1.8.3.msi /passive
rem TortoiseSVN (x64) 1.6.x
start /wait msiexec /i http://downloads.sourceforge.net/project/tortoisesvn/1.6.16/Application/TortoiseSVN-1.6.16.21511-x64-svn-1.6.17.msi/passive
rem TortoiseGit (x86)