Skip to content

Instantly share code, notes, and snippets.

View alphaKAI's full-sized avatar

Akihiro Shoji alphaKAI

View GitHub Profile
@alphaKAI
alphaKAI / .gvimrc
Last active August 29, 2015 14:27
My .vimrc , Requirements : NeoBundle
set transparency=15
set background=dark
let g:vimshell_editor_command = '/usr/local/Cellar/macvim/7.4-77/bin/gvim'
@alphaKAI
alphaKAI / amv.d
Created August 12, 2015 06:06
カレントディレクトリにある全てのファイル/ディレクトリを指定したディレクトリにmvするコマンド(D言語で書いた)
import std.stdio : writeln;
import std.array : array;
import std.regex : regex, match, replace;
import std.file : exists, isDir, getcwd, dirEntries, SpanMode, rename;
import std.conv : to;
import std.algorithm : map, each, filter;
void help(){
immutable space = " ";
writeln("All move command - Copyright (C) 2015 alphaKAI");
@alphaKAI
alphaKAI / matrixcpu.c
Last active August 29, 2015 14:26
matrixcpu.c - 行列で遊んでみた
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// If you want OMP Power
#define OMP_ENABLE
#ifdef OMP_ENABLE
#include <omp.h>
#endif
@alphaKAI
alphaKAI / consoleGrapher.d
Last active August 29, 2015 14:22
Console Grapher - コンソールにsinやcos, log10などあらゆるグラフを描画します(関数値にしたがって点をプロット)。 ただし、実装の都合上x,y平面のx,yが反転して描画されます。
/**
Console Grapher
Copyright (C) alphaKAI 2015 http://alpha-kai-net.info
The MIT License
*/
import std.algorithm,
std.range,
std.stdio,
@alphaKAI
alphaKAI / pythagoras.rb
Last active August 29, 2015 14:18
斜辺が1000以下のピタゴラス数を求めるプログラム (ベンチマーク用)
#encoding:utf-8
max = 1000
class Pythagoras
def initialize(a, b, c)
@a = a
@b = b
@c = c
end
@alphaKAI
alphaKAI / linkedList.c
Last active August 29, 2015 14:17
Simple LinkedList written in C
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/* List Structure */
/* int ListStruct */
#define TYPE int
typedef struct _listNode {
struct _listNode* prevNode;
@alphaKAI
alphaKAI / linkedList.d
Created March 19, 2015 01:42
Simple LinkedList written in D
import std.stdio;
class ListNode(T){
ListNode!T nextNode,
prevNode;
T value;
this(T arg){
value = arg;
}
}
@alphaKAI
alphaKAI / ap_gp.d
Created March 16, 2015 16:03
D言語でカリー化を用いて等差数列と等比数列書いてみた例(適当な例)
import std.stdio;
template curry(alias func){
import std.algorithm, std.conv, std.range, std.traits;
alias argsintuple = ParameterTypeTuple!func;
immutable lambdaStr = (lamArgs =>
(temp){
foreach(i, e; argsintuple)
temp ~= "(" ~ e.stringof ~ " " ~ lamArgs[i] ~ ") => ";
@alphaKAI
alphaKAI / curry.d
Last active August 29, 2015 14:17
D言語でカリー化実装してみた
import std.stdio;
template curry(alias func){
import std.algorithm, std.conv, std.range, std.traits;
alias argsintuple = ParameterTypeTuple!func;
immutable lambdaStr = (lamArgs =>
(temp){
foreach(i, e; argsintuple)
temp ~= "(" ~ e.stringof ~ " " ~ lamArgs[i] ~ ") => ";
@alphaKAI
alphaKAI / ap.d
Created March 13, 2015 15:22
等差数列
import std.stdio;
int f(int a, int d, int n){
return a + d * (n - 1);
}
int sumf(int n, int function(int) fx){
return n * (fx(1) + fx(n)) / 2;
}