Ubuntu - Reload Sound

When plugging sound/recording devices into an Ubuntu computer, the device will often appear in the sound management software, but you will be unable hear anything through it. Running the following command will reload the sound system and the device will "magically" start working again.

pulseaudio -k && sudo alsa force-reload


IPTables - Port Forwarding

Today I found myself needing to route all my server's incoming web packets to a docker container that was acting as a reverse proxy. This is done by simply running the following commands to add rules to the NAT. If you want to forward different ports, just change the numbers 80 and 443.

sudo iptables -t nat -A PREROUTING -d $HOST_PRIVATE_IP/32 -p tcp --dport 80 -j DNAT --to-destination $PROXY_IP
sudo iptables -t nat -A PREROUTING -d $HOST_PRIVATE_IP/32 -p tcp --dport 443 -j DNAT --to-destination $PROXY_IP
sudo iptables -A FORWARD -p tcp -d $PROXY_IP --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -p tcp -d $PROXY_IP --dport 443 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
The variable HOST_PRIVATE_IP is named as such because in this case it was an AWS instance, and one needs to use the private IP rather than the public IP in such a case.


VLC - Remove Bottom Green Bar

If you find that you have a horizontal bar at the bottom of your videos during playback as shown below, there here is how to fix it.

    Select Tools -> Preferences to open up the preferences menu.
    Navigate to the "Video" section and change "Output" to "X11 video output".