Skip to content

Instantly share code, notes, and snippets.

View okapies's full-sized avatar
💭
⌨️

Yuta Okamoto okapies

💭
⌨️
View GitHub Profile
@okapies
okapies / t470s.md
Last active October 28, 2021 16:45
Ubuntu 16.04 on ThinkPad T470s

This is a document describing how to install Ubuntu 16.04 LTS on ThinkPad T470s.

My Hardware

  • CPU: Intel Core i7-7600U (2.80GHz, 4MB cache)
  • Graphics: Intel HD Graphics 620
  • Display: 14” WQHD (2560 X 1440) IPS Non-Touch Anti-Glare
  • Memory: 24GB DDR4 2133 MHz (8GB Onboard + 16GB)
  • SSD: PCIe-NVMe 256G OPAL 2.0
  • Wireless: Intel Dual Band Wireless AC (2x2) 8265 Bluetooth 4.1
  • Fingerprint Reader
@okapies
okapies / mastodon-ostatus.md
Last active September 5, 2021 11:39
Mastodon OStatus API の叩き方

Mastodon が他のインスタンスと情報交換をする OStatus API の使い方。使ってるだけのユーザは知る必要がない裏側の話。

host-meta

Mastodon インスタンスに対して、RFC6415 が規定する /.well-known/host-meta というパスを要求すると以下の XML が返ってくる.

<?xml version="1.0"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
  <Link rel="lrdd" type="application/xrd+xml" template="https://[MASTODON_HOST]/.well-known/webfinger?resource={uri}"/>
</XRD>
@okapies
okapies / mastodon-client.md
Last active October 3, 2023 10:18
Mastodon API の叩き方

Mastodon の API を叩くには以下の手順を踏む必要がある:

  1. OAuth2 クライアントを登録する
  2. アクセストークンを取得する
  3. アクセストークンを Authorization ヘッダに指定して API にアクセスする

OAuth2 クライアント登録

Mastodon の Apps API に登録情報を送ってクライアントを払い出してもらう(一度だけやれば OK).

@okapies
okapies / Ergo-JIS-layout.kbd.json
Last active December 25, 2016 06:59
Ergo-JIS layout
[
{
"name": "Ergo-JIS layout",
"author": "@okapies",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Red",
"pcb": true
},
[
@okapies
okapies / Ergo-JIS-layout.kbd.json
Last active May 31, 2016 03:43
Ergo-JIS layout
[
{
"name": "Ergo-JIS layout",
"author": "@okapies",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Red",
"pcb": true
},
[
@okapies
okapies / fpinscala-chap11-note.md
Last active August 29, 2015 14:12
FP in Scala chapter notes - Chapter 11: Monads
@okapies
okapies / MessageLogger.scala
Created May 14, 2014 16:52
Slick 2.0 Sample
import java.io.BufferedReader
import java.io.InputStreamReader
import scala.annotation.tailrec
import org.joda.time._
import com.github.tototoshi.slick.H2JodaSupport._
object MessageLogger extends App {
val profile = scala.slick.driver.H2Driver
@okapies
okapies / HogeOps.scala
Created January 30, 2014 10:29
scalac is crazy with private[this] in value class
class HogeOps(val underlying: Any) extends AnyVal {
private
[this] // <-- !!!
def toOption[A](v: => A): Option[A] = ???
}
@okapies
okapies / part7.scala
Last active December 29, 2015 11:09
「プログラマの為の数学勉強会」の資料を ScalaNLP で写経してみたかった http://nineties.github.io/math-seminar/
import breeze.linalg._
/*
* p.15 (http://nineties.github.io/math-seminar/7.html#/15)
*
* Note: Does breeze basically recommend side effects?
* Note: The compiler will complain 'could not find implicit value for parameter canMapValues'
* if you make the type parameter 'Int' as a generic type.
*/
def matAdd(a: DenseMatrix[Int], b: DenseMatrix[Int]) =
@okapies
okapies / gist:7182102
Last active December 26, 2015 16:48
Value type as Sum types
// value class
class Param(val i: Int) extends AnyVal
implicit def asParam(i: Int) = Param(i)
// followings are invalid because `Param` is a final class.
case class AnyParam(_i: Int) extends Param(_i)
case object ConstantA extends Param(-1)