Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View HyodaKazuaki's full-sized avatar

Hyoda Kazuaki HyodaKazuaki

View GitHub Profile
@HyodaKazuaki
HyodaKazuaki / bmp.h.patchfile
Last active April 14, 2021 14:22
bmp画像ライブラリの修正
--- bmp.h.orig 2021-04-14 22:59:35.890000000 +0900
+++ bmp.h 2021-04-14 23:21:32.450000000 +0900
@@ -24,17 +24,17 @@ unsigned char Bmp_headbuf[HEADERSIZE];/*
unsigned char Bmp_Pallet[PALLETSIZE]; /* カラーパレットを格納 */
char Bmp_type[2]; /* ファイルタイプ "BM" */
-unsigned long Bmp_size; /* bmpファイルのサイズ (バイト) */
+uint32_t Bmp_size; /* bmpファイルのサイズ (バイト) */
unsigned int Bmp_info_header_size; /* 情報ヘッダのサイズ = 40 */
unsigned int Bmp_header_size; /* ヘッダサイズ = 54*/
@HyodaKazuaki
HyodaKazuaki / calc_bench.c
Created August 19, 2017 09:08
C言語による演算速度の計測
#include <stdio.h>
#include <time.h>
// ループ回数設定、今回は1億回
#define LOOP 100000000
int main(void)
{
// 変数宣言
int i, num;
@HyodaKazuaki
HyodaKazuaki / bash.sh
Created July 13, 2017 15:43
C++でのCGIプログラムコンパイル
clang++ -std=c++11 hello.cpp -o hello.cgi
@HyodaKazuaki
HyodaKazuaki / hello.cpp
Last active July 13, 2017 15:39
C++でのCGIプログラム
#include <stdio.h>
#include <stdarg.h>
template <typename ... Args>
void cprintf(const char *format, Args const & ... args);
int main(void)
{
cprintf("Content-type: text/html");
cprintf("");
@HyodaKazuaki
HyodaKazuaki / ParallelPrimeNumber.cs
Created January 12, 2017 09:37
並列化した素数計算プログラム
Console.Write("求めたい値を入力 >");
string target_str = Console.ReadLine();
long target = long.Parse(target_str);
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
bool flg = false;
sw.Start();
Parallel.For(2, 8202464, (i, loopstate) => {
if(target % i == 0)
{
@HyodaKazuaki
HyodaKazuaki / PrimeNumber.cs
Last active January 12, 2017 09:22
逐次実行の素数計算
Console.Write("求めたい値を入力 >");
string target_str = Console.ReadLine();
long target = long.Parse(target_str);
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
bool flg = false;
sw.Start();
long i = 2;
for (i = 2; i < target / i; i++)
{
@HyodaKazuaki
HyodaKazuaki / index.html
Created November 22, 2016 13:17
JavaScriptでイベントの伝播を止めつつonclickの内容を書き換える
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body onclick="console.log('0');">
<div onclick="console.log('1');">
<p onclick="console.log('2');">test</p>
</div>
<script src="./main.js"></script>
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE3
Created September 19, 2016 04:42
PATHINFOの注意
http://example.jp/hoge # これを以下のように変換している
http://example.jp/index.php?hoge # 説明したPATHINFOの形と違う
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE2
Created September 19, 2016 04:41
PATHINFO成功と失敗
http://example.jp/index.php/hoge # 成功
http://example.jp/hoge # 失敗
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE
Last active September 19, 2016 04:41
PATHINFOの例
# 例
http://example.jp/hoge/fuga.php # この場合は、hogeディレクトリ下のfuga.phpが呼び出される
http://example.jp/hoge.php/fuga # こうなると、hoge.phpディレクトリ下のfugaが存在しない場合、hoge.phpが呼び出され、/fugaはPATHINFOになる