Skip to content

Instantly share code, notes, and snippets.

@taish
taish / DFT.java
Created January 9, 2015 03:18
フーリエ変換
import java.text.*;
public class DFT {
public static void main(String args[]) {
int N = 16;
double xr[] = new double[N]; // 時間信号の実数部
double xi[] = new double[N]; // 時間信号の虚数部
double Xr[] = new double[N]; // 周波数領域の関数の実数部
double Xi[] = new double[N]; // 周波数領域の関数の虚数部
NumberFormat nf = new DecimalFormat("0.00"); // 出力の桁数をそろえるための工夫
@taish
taish / sort.c
Created December 21, 2014 06:24
中間レポートsortコマンド
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void puts_file(char *path);
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <Server IP> <Echo Word> [<Echo Port>]\n", argv[0]);
exit(1);
@taish
taish / uniq.c
Created December 20, 2014 09:15
中間レポートuniqコマンドを作る
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 256
#define YES 1
#define NO 0
void puts_file(char *path, int option);
@taish
taish / odds_calculator.rb
Created July 31, 2014 11:57
ポーカーのオッズ計算
pod = ARGV[0].to_i
call = ARGV[1].to_i
player = ARGV[2].to_i || 2
odds = (pod + (call * player)) / call
percentage = 100 / odds
require_outs = percentage / 2
s = ["プレイヤー#{player}人, ポッドは#{pod}$で, あなたが #{call}$でコールするには",
"オッズは#{odds}倍以上必要で",
@taish
taish / reprodule_rails_bug
Created June 24, 2014 15:17
reprodule bug with polymorphic assosiation
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@taish
taish / reproduce_bug.rb
Last active August 29, 2015 14:02
reproduce bug script
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
[
// how to move in the filer with hjkl
{ "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
},
{ "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
},
{ "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
{
"color_scheme": "Centurion.sublime-theme",
"theme": "Centurion.sublime-theme",
"font_face": "Menlo",
"font_size": 11,
"ignored_packages": [],
"rulers":
[
80
],