Category: Tips

Disable LidSwitch on Ubuntu

$ sudo vi /etc/systemd/logind.conf #HandleLidSwitch=suspend HandleLidSwitch=ignore $ sudo systemctl restart systemd-logind

VirtualBox CLI commands

$ vboxmanage list vms $ vboxmanage list runningvms $ vboxmanage startvm [VM name] $ vboxmanage controlvm [VM name] poweroff $ vboxmanage controlvm [VM name] acpipowerbutton $ vboxmanage unregistervm [VM name] –delete

Draw UML from VSCode

# Requirement: Java should be installed on your machine 1. Search PlantUML from Marketplace in VSCode 2. Install PlantUML 3. Create a file with the “.plantuml” extension ex) squence.plantuml 4. Start with “@startuml” 5. Write down some script code (reference: https://0x010.com/uploads/PlantUML_Language_Reference_Guide_ko.pdf) 6. End with “@enduml” 7. See the corresponding UML by typing “Alt + D”

Mount a directory though NFS

$ sudo apt-get install nfs-common $ sudo mkdir /directory-to-mount $ sudo mount [NFS Server IP Address]:[Path] /directory-to-mount

Get Wildcard Certificate from Let’s Encrypt

$ sudo apt-get install letsencrypt certbot $ certbot certonly –manual -d *.example.com -d example.com –preferred-challenges dns

Use X-Window on Mac OS X

https://www.xquartz.org

Create a CentOS Local (Mirror) Repository

# yum install -y httpd # chkconfig httpd on # service httpd start # mkdir -p /var/www/html/centos # rsync  -avSHP –delete –exclude “local*” –exclude “isos” ftp.neowiz.com::centos /var/www/html/centos

Port forwarding through OpenVPN and Socat

$ sudo apt-get install -y openvpn socat $ sudo mkdir /etc/openvpn/[name] $ sudo vi /etc/openvpn/[name]/[name].ovpn ## == ## … OpenVPN Configuration … auth-user-pass /etc/openvpn/[name]/[name].auth … OpenVPN Configuration … ## == ## $ sudo touch /etc/openvpn/[name]/[name].auth ## == ## [ID] [PASSWORD] ## == ## $ sudo vi /etc/systemd/system/[name]-vpn.service ## == ## [Unit] Description=OpenVPN Client Service After=multi-user.target […]

LXC Cheat Sheet

# create a container $ sudo lxc-create -n [NAME] -t ubuntu # start a container $ sudo lxc-start -n [NAME] -d # stop a container $ sudo lxc-stop -n [NAME] # remove a container $ sudo lxc-destroy -n [NAME] # show the list of containers $ sudo lxc-ls –fancy # edit the configuration of a […]

Open vSwitch Cheat Sheet

# Add a flow rule (forward packets coming from port X to port Y) $ sudo ovs-ofctl add-flow ovsbr0 in_port=X,actions=output:Y # Get flow rules $ sudo ovs-ofctl dump-flows ovsbr0 # Delete flow rules $ sudo ovs-ofctl del-flows ovsbr0 # Get port-to-interface mappings $ sudo ovs-ofctl show ovsbr0