Skip to content

Instantly share code, notes, and snippets.

@siritori
siritori / index.haml
Created November 14, 2014 01:46
複素関数論 マンデルブロ集合
!!!html5
%html
%body
%form{:action => '.', :method => 'get'}
width
%input{:name => 'width', :value => @params['width']}
height
%input{:name => 'height', :value => @params['height']}
fineness
%input{:name => 'fineness', :value => @params['fineness']}
@siritori
siritori / CreateClass.java
Created May 27, 2014 02:02
情報科学I
class Disp
{
void display() {
System.out.println("No argument");
}
void display(String s) {
System.out.println(s);
}
void display(String s, int n) {
System.out.println(s + ", " + n);
@siritori
siritori / ArgsCheck.java
Created May 20, 2014 01:53
情報科学I
public class ArgsCheck
{
public static void main(String args[]) {
if(args.length != 1) {
System.err.println("Wrong arguments");
return;
}
int number = Integer.parseInt(args[0]);
if(check(number)) {
System.out.println(number + " is OK!");
@siritori
siritori / Letter.java
Created May 13, 2014 01:30
情報科学I
public class Letter
{
public static void main(String args[]) {
char ch = args[0].charAt(0);
System.out.println("Input a letter[A-E] : " + ch);
switch(ch) {
case 'A':
System.out.println("Excellent");
break;
case 'B':
@siritori
siritori / Area.java
Created May 9, 2014 01:44
情報科学I
public class Area
{
public static void main(String args[]) {
double width = Integer.parseInt(args[0]);
double height = Integer.parseInt(args[1]);
System.out.println("Input Width : " + width);
System.out.println("Input Height : " + height);
System.out.println("Triangle Area : " + width * height / 2.0);
System.out.println("Square Area : " + width * height);
System.out.println("Circle Area : " + width * width * 3.14);
@siritori
siritori / expr.cpp
Last active January 1, 2016 09:09
comp2013 - arithmetic expression parser
#include <iostream>
#include <memory>
#include <cctype>
#include <cassert>
#include "expr.h"
namespace {
expr::ptr read_number(std::istream &is);
expr::ptr read_factor(std::istream &is);
@siritori
siritori / gist:4967071
Created February 16, 2013 14:06
My first CPU which executes Whitespace!
// INSTRUCTIONS
`define PUSH 0
`define DUP 1
`define COPY 2
`define SWAP 3
`define POP 4
`define SLIDE 5
`define ADD 6
`define SUB 7
`define MUL 8
module memory(CLK, WR, addr, data);
// default parameters
parameter WORD = 32;
parameter LEN = 65535;
input CLK;
input WR; // 0:read 0:write
input [WORD-1:0]addr;
inout [WORD-1:0]data;
@siritori
siritori / hoge.cpp
Created January 29, 2013 23:15
なんでエラーでるんー
#include <iostream>
#include <list>
#include <memory>
class hoge;
typedef std::shared_ptr<hoge> hoge_ptr;
class hoge
{
public:
hoge(const int x):x_(x)
@siritori
siritori / client.ml
Created December 19, 2012 01:14
HTTP client
let bufsize = 1024;;
let port = 80;;
let http_get sock =
let rec http_get' sock acc =
let buf = String.create bufsize in
if Unix.read sock buf 0 (String.length buf) = 0 then acc
else http_get' sock acc ^ buf
in http_get' sock "";;