Skip to content

Instantly share code, notes, and snippets.

View omasanori's full-sized avatar

Masanori Ogino omasanori

View GitHub Profile
@omasanori
omasanori / gist:7858569
Last active March 11, 2024 07:40
Rustのパターンマッチの話

Rustのパターンマッチの話

既に穴だらけですが、やれるだけやっていきます。今回はパターンマッチの話です。

TL;DR(経験者向け)

はい、あなたのよく知るパターンマッチです。ガードも使えますが、他の言語でガードを使うパターンの一部はOCamlのorパターンと同等の機能や範囲を表す機能によって置き換えることができます。

@omasanori
omasanori / gist:7959952
Last active July 16, 2023 08:26
msgpack-rustをrustpkg化してTravis CIで継続的インテグレーションする話

msgpack-rustをrustpkg化してTravis CIで継続的インテグレーションする話

表題の通りです。

msgpack-rustとは

msgpack-rustMessagePackのRustによる実装の一つで、私が書いたものです。まだ実装していない機能が多いです。はい、がんばります。

@omasanori
omasanori / gist:8123321
Created December 25, 2013 13:47
gentoo-rustに色々と手を加えた話

gentoo-rustに色々と手を加えた話

Rust Advent Calendar 2013、空きが多くて申し訳ありませんでした。もう少し書けるかと思っていましたが、できませんでした。今日は数日前から手を入れているgentoo-rustの話をします。

Gentoo LinuxのパッケージシステムPortageでRustをインストール、管理するためのファイルを置いているオーバーレイ(追加のパッケージファイル集)がgentoo-rustです。既にapp-portage/laymanを導入していればlayman -a gentoo-rustでgentoo-rustに入っているebuildを使えるようになる、というのは21日目の記事で既に述べられている通りです。

これまでgentoo-rustを使わずに自前のebuildを使ってきましたが、別々に作業するよりも合流した方が良いと考え、gentoo-rustを導入してpull requestを送るようにしました。すると、ひっきりなしに届く私のpull requestに辟易したのかもしれませんが、メンテナのHeather氏からpull権限をいただいたので小さな変更をいくつか直接コミットしました。

現在、dev-lang/rustemacsvim-syntaxUSEフラグで対応するエディタのシンタックスハイライト等のサポートをインストールします。また、zsh-completionUSEフラグでrustcのオプションをzshのコマンドラインで補完するためのスクリプトをインストールします。すでにgentoo-rustをlaymanで導入している方はlayman -s gentoo-rustしてからemergeしてください。

@omasanori
omasanori / README.md
Last active September 30, 2020 01:00
Notes on Don Quijote MUGA Stoic PC3, a Japanese (approx.) 200 USD low-end laptop PC

Don Quijote MUGA Stoic PC3

無我muga
the Buddhist doctrine of non-self, meaning that eternal and invariant self, or soul, is illusory

Keybase proof

I hereby claim:

  • I am omasanori on github.
  • I am omasanori (https://keybase.io/omasanori) on keybase.
  • I have a public key ASC_x_1I-c-8bnzu_3dBkIdFmXHFpIGQWzwve_EL8dpHJwo

To claim this, I am signing this object:

@omasanori
omasanori / abvis.rb
Created January 11, 2015 07:05
An implementation of minimax and alpha-beta punning written in Ruby, with visualization using Graphviz dot language.
class Node
attr_accessor :symbol, :score, :my_turn, :children, :visited
def initialize(symbol, score, my_turn, children)
@symbol = symbol
@score = score
@my_turn = my_turn
@children = children
@visited = false
end
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ] && [[ $- =~ i ]]; then
tmux attach-session -t "$USER-ssh" 2> /dev/null || tmux new-session -s "$USER-ssh" || exit $?
exit
fi
@omasanori
omasanori / cpuinfo-after.log
Created February 24, 2019 10:50
Comparing the content of /proc/cpuinfo with Debian 9 and Coreboot 1f83e9d592f6be5a4fc36c7d21ae1410a2fbbdfe on ThinkPad X60s before and after installing intel-microcode package.
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 14
model name : Genuine Intel(R) CPU U1300 @ 1.06GHz
stepping : 8
microcode : 0x39
cpu MHz : 800.000
cache size : 2048 KB
physical id : 0
@omasanori
omasanori / monitor_temp.py
Last active June 22, 2018 10:18
Monitor the temparture of processors on Linux
#!/usr/bin/env python3
def get_temp(socket_id):
thermal_zone = '/sys/class/thermal/thermal_zone' + socket_id
with open(thermal_zone + '/temp') as temp:
return int(temp.read()) / 1000.0 # + 273.15
if __name__ == '__main__':
import json
import sys
@omasanori
omasanori / alibuild.log
Created July 10, 2017 09:36
Building Configuration with flpproto fails on CC7 when libcurl-devel is not installed
aliBuild can take the following packages from the system and will not build them:
FreeType
The following packages cannot be taken from the system and will be built:
Python-modules, sqlite, CMake, protobuf, Python, GCC-Toolchain, nanomsg, libpng, ZeroMQ, autotools, boost, GSL
Packages will be built in the following order:
- defaults-o2-daq@v1
- autotools@v1.5.0
- sqlite@v3.15.0
- GCC-Toolchain@v6.2.0-alice1
- ZeroMQ@v4.1.5