Skip to content

Instantly share code, notes, and snippets.

View shinnya's full-sized avatar

Shinya Yamaoka shinnya

  • Japan
View GitHub Profile
@tenpoku1000
tenpoku1000 / AC_2018-12-05_SATA.md
Last active April 26, 2024 04:02
レガシー規格 SATA を振り返る

レガシー規格 SATA を振り返る

2024/04/26 更新

この記事は、自作OS Advent Calendar 2018の 12/5 の記事として書かれました。

釣りタイトルの印象はあるとは思います。SATA は、NVM Express への移行も進んでいると思われるので、主な仕様と製品を振り返ってみようという企画です。

自作 OS で SATA 対応といっても、どのような範囲まで対応しているのか、明記しておく必要があるのではないかと思います。なぜならば、本稿に記載しているように多様なデバイスがあり、個別の対応が必要な場合があると思われるからです。

@johnynek
johnynek / scala path dependent serializers.scala
Last active July 17, 2018 21:16
Scala's path dependent types can be used to prove that a serialized value can be deserialized without having to resort to Try/Either/Option. This puts the serialized value into the type, so we can be sure we won't fail. This is very useful for distributed compute settings such as scalding or spark.
import scala.util.Try
object PathSerializer {
trait SerDe[A] {
// By using a path dependent type, we can be sure can deserialize without wrapping in Try
type Serialized
def ser(a: A): Serialized
def deser(s: Serialized): A
// If we convert to a generic type, in this case String, we forget if we can really deserialize
@shyouhei
shyouhei / gist:266178ffedab5767a5b69b972c76f88a
Created September 27, 2017 07:31
優秀なプログラマーになるためのコツ

優秀なプログラマーになるためのコツ

重要な順で

優秀なプログラマーになるには非常に長い時間がかかるという現実を直視すべし

優秀なプログラマーというのは寝ている間に異世界に召喚されて無双するのとはわけが違うんですよ。

自分の例で言うとプログラミングを始めた中学生の時から優秀なプログラマだったかって、そんなわけない。みんなヘッポコからスタートしているに決まってるわけです。以来二十余年、地道に生き恥を晒し続けてきた結果として、現在いちおう業界の末席を汚すところまで来ている。このプロセスから目を背けるべきではないです。優秀なプログラマーに生まれる人間なんかいない。優秀なプログラマーに「育つ」んだし、それには時間が必要。今日から無双したいと思うな。

@hisui
hisui / EntryPoint.kt
Last active January 5, 2018 00:08
JAX-WS on Jetty + Google Guice in Kotlin
package jp.segfault.playground.aswj
import com.google.inject.Inject
import com.google.inject.Singleton
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@sile
sile / main.md
Last active June 30, 2019 20:32
『Brewer's Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services』の要約

要約: 『Brewer's Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services』

概要

  • 著者: Seth Gilbert、Nancy Lynch、発行年: 2002
  • いわゆる"CAP定理"の話:
    • 「分散環境では 一貫性(Consistency)可用性(Availability)分断耐性(Partition tolerance) の三つを同時に達成することはできない」
  • その不可能性の証明と、その制限を非同期環境および部分的同期環境でどう緩和するか、が述べられている
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

@hochgi
hochgi / PartitionWith.scala
Last active March 6, 2022 11:48
akka-stream retry flow
package hochgi.util
package object collections {
/**
* `partition` and `map` combined.
* for a given collection, and a function from the collection elements to `Either[A,B]`,
* generates a tuple of 2 collections of types `A` and `B`
*
* @param xs the collection of elements
* @param f a function that convert an element to an `Either[A,B]`
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active April 28, 2024 18:50
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
@UnaNancyOwen
UnaNancyOwen / tutorial.md
Last active December 1, 2023 03:44
How to write CMakeLists

CMakeLists Tutorial

ここでは、基本的な設定スクリプト(CMakeLists.txt)の書き方を紹介します。
(主にVisual C++向けに説明します。)

Basic Uses

CMakeでC++のプロジェクトを生成するための最小限必要のスクリプトを説明します。

  • cmake_minimum_required
    CMakeの最小要求バージョンを設定します。