Skip to content

Instantly share code, notes, and snippets.

View shinnya's full-sized avatar

foobar shinnya

  • Japan
View GitHub Profile
@shinnya
shinnya / gist:fead52c14f40efab7e881914973a383b
Created January 8, 2018 12:49 — forked from olifante/gist:222879
Interview with Joe Armstrong & Simon Peyton Jones

extracted from http://www.infoq.com/interviews/armstrong-peyton-jones-erlang-haskell

I'm Sadek Drobi. I'm here at Erlang Factory with Simon Peyton Jones and Joe Armstrong. Can you please tell us about yourselves and what you've been busy with lately?

JA: I'm Joe Armstrong and I'm at Erlang Factory. I've just been to a very nice talk where Simon has told us about the birth of Haskell and Erlang and how they point along parallel routes solving the same problems. I think we can talk a bit about that, because in your lecture you said things about "We tried that

@shinnya
shinnya / minscalaactors.scala
Created April 4, 2018 00:14 — forked from viktorklang/minscalaactors.scala
Minimalist Scala Actors
/*
Copyright 2012 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@shinnya
shinnya / thread.ml
Created April 7, 2018 01:15 — forked from eatonphil/thread.ml
Basic thread logic based on condition variables in Poly/ML
(*
* Tested in Poly/ML. To compile: `polyc thread.ml && ./a.out`
*
* Heavily influenced by: http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf
* Poly/ML Thread documentation here: http://www.polyml.org/documentation/Reference/Threads.html
* Poly/ML Thread implementation here: https://github.com/polyml/polyml/blob/master/basis/Thread.sml
*)
val done = ref false;
val m = Thread.Mutex.mutex();
@shinnya
shinnya / List.cpp
Created July 10, 2018 15:50
Incorrect Doubly Linked List
#include <memory>
#include <string>
#include <iostream>
using namespace std;
template <typename K, typename V>
struct Node
{
K key;
@shinnya
shinnya / index.md
Created October 29, 2018 07:02
rust rfc2535

2535-or-patterns -

Summary

パターンマッチ内で任意にネストした形式で |(or pattern) を使えるようにする。 記法は Some(A(0) | B(1 | 2)) のようになる。

以前は Some(A(0)) | Some(B(1)) | Some(B(2)) のように書かなければならなかった。

Motivation

[Desktop Entry]
Version=1.0
Type=Application
Name=CLion
Icon=/opt/clion-2018.2.2/bin/clion.svg
Exec="/opt/clion-2018.2.2/bin/clion.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-clion
/*
* GTK - The GIMP Toolkit
* Copyright (C) 2002 Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
@shinnya
shinnya / create_buckets.sh
Last active December 7, 2018 09:10
frugalos 50 nodes
#!/usr/bin/env bash
CURL=curl
API_BASE=http://frugalos1
$CURL -X PUT -d '{"dispersed": {"id": "vod", "device":"root", "tolerable_faults": 1, "data_fragment_count": 2}}' $API_BASE/v1/buckets/vod
@shinnya
shinnya / futures_ext.rs
Created February 13, 2019 06:24
An example of CompletableFuture with fibers-rs
use fibers::{sync::oneshot, time::timer};
use futures::{Async, Future, Poll, Select};
use futures::future::Either;
use std::marker::PhantomData;
use std::time::Duration;
// your custom error type.
use Error;
type BoxFuture<T, E> = Box<Future<Item = T, Error = E> + Send + 'static>;