Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class Base64:
import string
import binascii
def __init__(self):
b64chars = (
string.ascii_uppercase + string.ascii_lowercase + string.digits + "+/"
)
self.c2i = {c: i for i, c in enumerate(b64chars)}
self.c2i["="] = 0
@bilzard
bilzard / install_scikit_learn_m1.md
Created May 8, 2022 10:15
Install scikit-learn for M1 Mac

公式ドキュメントには miniforge でインストールするように案内されている。

https://scikit-learn.org/stable/install.html#installing-on-apple-silicon-m1-hardware

しかし、StackOverflowで紹介されている以下の方法でもインストールすることができた。

$ brew install openblas
$ export OPENBLAS=$(/opt/homebrew/bin/brew --prefix openblas)
$ export CFLAGS="-falign-functions=8 ${CFLAGS}"
@bilzard
bilzard / union_tree.py
Last active December 13, 2021 00:08
Python Implementation of Union Find Tree
# =============
# UnionFind tree
# =============
class UnionFindTree():
def __init__(self, N):
self.parent = [i for i in range(N)]
self.rank = [0 for _ in range(N)]
def root(self, x):
if x == self.parent[x]:
@bilzard
bilzard / solafune_083.ipynb
Last active April 10, 2021 02:18
sorafune_083.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bilzard
bilzard / avg
Last active April 10, 2020 03:35
#!/usr/local/bin/awk -f
BEGIN {
s = 0
}
{
a = $1
s = s + a
}
@bilzard
bilzard / elbinfo.bash
Last active April 6, 2020 04:31
各AWSリソースを一覧するシェルスクリプト
#!/bin/bash
profile=$1
tmp_dir=~/bin
elb_tmp=$tmp_dir/elb.tmp
alb_tmp=$tmp_dir/alb.tmp
elb_tag_tmp=$tmp_dir/elb_tag.tmp
alb_tag_tmp=$tmp_dir/alb_tag.tmp
export AWS_DEFAULT_PROFILE=$profile

Gatling の EL (Expression Language) と Scala の string interpolation

文字列の先頭に s をつけると Scala の string interpolation が実行される。 Gatling の EL は単なるマクロ置換なので、ELを使う場合は文字列の先頭に s はつけない。

例)

  • s"Hello, ${name}" => 変数 name の値が展開される(string interporation; Scala)
  • "Hello, ${name}" => セッションの name の値が展開される(EL; Gatling DSL)
@bilzard
bilzard / about_gatling.md
Last active November 7, 2019 03:42
Gatling について

Gatlingについて

  • 環境構築
    • Open JDK 8
    • Scala 2.12
      • 2.11, 2.13 では動作しない
      • Open JDK でも動作するの?
        • => 動作した
    • sdkman というツールを使うとバージョン指定してインストールするのが簡単
  • Gatling 使ってみる
"
" Plug
"
call plug#begin('~/.vim/plugged')
Plug 'leafgarland/typescript-vim'
call plug#end()
"