Skip to content

Instantly share code, notes, and snippets.

@kcha4github
kcha4github / WCharToCharOnWindows.cpp
Created April 7, 2020 01:55
Convert wchar_t to char in windows
#include <cstdio>
#include <cstdlib>
int main()
{
const wchar_t str[] = L"wcstombs example";
char buffer[32];
printf("wchar_t string: %ls \n", str);
#include <cstddef>
#include <limits>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstdlib>
#include <new>
#include <typeinfo>
#include <exception>
#include <initializer_list>
#include <cstddef>
#include <limits>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstdlib>
#include <new>
#include <typeinfo>
#include <exception>
#include <initializer_list>
#include <iostream>
#include <vector>
using namespace std;
typedef struct {
int id;
const char* name;
}INFO;
@kcha4github
kcha4github / test_strstr.c
Created January 10, 2020 01:59
C string Library strstr() Test
/* strstr test */
/* from http://www.cplusplus.com/reference/cstring/strstr/ */
/*
result:
address str[10]: 00F1FCB2
address strstr result: 00F1FCB2
address strstr miss: 00000000
*/
#include <stdio.h>
#include <string.h>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FactoryMethodPatternTest
{
public abstract class Product
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FactoryMethodPatternTest
{
public abstract class Product
@kcha4github
kcha4github / DebugTest.cpp
Created July 23, 2019 02:14
TEST Using OutputDebugString function in C++ (String in Visual Studio)
#include <iostream>
#include <Windows.h>
int main()
{
std::cout << "Hello World!\n";
//! デフォルトのUnicode使用では文字列が適さない
//OutputDebugString("エラー発生!\n");
#ifdef _UNICODE
OutputDebugStringA("エラー発生[Unicode]\n");
@kcha4github
kcha4github / dora.shader
Created January 26, 2019 05:33
Japanese No.1 Idol Blue Raccoon Dog. For glsl Editor: http://jp.wgld.org/js4kintro/editor/
precision mediump float;
uniform float t; // time
uniform vec2 r; // resolution
const float PI = 3.1415926;
const vec2 nosePos = vec2(0.0, 0.1); // 鼻の位置
const vec3 collarColor = vec3(0.95, 0.25, 0.25); // 首輪の色
const vec3 lightColor = vec3(0.95, 0.95, 0.5); // 背景の後光の色
const vec3 backColor = vec3(0.95, 0.25, 0.25); // 背景の下地の色
const vec3 faceColor = vec3(0.00, 0.72, 0.93); // 顔の色
@kcha4github
kcha4github / test_deep4.py
Created October 28, 2018 21:35
ゼロから作るDeep Learning 4.3.3 偏微分のグラフ
import numpy as np
import matplotlib.pylab as plt
# 4.3.3
# 関数 f(x0, x1) = x0 ** 2 + x1 ** 2 の実装:2変数関数であることに注意
# 引数に numpy 配列を想定
def function_2(x):
return x[0] ** 2 + x[1] ** 2
from mpl_toolkits.mplot3d import Axes3D