Skip to content

Instantly share code, notes, and snippets.

@i2tsuki
Last active March 23, 2022 03:54
Show Gist options
  • Select an option

  • Save i2tsuki/7018567f61cda0b2a70c7ec623ffea4a to your computer and use it in GitHub Desktop.

Select an option

Save i2tsuki/7018567f61cda0b2a70c7ec623ffea4a to your computer and use it in GitHub Desktop.

Revisions

  1. i2tsuki revised this gist Mar 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Operation memo
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    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
    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
  2. i2tsuki revised this gist Jan 6, 2021. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -50,3 +50,10 @@ kubectl config set-context cluster.local --cluster cluster.local --user=jenkins
    ```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
    ```
  3. i2tsuki revised this gist Oct 20, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ 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_38_18_4C_55_BE_85 org.bluez.MediaControl1.VolumeUp
    dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_38_18_4C_55_BE_85 org.freedesktop.DBus.Introspectable.Introspect
    dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_38_18_4C_55_BE_85/sep1 org.freedesktop.DBus.Introspectable.Introspect
    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
  4. i2tsuki revised this gist Oct 20, 2020. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -43,3 +43,10 @@ openssl x509 -req -in ./${NAME}.csr -CA /etc/kubernetes/ssl/ca.pem -CAkey /etc/k
    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
    ```
  5. i2tsuki revised this gist Oct 20, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Operation memo

    ## Server Operation

    ### General
  6. i2tsuki revised this gist Oct 20, 2020. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,24 @@
    # 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_38_18_4C_55_BE_85 org.bluez.MediaControl1.VolumeUp
    dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_38_18_4C_55_BE_85 org.freedesktop.DBus.Introspectable.Introspect
    dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_38_18_4C_55_BE_85/sep1 org.freedesktop.DBus.Introspectable.Introspect
    ```

    ### TCPdump
    ```bash
    # 128 MB で分割
  7. i2tsuki revised this gist Oct 20, 2020. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -11,3 +11,15 @@ 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
    ```
  8. i2tsuki created this gist Oct 20, 2020.
    13 changes: 13 additions & 0 deletions Operation memo
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # Operation memo
    ## Server Operation
    ### 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
    ```