Skip to content

Instantly share code, notes, and snippets.

View trangnth's full-sized avatar
🐄
love heals all

Trang Nguyen trangnth

🐄
love heals all
  • University of Engineering and Technology
  • Hanoi, Vietnam
View GitHub Profile
@trangnth
trangnth / graylog_token.txt
Created September 28, 2023 04:27 — forked from joschi/graylog_token.txt
Graylog access token login
# Create an access token for user "admin" with name "test-1234"
# POST /users/{username}/tokens/{name}
$ curl -i -u admin:admin -H 'Accept: application/json' -X POST 'http://127.0.0.1:12900/users/admin/tokens/test-1234?pretty=true'
HTTP/1.1 200 OK
X-Graylog-Node-ID: cd03ee44-b2a7-4824-be16-bb7456149dbd
Content-Type: application/json
Date: Mon, 08 Aug 2016 12:12:09 GMT
Content-Length: 139
{
@trangnth
trangnth / ubuntu_update_booting_kernel.md
Created August 28, 2023 02:51 — forked from chaiyujin/ubuntu_update_booting_kernel.md
Ubuntu: Install Kernel and Set GRUB Default Kernel

Ubuntu: Install Kernel and Set GRUB Default Kernel

Install Kernel

Install the default kernel:

sudo apt install linux-generic

Set GRUB Default Kernel

  1. Find entrance from /boot/grub/grub.cfg
    • Get the $menuentry_id_option:
@trangnth
trangnth / linux-kill-pts.md
Created March 14, 2022 07:31 — forked from holmberd/linux-kill-pts.md
Kill tty/pts sessions in Linux

Kill user tty/pts sessions in Linux

Commands

  • w: show who is logged on and what they are doing
  • who: show who is logged on
  • tty: show current users pseudo terminal
  • ps -ft pts/1: get process id for the pseudo terminal
  • pkill: signal process based on name and other attributes
@trangnth
trangnth / rspamd-whitelisting.md
Created December 2, 2021 09:20 — forked from ThomasLeister/rspamd-whitelisting.md
How to whitelist IP addresses or domains in Rspamd

Whitelist IP addresses based on pre-filter policy

/etc/rspamd/local.d/multimap.conf:

  IP_WHITELIST {
      type = "ip";
      prefilter = true;
      map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
 action = "accept";
@trangnth
trangnth / mailserver-howto.md
Created November 2, 2021 08:21 — forked from ibqn/mailserver-howto.md
Email server based on Dovecot, Postfix, MySQL, Rspamd and Debian 9 Stretch

Email server based on Dovecot, Postfix, MySQL, Rspamd and Debian 9 Stretch

MySQL database setup

Install MariaDB as a database management system DBMS

sudo apt install mariadb-server

Create a new database named srvmail for a mail server:

@trangnth
trangnth / kafkacat.md
Created June 7, 2021 03:16
kafka_note
  • list messages trong 1 partition
kafkacat -b 10.5.69.6:9092 -t imap-2 -p 1
  • Metadata listing:
root@trangnth-kafka:/opt/confluent# kafkacat -L -b 10.5.6.6:9092 -t imap-2 
Metadata for imap-2 (from broker 1: 10.5.6.6:9092/1):
@trangnth
trangnth / RabbitMQ.md
Last active June 4, 2021 04:10
RabbitMQ

upgrade rabbitmq từ 3.6.x -> 3.8.16

backup lại user password

Listing users
monitor [monitoring]
openstack       [None]
guest   [administrator]
@trangnth
trangnth / header_filter_by_lua_example.md
Created April 28, 2021 09:40 — forked from ejlp12/header_filter_by_lua_example.md
nginx, openresty, transform/modify response body, header_filter_by_lua
@trangnth
trangnth / auth.pl
Created April 27, 2021 08:42 — forked from mmriis/auth.pl
IMAP/POP3 proxy authentication script for nginx. See http://www.whatastruggle.com/nginx-as-an-imappop3-proxy-part-2.
#!/usr/bin/perl
use Digest::HMAC_MD5 qw/ hmac_md5_hex /;
use DBI;
use URI::Escape;
use CGI;
print "Content-type: text/html\n";
my $q = CGI->new;

Quick cheat sheet of helpful tmux commands

  1. tmux new - Create and attach to a new session.
  2. tmux new -s NAME_HERE - Create and attach to a new session named NAME_HERE.
  3. CTRL-b, d - Detach (i.e. exit) from the currently-opened tmux session (alternatively, tmux detach). Note, this means press and hold CTRL, press b, release both, press d.
  4. tmux ls - Show list of tmux sessions.
  5. tmux a - Attach to the previously-opened tmux session.
  6. tmux a -t NAME_HERE - Attach to the tmux session named NAME_HERE.
  7. CTRL-d - Delete (i.e. kill) currently-opened tmux session (alternatively tmux kill-session).
  8. CTRL-b, [ - Enter copy mode, and enable scrolling in currently-opened tmux session. Press q to exit.
  9. CTRL-b, " - Split window horizontally (i.e. split and add a pane below).