Skip to content

Instantly share code, notes, and snippets.

View nekketsuuu's full-sized avatar
🍑
I like peaches!

Takuma Ishikawa nekketsuuu

🍑
I like peaches!
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python3
import numpy as np
# calculate min after calculating all dists
def update1(data, labels):
sizes = np.bincount(labels)
n_label = sizes.shape[0]
n_data = data.shape[0]
dim = data.shape[1]
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
class GlobalKmeans(object):
def __init__(self, X, cluster):
self.X = X
self.num = X.shape[0]
self.label = np.zeros((self.num, 1))
@nekketsuuu
nekketsuuu / merlin_check.sh
Created May 28, 2018 16:57
Check if all OCaml files have no errors under current .merlin file
#!/bin/bash
shopt -s globstar
for ml in ./src/**/*.ml; do
out="$(ocamlmerlin single errors -filename "$ml" < "$ml")" ;
echo "$ml" ;
if ! echo "$out" | grep -i '"value":\[\]' >/dev/null ; then
echo "$out" ;
fi ;
#!/bin/sh
satysfi test.saty --debug-show-bbox -o test.pdf

自分自身よく分からなくなってきたので、2018年5月下旬時点で見ているバーチャルライバー / バーチャル投稿者についてまとめる。大体好感度順になるよう並べようとしたが無理だった。

モイラ

にじさんじ一期生。女神。もいもいももーいもいももいもい。

@nekketsuuu
nekketsuuu / rs.ml
Created May 4, 2018 01:12
『Recursion Scheme テクニック』 (@eldesh) の内容の一部を OCaml で書きました。
(* general definition of signature using recursion scheme *)
module type TYP = sig
type t
type 'a f
val fmap : ('a -> 'b) -> 'a f -> 'b f
val inj : t f -> t
val prj : t -> t f
end

動作例

Click to expand

let () =
  print_endline @@ string_of_int (1 + 1)
;;
SATySFi/doc$ make
satysfi doc-primitives.saty -o primitives.pdf
---- ---- ---- ----
target file: 'primitives.pdf'
dump file: 'primitives.satysfi-aux' (will be created)
parsing 'doc-primitives.saty' ...
parsing 'stdja.satyh' ...
parsing 'pervasives.satyh' ...
parsing 'gr.satyh' ...
parsing 'list.satyh' ...