Skip to content

Instantly share code, notes, and snippets.

Nebuta nebuta

  • Japan
Block or report user

Report or block nebuta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9355965
binwidth = 1
bin(x,width)=width*floor(x/width)
plot 'histdata.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes
@nebuta
nebuta / delaunay-fiji.py
Last active Aug 29, 2015
Data processing on Fiji using Jython and a remote server.
View delaunay-fiji.py
import httplib, urllib, marshal
def getVal(table, i):
x = table.getValue('X', i)
y = table.getValue('Y', i)
return [x, y]
def draw_triangles(imp, triangles):
ip = imp.getProcessor()
@nebuta
nebuta / delaunay-server.hs
Last active Aug 29, 2015
Delaunay triangulation that runs as a service
View delaunay-server.hs
{-# LANGUAGE OverloadedStrings #-}
import Graphics.Triangulation.Delaunay
import Data.Vector.V2
import Data.Aeson
import Data.ByteString (ByteString)
import Data.Text.Lazy.Encoding (encodeUtf8)
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as TL
@nebuta
nebuta / determinant.rs
Created Mar 21, 2014
Matrix determinant calculation by cofactor expansion by Rust
View determinant.rs
use std::int::pow;
use std::rand;
use std::rand::Rng;
struct Matrix {
p: ~[int],
height: uint,
width: uint
}
@nebuta
nebuta / gsl_ffi_test.rs
Last active Aug 29, 2015
Rust FFI test with GSL
View gsl_ffi_test.rs
// gsltest.rs
//
// Rust version clone of the example of GSL linear algebra at
// http://www.gnu.org/software/gsl/manual/html_node/Linear-Algebra-Examples.html
//
// Works with Rust 0.9.
//
// Command for compiling on Mac OSX. You need to have GSL installed:
// rustc gsltest.rs -L/opt/local/lib
@nebuta
nebuta / tiff.rs
Last active Aug 29, 2015
Parsing TIFF files in Rust
View tiff.rs
// tiff.rs
// Compiles on rustc 0.10-pre (6eae7df 2014-03-20 15:01:47 -0700)
#[crate_id = "tiff"];
#[crate_type="bin"];
#[license = "MIT"];
#[desc = "TIFF reading example"];
//! TIFF reading library.
//! Supports multipage tiff files.
@nebuta
nebuta / split_and_to_i.rs
Created Apr 4, 2014
Rust stdin splitting and conversion to int
View split_and_to_i.rs
// Compiles on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700)
use std::io::BufferedReader;
use std::io::stdin;
fn main(){
let mut stdin = BufferedReader::new(stdin());
let l = stdin.read_line();
match l {
Ok(ll) => {
@nebuta
nebuta / echo.rs
Created Apr 4, 2014
Rust echo example
View echo.rs
// Compiles on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700)
use std::io::BufferedReader;
use std::io::stdin;
fn main(){
let mut stdin = BufferedReader::new(stdin());
for line in stdin.lines() {
match line {
Ok(l) => print!("{}",l),
@nebuta
nebuta / gcj_2009_qual_a.rs
Created Apr 5, 2014
Google Code Jam 2009 qual round: A. Alien Language
View gcj_2009_qual_a.rs
use std::io::BufferedReader;
use std::io::stdin;
// Google Code Jam: Qualification Round 2009, Problem A. Alien Language
//https://code.google.com/codejam/contest/90101/dashboard#s=p0
// Compiles on Rust 0.11-pre
// This uses unwrap() functions that can fail.
// This is okay for programming contest problems.
View rust-0.11-pre-cookbook.md

Rust Cookbook for Rubyists

These examples compile on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700)

Array

// vector testing

// Vector is kind of complicated part of Rust, partly because it's also convolved with pointers ~, &.
You can’t perform that action at this time.