Skip to content

Instantly share code, notes, and snippets.

View kazmura11's full-sized avatar

Kaz Mu kazmura11

View GitHub Profile
@kazmura11
kazmura11 / test.cpp
Last active August 29, 2015 14:06
UTF-8, UTF-16出力
#include <stdio.h>
int main()
{
const wchar_t *utf8fname = L"test1.txt";
const wchar_t *utf8str_en = L"Hello World\n";
const wchar_t *utf8str_ja = L"こんにちは!\n";
FILE *fp1;
if ( (fp1 = _wfopen(utf8fname, L"w, ccs=UTF-8")) != NULL )
{
@kazmura11
kazmura11 / no1.cpp
Created September 27, 2014 12:28
dynamic allocation 1 c++
#include <cstdlib>
#include <cstring>
#include <cstdio>
namespace {
const int SizeY = 64;
const int SizeX = 8;
}
int main()
@kazmura11
kazmura11 / no2.cpp
Created September 27, 2014 12:28
dynamic allocation 2 c++
#include <cstdlib>
#include <cstring>
#include <cstdio>
namespace {
const int SizeY = 64;
const int SizeX = 8;
}
int main()
@kazmura11
kazmura11 / no3.cpp
Last active August 29, 2015 14:06
dynamic allocation 3 c++
#include <cstdlib>
#include <cstring>
#include <cstdio>
namespace {
const int SizeY = 64;
const int SizeX = 8;
}
int main()
@kazmura11
kazmura11 / AppMain.cpp
Created September 27, 2014 12:38
1次元の自動領域確保ですよっと
#include "DynamicArray.h"
#include <iostream>
// 以下テストコード
#define FILE_PATH_MAX 255
#define FILE_TIMESTAMP_MAX 15 /* YYYYMMDD HHMMSS */
struct FileData {
char timestamp[FILE_TIMESTAMP_MAX + 1];
char filepath[FILE_PATH_MAX + 1];
};
@kazmura11
kazmura11 / AtomPub.cs
Last active August 29, 2015 14:07
はてなブログAtomPub POSTお試し
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using System.Xml.Linq;
// 2014/09/30 改定
// 多少冗長な書き方やめました。変な処理も修正。説明も追加
@kazmura11
kazmura11 / AtomPub.cs
Last active August 29, 2015 14:07
はてなブログAtomPub GETお試し
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using System.Xml.Linq;
// 2014/09/30 v1
// 多少冗長な書き方やめました。変な処理も修正。説明も追加
@kazmura11
kazmura11 / gethtml.py
Created October 1, 2014 17:06
htmlから力技で特定の要素を抜き出すサンプル
# -*- coding: utf-8 -*-
# using Python 3x
import urllib.request
def get_html(url):
httpres = None
res = ""
try:
httpres = urllib.request.urlopen(url)
# bytearrayでとってくるからデコードする
@kazmura11
kazmura11 / sample.cpp
Created October 1, 2014 17:15
コピーコンストラクタ&代入演算子のオーバーロード
#include <iostream>
#include <cstdlib>
namespace
{
enum ErrorCode
{
DataSetFault = 1,
MemoryAllocationFalut = 2
};
@kazmura11
kazmura11 / sample_ng.py
Created October 1, 2014 17:34
YAML読込みダメな例
#!/usr/bin/python
# -*- coding: utf-8 -*-
import yaml
import codecs
if __name__ == "__main__":
f = None
try:
f = codecs.open(u"test.yaml")
raw_data = f.read()