Skip to content

Instantly share code, notes, and snippets.

@u1and0
u1and0 / Dockerfile
Last active June 1, 2020 11:32
draft for Dockerfile at grep-server
# Usage:
# ```
# $ docker run -d --rm u1and0/grep-server [options]
# ```
FROM golang:buster AS builder
COPY ./main.go /go/src/github.com/u1and0/grep-server/main.go
COPY ./go.mod /go/src/github.com/u1and0/grep-server/go.mod
WORKDIR /go/src/github.com/u1and0/grep-server
# For go module using go-pipeline
@u1and0
u1and0 / pythonコンテナで初回にやる作業_password含むためdotfileにはかいてない.md
Last active May 25, 2020 02:08
pythonコンテナで初回にやる作業_password含むためdotfileにはかいてない

pythonコンテナでやる作業(dotfileには書いてない)

  1. 下記のコマンドによりパスワードを2回入力し、sha1:xxxxxx...の出力を得る
$ docker exec -it composeset_jupyter_1 \
              bash -c ". .bashrc && \
              python -c 'from notebook.auth import passwd; print(passwd())'"
@u1and0
u1and0 / read_excels.py
Created April 25, 2020 03:28
複数のExcelファイルを読み込んでDataFrameにする
#!/usr/bin/env python
"""複数のExcelファイルをDataFrameにする
pandas, xlrdのインストールが必要
部品諸元表に適用するときは、
` skiprows=8, usecols=range(1,12) `
オプションをつける
"""
import pandas as pd
from glob import iglob
@u1and0
u1and0 / gista-file
Created April 8, 2020 05:49
python fine_ticks()
def fine_ticks(index, point):
"""heatmapで使う横軸を間引く
指定したpoint数以外の数字をNoneにする
index: 間引く対象のindex
point: 数字として見せるindexの数
point=4の内、index[::int(len(index)/4)]以外の数字はNone
"""
ticks = int(len(index) / point) # ticksの数
@u1and0
u1and0 / gista-file
Created April 6, 2020 05:43
random hash generator script
cat /dev/urandom | tr -dc "0-9a-fA-F" | fold -w 8 | head -n 4
@u1and0
u1and0 / 177
Last active May 8, 2025 13:48
HTMLコンテンツの抜き出しshellscript
#!/bin/sh
# http://www.wisdomsoft.jp/189.htmlのリンクから
# リンク先のコンテンツをwisdomsoft.txtに書き出す
URL="http://www.wisdomsoft.jp/189.html"
./wisdomsoft_link.sh ${URL} |
awk '{print $1}' |
xargs -I{} ./wisdomsoft_content.sh {} > wisdomsoft.txt
@u1and0
u1and0 / gview.py
Created February 5, 2020 08:03
draft for SAtraceGview
#!/usr/bin/env python3
"""interactive plot for SAtrace"""
import base64
import datetime
import io
import os
from collections import defaultdict
import dash
from dash.dependencies import Input, Output, State
@u1and0
u1and0 / gista-file
Last active February 3, 2020 10:59
vimで選択範囲のmarkdownをhtmlに保存する方法
# vimで選択範囲のmarkdownをhtmlに保存する方法
## 準備
* 事前にpandocのインストールが必要
* 例えばmarkdownファイル名`example.md`を編集中とする。
## 使用方法
pandocのdoc見てると、入力ないときは標準入力から受け取り、デフォルトではmarkdown->htmlへと変換するそうなので、シンプルにこれだけでいい。
ファイル編集中にvim上で以下のコマンドを実行する。
@u1and0
u1and0 / gista-file
Last active January 9, 2020 06:22
shell short options
-a: all すべて
-b: before 前の
-c: char 文字数
-d: delete 消す dir ディレクトリ
-e: expression 表現, sed -e など、正規表現を指定する
-f: file (主にインプットの)ファイル名指定
-g: group グループ名指定
-h: help ヘルプを表示
-i: interactive 対話的に
-j:
@u1and0
u1and0 / gista-file
Last active July 20, 2019 04:52
0-200の間のランダムなintを9列並べるvim+shell script
```0-200のランダムなintを9列並べるvim script + shell script
:r !echo $((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200)),$((RANDOM\%+200))
" for文使える
:r !for i in `seq 9`; do printf \"$((RANDOM\%+200))\", ; done
" jレジスタに結果を登録する
:let @j = system ('for i in `seq 9`; do printf \"$((RANDOM%+200))\", ; done')
```