Skip to content

Instantly share code, notes, and snippets.

@i2tsuki
Last active March 23, 2022 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i2tsuki/7018567f61cda0b2a70c7ec623ffea4a to your computer and use it in GitHub Desktop.
Save i2tsuki/7018567f61cda0b2a70c7ec623ffea4a to your computer and use it in GitHub Desktop.
# Operation memo
## Server Operation
### General
```bash
# ps command
ps -ALo user,tid,pid,ppid,euid,pgid,%cpu,%mem,vsz,rss,lstart,time,args,psr,wchan
ps -ALo user,pid,ppid,euid,pgid,%cpu,%mem,vsz,rss,lstart,time,args
# ip address
ip -f inet -o addr show eth0 | cut -d ' ' -f 7
# tc command
# 1 Mbps に制限
sudo tc qdisc add dev eth0 root tbf limit 1Mb buffer 200Kb rate 1Mbps
# screen command(serial)
screen /dev/ttyUSB0 9600
# Bluetooth dbus
dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx org.bluez.MediaControl1.VolumeUp
dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/sep1 org.freedesktop.DBus.Introspectable.Introspect
```
### TCPdump
```bash
# 128 MB で分割
tcpdump port 22 -t -n -w ./2020-06-02T1100.pcap -C 128 -W 10
# 1 分ごとに rotate
tcpdump -A dst host 10.0.0.1 or dst host 10.0.0.2 -t -n -w ./2020-10-10T11%M%S.pcap -G 60
# 1 時間ごとに rotate
tcpdump port 8080 -t -n -w ./%Y-%m-%dT%H%M.pcap -G 3600 -W 10
# pcap ファイル 読み込み
tcpdump -t -r ./2020-06-02T1100.pcap | grep 'Flags \[S\]' | cut -d' ' -f 2 | sed -e 's/\.[0-9][0-9]*//g' | sort | uniq -c
```
## Kubernetes create user account
```sh
NAME="jenkins"
SUBJECT='/CN=jenkins'
openssl genrsa -rand /var/log/messages -out ./${NAME}-key.pem 2048
openssl req -new -nodes -key ./${NAME}-key.pem -sha256 -out ./${NAME}.csr -subj "${SUBJECT}" -config /etc/kubernetes/openssl.conf
openssl x509 -req -in ./${NAME}.csr -CA /etc/kubernetes/ssl/ca.pem -CAkey /etc/kubernetes/ssl/ca-key.pem -CAcreateserial -out ${NAME}.pem -days 36500 -extensions v3_req -extfile /etc/kubernetes/openssl.conf
kubectl config set-cluster cluster.local --certificate-authority=/etc/kubernetes/ssl/ca.pem --server=https://xxx.ap-northeast-1.elb.amazonaws.com:443 --embed-certs=true
kubectl config set-context cluster.local --cluster cluster.local --user=jenkins
```
## Linux Desktop Operation
### xlockmore
```bash
xlock -echokeys -enablesaver -geometry 240x240 -use3d -message 'type your password' -dpmsstandby 900 -dpmsoff 1500 -mode pacman
```
### Update init ram image by using dracut
```bash
make -j8 && make modules_install && make install
dracut --force -a crypt -i /bin/busybox /bin/busybox -i /rootfs.key /rootfs.key --kver 5.4.17-gentoo
grub-mkconfig -o /boot/grub/grub.cfg
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment