Skip to content

Instantly share code, notes, and snippets.

$ sudo tcpdump -n -i eth0 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and ( dst host example.com || dst host dns.google)'
@s3fxn
s3fxn / logind.conf
Created February 14, 2021 05:58
How to disable suspend when LCD lid closed
--- /etc/systemd/logind.conf.orig 2020-07-09 03:59:14.000000000 +0900
+++ /etc/systemd/logind.conf 2020-12-05 13:43:13.737762761 +0900
@@ -22,6 +22,7 @@
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
+HandleLidSwitch=ignore
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
gsettings set org.gnome.desktop.interface clock-show-date true
@s3fxn
s3fxn / ssh-sample
Created June 7, 2020 09:23
how to update remote-host by using my laptop as proxy
ssh -t -R 1080 remote-host "sudo env http_proxy=socks5h://localhost:1080 apt update"
@s3fxn
s3fxn / sudoers
Last active January 3, 2020 13:52
sudoers for 24 hours password timeout
Defaults timestamp_timeout = 1440
@s3fxn
s3fxn / terraform
Created February 11, 2019 06:21
terraform wrapper
#!/bin/bash
ver="0.11.11"
test -t 1 && opt="-it"
exec docker run --rm -u $(id -u) -v $(pwd):/app/ -w /app/ $opt hashicorp/terraform:$ver "$@"
@s3fxn
s3fxn / mitamae
Created February 11, 2019 06:10
mitamae wrapper
#!/bin/bash
ver="v1.7.1"
dir="$(dirname `readlink -f $0`)"
cmd=$dir/mitamae-x86_64-linux-$ver
src=https://github.com/itamae-kitchen/mitamae/releases/download/$ver/mitamae-x86_64-linux
test -x $cmd || curl -sL $src -o $cmd && chmod +x $cmd
exec $cmd "$@"
@s3fxn
s3fxn / centos7_disable_rpcbind.sh
Created December 23, 2018 09:25
disable rpcbind(111/tcp) on CentOS7
#!/bin/bash
sudo systemctl stop rpcbind
sudo systemctl disable rpcbind
sudo systemctl mask rpcbind
sudo systemctl stop rpcbind.socket
sudo systemctl disable rpcbind.socket
sudo systemctl status rpcbind
@s3fxn
s3fxn / centos7_microk8s.sh
Last active April 14, 2024 04:40
Install microk8s on CentOS7
#!/bin/bash
sudo yum -y install epel-release
sudo yum -y install snapd
sudo systemctl enable snapd
sudo systemctl start snapd
sleep 5
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install microk8s --classic
sleep 5
@s3fxn
s3fxn / centos7_docker-ce.sh
Created November 25, 2018 19:20
Install docker-ce on CentOS7
#!/bin/sh
sudo yum -y install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo