This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socat -v tcp-listen:8080 system:pbcopy | |
socat stdin tcp:localhost:8080 | |
https://github.com/alpine-docker/socat/blob/master/Dockerfile | |
https://github.com/FGtatsuro/copycat | |
https://momijiame.tumblr.com/post/48934531325/socat-%E3%82%92%E4%BD%BF%E3%81%86%E3%81%A8%E5%90%84%E7%A8%AE%E3%82%BD%E3%82%B1%E3%83%83%E3%83%88%E3%81%AE%E6%93%8D%E4%BD%9C%E3%81%8C%E6%8D%97%E3%82%8A%E3%81%BE%E3%81%8F%E3%82%8B%E4%BB%B6 | |
xsel | |
ssh x11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import random | |
import typing | |
def decorator( | |
field_name: str = 'injected_field' | |
): | |
def inner(func: typing.Callable): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# リソースタイプ | |
$ gcloud deployment-manager types list | awk 'NR>=2' | grep -E -v 'beta|alpha' | sort -u | |
$ gcloud deployment-manager types list | tail -n +2 | grep -E -v 'beta|alpha' | sort -u | |
$ gcloud deployment-manager types list --filter='name !~ alpha|beta'| tail -n +2 | sort -u | |
$ gcloud deployment-manager types list --filter='name:compute AND NAME !~ alpha|beta' | tail -n +2 | sort -u | |
# マシンタイプ | |
# NOTE: --sort-byオプションがCPUS,MEMORY_GBに対して上手く効かない | |
$ gcloud compute machine-types list --filter='zone:asia-northeast1-a' | sort -n -k 3,3 # CPU数順 | |
$ gcloud compute machine-types list --filter='zone:asia-northeast1-a' | sort -n -k 4,4 # メモリ順 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ANSIBLE_LOAD_CALLBACK_PLUGINS=1 ANSIBLE_STDOUT_CALLBACK=json \ | |
ansible devenv -i inventory/hosts -m setup | jq '.plays[0].tasks[0].hosts.devenv.ansible_facts.ansible_env.HOME' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BRANCH=`git branch --format "%(refname:short)" | grep -v master | peco`; git push origin $BRANCH:$BRANCH && hub pull-request | |
git status --short | awk '{if ($1 ~ /M/) print $2}' | peco | xargs git add | |
git status --short | awk '{if ($1 ~ /(M|??)/) print $2}' | peco | xargs git add | |
git status --short | awk '{if ($1 ~ /(M|D|\?\?)/) print $2}' | peco | xargs git add | |
BRANCH=`git branch | awk -v ORS='' '{print $2}'`; \ | |
git checkout master; \ | |
hub pr list -f '%U' | peco | hub merge - && \ | |
git push origin master && git branch -D $BRANCH && git push origin :$BRANCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
f = open('springData.txt') | |
f.readline() | |
df = pd.read_csv(f, header=None, names=('dist', 'mass'), delimiter=' ')[:-6] | |
df['force'] = df['mass'] * 9.81 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker inspect github_traverse_container | jq '.[0].NetworkSettings.IPAddress' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
# Ref: https://pandas.pydata.org/pandas-docs/stable/options.html#available-options | |
pd.options.display.max_rows = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FYI: | |
# - https://docs.docker.com/engine/reference/builder/ | |
# - https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ | |
# - https://hub.docker.com/_/python/ | |
FROM python:3.7 | |
# Backward compatibility with deprecate onbuild image. | |
# FYI: https://github.com/docker-library/python/pull/314/files#diff-7531449f9a1a85f134eba7d960a91c91L1 | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAG = my_performance:0.1 | |
CONTAINER_NAME = my_performance_oneshot | |
TIME_ZONE = Asia/Tokyo | |
SRC = $(wildcard tests/*.py) $(wildcard tests/configs/*.py) $(wildcard tests/scenarios/*.py) | |
.PHONY: all build test result clean lint format tags unittest | |
all: test | |
build: .build |
NewerOlder