Skip to content

Instantly share code, notes, and snippets.

View manuke's full-sized avatar

manuke manuke

View GitHub Profile
@manuke
manuke / amazonlinux2
Last active June 4, 2020 08:02
amazonlinux2
linux 同一セグメント 複数ipの来たインターフェイスのIPから戻り設定
https://engineering.silk.co/post/31923247961/multiple-ip-addresses-on-amazon-ec2
https://qiita.com/fururun02/items/69d1ddac298b4ce48269
```
# tempraly
bash -c "echo '2 eth0_rt' >> /etc/iproute2/rt_tables"
ip rule add from 172.31.0.22 table eth0_rt
ip route add default via 172.31.0.1 dev eth0 table eth0_rt
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@manuke
manuke / rsyslog
Created June 21, 2017 08:50
rsyslog
http://www.geocities.jp/yasasikukaitou/rsyslog-filter.html
@manuke
manuke / elasticsearch.md
Last active June 13, 2017 02:00
elasticsearch
@manuke
manuke / bash
Last active February 26, 2024 18:25
bash
重複排除
/usr/bin/pgrep -f /usr/bin/emacs || echo "not duplicate emacs process"
http://qiita.com/rsooo/items/ef1d036bcc7282a66d7d
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)
cd $SCRIPT_DIR
#shell補完
@manuke
manuke / awscli.md
Last active December 1, 2017 01:04
awscli.md

GET SECURITY GROUP CREATE COMMAND(FOR COPY SECURITY GROUP)

TARGET_VPC_ID=vpc-XXXXXXXX echo '>tmp_replace_name' >tmp_create_command.txt aws ec2 describe-security-groups | jq -r '.SecurityGroups[]|{key1:.GroupName, key2:.IpPermissions[]}|[.key1,.key2.ToPort,.key2.IpRanges[].CidrIp,.key2.UserIdGroupPairs[].GroupId] |@tsv' >tmp_list aws ec2 describe-security-groups --query 'SecurityGroups[*].{Name:GroupName,ID:GroupId}' | jq -r '.[] | [.Name,.ID]|@tsv' >tmp_replace_id for group_name in cat tmp_replace_id | cut -f 1 | sort | uniq | grep -v '^default$' ; do echo "aws ec2 create-security-group --group-name $group_name --description $group_name --vpc-id=$TARGET_VPC_ID | echo -e "$group_name\t"`jq -r ".GroupId"` >>tmp_replace_name" ; done >>tmp_create_command.txt

replace group-name to group-id

- hosts: localhost
user: root
vars:
mecab_dir: /opt/mecab
src_dir: /usr/local/src
ipadic_workspace: "{{src_dir}}/mecab-ipadic-neologd"
##############
# mecab installation process
#############
tasks:
postgres initdb
localeはcにしないとソート順が崩れる?<==システムのライブラリ依存になるらしいcでも問題無さそう
「特定のテーブルでのみロケールを有効にしたソートを行いたい場合は、カラムに COLLATE を指定する方が良いでしょう。」がよさそう。
(デフォルトでja_JP.UTF-8になるのであえて変える必要はないかもしれない)
http://sios-oss.blogspot.jp/2013/07/blog-post.html
http://soudai1025.blogspot.jp/2015/08/mysqlpostgresql.html
エンコーディングはuft8でよい
現在のセッションの最後のsequence値を保証して取得
SELECT currval('hoge_no_seq');
@manuke
manuke / composer
Last active November 29, 2017 09:57
http://tech.quartetcom.co.jp/2015/01/19/composer-practices/
バージョンナンバーは、メジャー.マイナー.パッチとし、バージョンを上げるには、
1. APIの変更に互換性のない場合はメジャーバージョンを、
2. 後方互換性があり機能性を追加した場合はマイナーバージョンを、
3. 後方互換性を伴うバグ修正をした場合はパッチバージョンを上げます。
プレリリースやビルドナンバーなどのラベルに関しては、メジャー.マイナー.パッチの形式を拡張する形で利用することができます。
http://qiita.com/mokemokechicken/items/d3a3944bfa999c2582b7