Skip to content

Instantly share code, notes, and snippets.

@amutake
amutake / titles.js
Created July 7, 2017 07:11
https://satsukita-andon.com/artisan/classdata から、投票用のを取ってくるスクリプト
Array.prototype.map.call(document.querySelectorAll("table tbody tr"), function (tr) { var c = tr.children; return c[2].textContent + "年" + c[3].textContent + "組" + "『" + c[4].textContent + "』"; }).join("\n");
@amutake
amutake / focal_length.sh
Last active December 4, 2016 10:36
A script for making 'focal length - number' graph
#!/usr/bin/env bash
FOCAL=focal.dat
WC=~/tmp/wc.rb
if [[ "$1" == "-t" && ! -z "$2" ]]; then
exiftool -T -focallengthin35mmformat *.JPG | grep -v '-' | awk '{print NR, $0}' > $FOCAL
gnuplot -p -e "set terminal png; set term png size 2000,500; set term png font 'ヒラギノ丸ゴ ProN W4, 16'; set output '$2'; set xlabel 'n枚目'; set ylabel '焦点距離'; plot '$FOCAL' using 1:2:(1) with boxes"
rm $FOCAL
open $2
@amutake
amutake / syuukei.rb
Last active July 16, 2016 01:22
行灯人気投票集計スクリプト
require 'csv'
classes = {}
file = ARGV[1]
GENEKI = '現役生'
OBOG = 'OBOG'
OTHER = 'その他'
CSV.foreach(file) do |row|
@amutake
amutake / ContT.v
Last active May 29, 2016 17:31
ContT and ContsT instances (for scalaz)
Set Implicit Arguments.
Unset Strict Implicit.
(** Type Definitions *)
Inductive IndexedContsT (W M : Type -> Type) (R O A : Type) : Type :=
| mkIndexedContsT : (W (A -> M O) -> M R) -> IndexedContsT W M R O A.
Definition runIndexedContsT W M R O A (c : IndexedContsT W M R O A) : W (A -> M O) -> M R :=
match c with
@amutake
amutake / Main.scala
Created December 19, 2015 22:14
bug of finch-0.9.2 (this is fixed by #485)
package finch.bug
import io.finch._
import com.twitter.io.Buf
import com.twitter.finagle.http._
import com.twitter.util.{ Await, Duration }
object Main extends App {
val string = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@amutake
amutake / alalog_serial.c
Created November 22, 2015 08:03
PIC16F1827 で Analog In の値をシリアル通信で送ってくれるやつ
/*
* File: main.c
* Author: amutake
*
* Created on November 22, 2015, 1:43 PM
*
* シリアル通信で、なんかデータ (char 型) を送ると Analog In の値を送り返してくる。
* 使うピンは以下の通り
*
* RB1: RX
#!/usr/bin/env runghc
import Distribution.Simple.InstallDirs -- Cabal package
( platformTemplateEnv
, fromPathTemplate, toPathTemplate
, substPathTemplate
)
import Distribution.System (buildPlatform) -- Cabal package
import System.Process -- process package
( shell
Require Import Coq.Strings.Ascii.
Require Import Ssreflect.ssreflect Ssreflect.eqtype Ssreflect.ssrbool.
Definition eqascii (a a' : ascii) : bool :=
match a, a' with
| Ascii b0 b1 b2 b3 b4 b5 b6 b7, Ascii b0' b1' b2' b3' b4' b5' b6' b7' =>
(b0 == b0') && (b1 == b1') && (b2 == b2') && (b3 == b3') &&
(b4 == b4') && (b5 == b5') && (b6 == b6') && (b7 == b7')
end.
@amutake
amutake / gist:5b1e575ae32d2e6286b2
Last active April 16, 2023 03:56
夏ゼミ順番
module Main where
import Control.Monad
import Data.Array.IO
import System.Random
type Name = String
-- 通常
participants :: [Name]
@amutake
amutake / RingBenchmarks.scala
Last active August 29, 2015 14:02
ring-benchmarks
package me.amutake
import akka.actor._
object RingBenchmarks {
sealed trait Msg
case class Start(n: Int, t: Int) extends Msg
case class Next(next: ActorRef) extends Msg
case object End extends Msg