Skip to content

Instantly share code, notes, and snippets.

View nanase's full-sized avatar
🏄
Making.

Nanase nanase

🏄
Making.
View GitHub Profile
#include <stdio.h>
#define METER_TO_INCH (39.370)
int main(void) {
float meter, inch;
printf("メートルを入力してね[m]: ");
scanf("%f", &meter);
@nanase
nanase / pi2.c
Created October 29, 2013 05:10
モンテカルロ法
char mes0[] = { 0xe8, 0xa8, 0x88, 0xe7, 0xae, 0x97, 0 , 0 , 0, 0 , 0 , 0 ,0}
, mes1 [ ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0xe5 , 0x9b , 0x9e , 0xe6 , 0x95 , 0xb0
, 0xe3, 0x82, 0x92, 0xe5 , 0x85, 0xa5 , 0xe5 , 0x8a , 0x9b , 0x3a , 0x20 , 0 , 0 , 0
, 0 } , mes2 [ ] = { 0x25 , 0x6c , 0x6c , 0x64 , 0 } , mes3 [ ] = { 0 , 0 , 0 , 0
, 0 , 0 , 0xe4 , 0xb8 , 0xad , 0x2e , 0x2e , 0x2e , 0x28 , 0x25 , 0x36 , 0x2e , 0x32
, 0x66 , 0x25 , 0x25 , 0x29 , 0x20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , mes4 [ ] = { 0x50
, 0x49 , 0x20 , 0x3d , 0x20 , 0x25 , 0x2e , 0x36 , 0x66 , 0xa , 0 , 0 } , mes5 [ ] = { 0xa
, 0 , 0 , 0 , 0 , 0 ,0,0xe5, 0xae
, 0x8c , 0xe4,0xba ,0x86 , 0xa ,
@nanase
nanase / sitrine_sample2.cs
Last active December 30, 2015 10:59
https://gist.github.com/nanase/6343182 をSitrine v0.2-devでの記述に変換してみた。だいぶコード量が減ってる。
using System.Diagnostics;
using System.Drawing;
using OpenTK.Graphics;
using OpenTK.Input;
using Sitrine;
using Sitrine.Audio;
using Sitrine.Story;
using Sitrine.Utils;
namespace Sample
@nanase
nanase / alsa_test.c
Last active January 1, 2016 19:59
ALSAの動作テスト。標準入力にWAVファイルを入れてください。(例: ./alsa_test < tone.wav)
// コンパイル方法
// gcc alsa_test.c -o alsa_test -lasound
// 参考元
// [ALSA デバイスにアクセスして音楽を流してみるテスト]
// http://d.hatena.ne.jp/harre_orz/20100314/1268562058
//
// [ALSAの叩き方]
// http://ameblo.jp/fadis/entry-10401645869.html
@nanase
nanase / alsa_test_easy.c
Created January 2, 2014 16:40
EasyAlsaを使用したC言語ALSA経由のPCMの再生コード例。標準入力にWAVファイルを入れてください。(例: ./a.out < tone.wav)
// コンパイル例
// gcc alsa_test_easy -Wl,-rpath,./lib -L./lib -lEasyAlsa
#include <stdio.h>
#include <stdlib.h>
#include <alsaout.h>
int main(int argc, char* args) {
@nanase
nanase / alsaout.d
Created January 2, 2014 16:42
EasyAlsaのalsaout.hをhtodでD言語用に変換したものそのまま。
/* Converted to D from alsaout.h by htod */
module alsaout;
/* LICENSE - The MIT License (MIT)
Copyright (c) 2014 Tomona Nanase
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@nanase
nanase / alsaTest.d
Last active January 2, 2016 00:18
D言語でEasyAlsaを用いて標準入力のデータを再生。(DMD64 D Compiler v2.060)
// コンパイル例
// dmd alsaTest.d alsaout.d -L./libEasyAlsa.so
import std.stdio;
import alsaout;
void main(string[] args) {
const uint frames = 1024;
const int size = cast(int)(frames * short.sizeof * 2);
@nanase
nanase / alsaTest.d
Last active January 2, 2016 00:19
RaspberryPi上のgdcでD言語からALSAで再生。再生データは標準入力から。libEasyAlsa.soはARM用にコンパイルが必要。gdc-4.4, gcc version 4.4.7 (Debian/Linaro 4.4.7-1+rpi1)
// コンパイル例
// gdc-4.4 alsaTest.d alsaout.d -Wl,-rpath,./ -L./ -lEasyAlsa
// EasyAlsa: https://github.com/nanase/EasyAlsa
import std.stdio, std.c.stdio;
import alsaout;
void main(string[] args) {
const uint frames = 1024;
@nanase
nanase / codeFormat_nanase.vssettings
Created March 12, 2014 08:33
VS用C#フォーマットファイル(nanase ver.)
<UserSettings>
<ApplicationIdentity version="11.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="CSharp" RegisteredName="CSharp" PackageName="Text Management Package">
<PropertyValue name="TabSize">4</PropertyValue>
<PropertyValue name="AutoListMembers">true</PropertyValue>
<PropertyValue name="IndentStyle">2</PropertyValue>
<PropertyValue name="HideAdvancedMembers">true</PropertyValue>
<PropertyValue name="ShowNavigationBar">true</PropertyValue>
@nanase
nanase / codeFormat_owen.vssettings
Created March 12, 2014 08:34
VS用C#フォーマットファイル(owen ver.)
<UserSettings>
<ApplicationIdentity version="11.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="CSharp" RegisteredName="CSharp" PackageName="Text Management Package">
<PropertyValue name="TabSize">4</PropertyValue>
<PropertyValue name="AutoListMembers">true</PropertyValue>
<PropertyValue name="IndentStyle">2</PropertyValue>
<PropertyValue name="HideAdvancedMembers">true</PropertyValue>
<PropertyValue name="ShowNavigationBar">true</PropertyValue>