Skip to content

Instantly share code, notes, and snippets.

View nkoneko's full-sized avatar

Nekomura, Koneko nkoneko

  • Tokyo
View GitHub Profile
#!/bin/bash
usage() {
1>&2 cat <<EOS
Usage: ${0} --work-dir SVN_WORK_DIR --repo SVN_REPOS_URL --user SVN_USER:SVN_PASSWORD
EOS
}
log() {
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
unsigned short calc(unsigned short u)
{
return u ^ (u >> 1);
}
void print_bits(unsigned short u, unsigned short v)
-module(concurrent1).
-export([pong/0, ping/1, start/1]).
pong() ->
receive
{From, Msg} ->
io:format("Pong received ~w~n", [Msg]),
From ! {self(), Msg},
pong();
term ->
namespace Monad
{
interface IEither<out E, V> {}
public class Either<E, V> : IEither<E, V>
{
public readonly E Error;
public V Value { get; private set; }
public bool HasError { get; private set; }
public Either(E error)
{
namespace Example
module Main = begin
open Monad.Maybe;
let maybeString (s:string) =
if s = null || s.Length = 0 then Nothing
else Just s;
let a2A (s:string) =
namespace System.Monad
{
public class Error
{
private Error() { }
public sealed class ErrorM<A> : Error, IMonad<A, Error>
{
public IMonad<B, Error> Return<B>(B val)
{
return new ErrorM<B> { Value = val, Exc = default(Exception), HasError = false };
namespace System.Monad
{
// Monad m => m A
// e.g. Maybe Int when m = Maybe and A = Int
public interface IMonad<A, M>
{
// Monad m => b -> m b
IMonad<B, M> Return<B>(B val);
// Monad m => m a -> (a -> m b) -> m b
IMonad<B, M> Bind<B>(Func<A, IMonad<B, M>> f);
public class Program
{
static void Main(string[] args)
{
string str = "Hello work!";
Test(str,
error =>
{
Console.WriteLine(error.Message);
Console.ReadLine();
#include <iostream>
#include <vector>
#include <algorithm>
int main(void)
{
int i;
std::vector<int> v;
while (std::cin >> i)
{
use std::io::Timer;
use std::io::timer;
use std::time::duration::Duration;
fn main() {
let (sc1, rc1) = channel();
let (sc2, rc2) = channel();
let mut timer = Timer::new().unwrap();
let timeout1 = timer.oneshot(Duration::milliseconds(1000));