Skip to content

Instantly share code, notes, and snippets.

@quyenlv
quyenlv / vncserver@.service
Last active November 20, 2018 04:06
Setup securely VNC through SSH tunnel
# Vncserver service file for Debian or Ubuntu with systemd
#
# Install vncserver
# apt-get install tightvncserver
#
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Edit User=
# e.g "User=jo"
# 3. Edit the vncserver parameters appropriately in the ExecStart= line!
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels)
@quyenlv
quyenlv / install-gimp.md
Last active May 19, 2024 14:24
Install Photoshop-like GIMP

Install GIMP

sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp gimp-gmic

Install Photoshop theme

wget -O gimp-2.8.zip http://drive.noobslab.com/data/themes/gimp/gimp-2.8.zip
@quyenlv
quyenlv / remote-capture-packet.rst
Last active December 28, 2018 10:08
Remote capturing packet with tcpdump and wireshark

Topology

+------------------+                    +----------------------+
|   Local host     |  tcpdump over ssh  |    Remote Host       |
|                  |--------------------|                      |\ eth0
| +--------------+ |--------------------|                      |/
| |   Wireshark  | |                    |  tcpdump -i eth0...  |
@quyenlv
quyenlv / remote-capture-packet-simple.rst
Last active June 22, 2024 19:35
Remote capturing packet with tcpdump and wireshark.

Topology

+------------------+                    +----------------------+
|   Local host     |  tcpdump over ssh  |    Remote Host       |
|                  |--------------------|                      |\ eth0
| +--------------+ |--------------------|                      |/
| |   Wireshark  | |                    |  tcpdump -i eth0...  |
@quyenlv
quyenlv / config-port-forwarding-linux.md
Last active January 9, 2019 10:53
Simple port forwarding configuration
@quyenlv
quyenlv / config-port-forwarding-simple.md
Last active September 3, 2019 15:01
Simplest port forwarding configuration using the common tool "socat".

Just using this one-music-note command

sudo socat TCP4-LISTEN:12345,fork TCP4:192.168.1.2:56789

Or with UDP port:

sudo socat UDP-LISTEN:161,fork UDP:10.72.211.141:161
@quyenlv
quyenlv / encode-video-ffmpeg.md
Last active January 15, 2019 08:13
Encode video using ffmpeg.

Encoding

Encode video for uploading to Youtube/Vimeo. The output should be a similar quality as the input and will hopefully be a more manageable size.

ffmpeg -i input.avi -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p output.mkv

Same as above, but also re-encode the audio using AAC instead of stream copying it:

ffmpeg -i input.mov -c:v libx264 -preset slow -crf 18 -c:a aac -b:a 192k -pix_fmt yuv420p output.mkv
@quyenlv
quyenlv / ssh-passwordless-login.md
Last active July 1, 2020 06:34
Automated and passwordless SSH logins

Create the RSA Key Pair

ssh-keygen -t rsa

Copy the public key to a server

ssh-copy-id user@server
@quyenlv
quyenlv / tacacs-plus-launch.rst
Last active May 17, 2024 09:30
Very basic steps to try TACACS+.

Installation

Install tacacs+ server:

sudo apt-get install tacacs+

Install tacacs+ client:

@quyenlv
quyenlv / aix-ls
Last active March 7, 2019 19:51 — forked from earonesty/aix-ls
ls --color support for systems that don't have it, like AIX, and when you don't want to install gnu
#!/usr/bin/perl
use strict;
use Getopt::Long qw(:config pass_through no_ignore_case bundling);
my $do_color;
GetOptions("colors"=>\$do_color);
my @buf;