Skip to content

Instantly share code, notes, and snippets.

@tarao
tarao / Dockerfile
Last active April 21, 2021 21:23
Octave in a docker container
FROM debian:jessie
RUN apt-get update && apt-get install -yq less sudo octave && apt-get clean
COPY entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]

ポイント

  • runするまではクエリは走らない
    • m*ms*ができた段階ではまだクエリは走ってない
  • 長いモナド型は途中の操作の種類を記憶している
    • N個のモナドに対する操作は同じ種類の操作でないといけない (というのを型が保証している)
    • 同じ種類の操作なので各ステップはまとめてやれる
  • Seq[モナド型]に対するrunは各ステップをまとめて実行
    • FlatMapped[]の場合はこのへん
      • ひとつ前までのモナドのリストをまとめてrun
package com.github.tarao
package gradual
import scala.language.dynamics
import scala.language.experimental.macros
import scala.reflect.runtime.{universe => ru}
import ru.{Type, TypeTag, TermName, MethodSymbol, typeOf}
class Dyn(value: Any, t: Type) extends Dynamic {
def as[T: TypeTag](): T = {
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
// Source File Name: test.scala
package dynamic;
// Referenced classes of package dynamic:
// Sample
map J <C-d>
map K <C-u>
map j 3j
map k 3k
map d D
map ; :
iunmap <C-Enter>
@tarao
tarao / hotplug.sh
Last active December 19, 2015 15:59
#!/bin/sh
# /usr/local/sbin/hotplug
# sysctl -w kernel.hotplug=/usr/local/sbin/hotplug
dir=/usr/local/etc/hotplug
for script in `ls -1 "$dir"/*`; do
[ -x "$script" ] && ( "$script" >/dev/null 2>&1 ) &
done
#!/bin/sh
# /etc/libvirt/hooks/daemon
net="default"
pidfile="/var/run/libvirt/network/$net.pid"
dnsmasq="/usr/sbin/dnsmasq"
config="/var/lib/libvirt/dnsmasq/$net.conf"
case $2 in
start)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\primary_ide_channel]
"ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
"Service"="atapi"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\secondary_ide_channel]
"ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
"Service"="atapi"
@tarao
tarao / anything-git-project.el
Last active December 16, 2015 02:09
This file is obsolete. Use anything-git-files.el https://github.com/tarao/anything-git-files-el
;; http://shibayu36.hatenablog.com/entry/2012/12/22/135157
(eval-when-compile (require 'cl))
;;;###autoload
(defun anything-git-project-project-dir ()
(let ((dir (shell-command-to-string "git rev-parse --show-toplevel")))
(replace-regexp-in-string "[\n\r]+$" "" dir)))
;;;###autoload
@tarao
tarao / gist:5182203
Last active December 15, 2015 01:48
// http://blog.livedoor.jp/dankogai/archives/51859373.html
var x = { a: 1, b: 2, c: 3 };
var y = { a: 1, b: 2, c: 3, d: 4 };
var z = {a: 1, b: 2, c: 3 };
var w = {a: 1, b: 2, c: 3, d: 4 };
x.b = w;
y.b = x;
z.b = y;
w.b = x;