Skip to content

Instantly share code, notes, and snippets.

View airtoxin's full-sized avatar
🌴
On vacation

Ryoji Miyazato airtoxin

🌴
On vacation
View GitHub Profile
@airtoxin
airtoxin / access.py
Created May 12, 2013 15:25
アクセスログ解析
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re, urllib
from BeautifulSoup import BeautifulSoup
r_ip = re.compile(r"\"?((\d{1,3}\.){3}\d{1,3})\"?")
r_content = re.compile(r".*whose location is (.*)\.")
placefile = open("place.txt", "r")
#!/usr/bin/env python
# -*- coding: utf-8 -*-
u"""
mymodule.stablesortは https://github.com/airtoxin/mymodule/blob/master/stablesort.py
"""
from numpy import array
from mymodule.stablesort import stable_sort_by_row, stable_sort_by_column
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@airtoxin
airtoxin / SRE_4.md
Created October 4, 2017 04:00
SRE本4章まとめ

4章 サービスレベル目標

4.1 サービスレベルに関する用語

SLI

SLI はサービスレベル指標の略で、サービスレベルの性質の計測量。

  • リクエストのレイテンシ(レスポンスを返した時刻-リクエストを受信した時刻)
  • エラー率(エラーになったリクエスト数/受信したリクエスト数)
@airtoxin
airtoxin / cirquit.ts
Last active March 17, 2018 01:15
deredux
import * as React from "react";
import createReactContext from "create-react-context";
export interface CirquitContext<State> {
state: State;
dispatch: Dispatch<State>;
}
export interface Dispatch<State> {
(nextState: State): void;
@airtoxin
airtoxin / what-do-i-depend-on
Created October 1, 2018 03:01
what-do-i-depend-on
$ npx what-do-i-depend-on
npx: 18個のパッケージを6.648秒でインストールしました。
┌──────────────────────────────────────────────────┬────────────────────┐
│ PACKAGE │ COUNT │
├──────────────────────────────────────────────────┼────────────────────┤
│ mocha │ 825 │
├──────────────────────────────────────────────────┼────────────────────┤
│ ava │ 359 │
├──────────────────────────────────────────────────┼────────────────────┤
│ eslint │ 320 │
export type Option<A> = Some<A> | None<A>;
interface IOption<A> {
isDefined(): this is IOption<A>;
isEmpty(): this is IOption<A>;
nonEmpty(): this is IOption<A>;
map<B>(f: (val: A) => B): IOption<B>;
flatMap<B>(f: (val: A) => Option<B>): Option<B>;
forEach(f: (val: A) => void): void;
getOrElse(fallback: A): A;
@airtoxin
airtoxin / post-checkout
Last active March 29, 2019 08:35
cache-node_modules git hook
#!/usr/bin/env bash
echo "[cache-node_modules] START"
CURRENT_DIR_NAME=`basename $(pwd)`
BRANCH_FROM=`git reflog show -q | head -n1 | awk '$3 == "checkout:" && $4 == "moving" {print $6}'`
BRANCH_TO=`git reflog show -q | head -n1 | awk '$3 == "checkout:" && $4 == "moving" {print $8}'`
BRANCH_FROM_CACHE_NAME="/Library/Caches/${CURRENT_DIR_NAME}_${BRANCH_FROM}_node_modules"
BRANCH_TO_CACHE_NAME="/Library/Caches/${CURRENT_DIR_NAME}_${BRANCH_TO}_node_modules"
@airtoxin
airtoxin / setup.sh
Last active May 30, 2020 00:47
curl https:/GISTURL | bash -s NAME_OF_APP
npx create-react-app $1 --template typescript
cd $1
yarn add -DE prettier typescript
SCRIPTS=$(cat package.json | jq -c $'.scripts + {"fmt":"prettier --write \'**/*.{js,jsx,ts,tsx,json,md}\' --ignore-path .gitignore"}')
cat package.json | jq ". + {"scripts": $SCRIPTS}" > package.json.tmp
mv package.json{.tmp,}
COMPILER_OPTIONS=$(cat tsconfig.json | jq -c $'.compilerOptions + {"noImplicitAny": true}')
cat tsconfig.json | jq ". + {"compilerOptions": $COMPILER_OPTIONS}" > tsconfig.json.tmp
mv tsconfig.json{.tmp,}
git add .