convert txt to pdf

1 – install packages that contain e2ps and ps2pdf binary

apt-get install e2ps ghostscript

2 – convert txt to ps

e2ps -a4 -p file.txt > file.ps

3 – convert ps to pdf

ps2pdf file.ps

– one liner converter

e2ps -a4 -p file.txt > file.ps && ps2pdf file.ps
Advertisements

install geoip iptables module debian 9

install the packages below

apt-get install xtables-addons-common xtables-addons-dkms libtext-csv-xs-perl

Execute this script

#!/bin/bash
set -euo pipefail

set +e
if ! dpkg -l xtables-addons-common >/dev/null ; then
        apt install xtables-addons-common
fi
if ! dpkg -l libtext-csv-xs-perl >/dev/null ; then
        apt install libtext-csv-xs-perl
fi
set -e

if [ ! -d /usr/share/xt_geoip ]; then
        mkdir /usr/share/xt_geoip
fi

geotmpdir=$(mktemp -d)
csv_files="${geotmpdir}/GeoIPCountryWhois.csv ${geotmpdir}/GeoIPv6.csv"
OLDPWD="${PWD}"
cd "${geotmpdir}"
/usr/lib/xtables-addons/xt_geoip_dl
/usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip ${csv_files}
cd "${OLDPWD}"
rm -r "${geotmpdir}"
exit 0

to test

iptables -A FORWARD -m geoip --src-cc BR -j DROP

configure xterm

install the package that contains xrdb binary

apt-get install x11-xserver-utils

show current configuration

xrdb -query -all

set a new configuration, put the lines in ~/.Xresources

vi ~/.Xresources

! set window size
xterm*geometry: 120x34

! set xterm colors
xterm*background:   yellow
xterm*foreground:   black

! set xterm keybindings
xterm.*.translations: #override \n \
        <Key>F1:     string("X") \n \
        <Key>F2:     string("Y") \n \
        <Key>F3:     string(0x1b)    string("[11~") \n \
        <Key>F4:     string(0x1b)    string("[12~")

reload configuration

xrdb ~/.Xresources

remove all configuration

xrdb -remove -all

more about xterm: http://invisible-island.net/xterm/xterm.faq.html

encrypt shell scripts

1 – Install shc package

apt-get install shc

2 – Create the shell script file

vi file.sh

#!/bin/bash
for i in {1..3}; do echo $i: $RANDOM; done

3 – Encrypt shell script file using shc

shc -f file.sh

Output generated files: file.sh.x  file.sh.x.c

4 – Execute the encrypted shell script

./file.sh.x

5 – Specifying expiration date for your shell script ( dd/mm/yyyy format )

shc -e 30/07/2017 -f file.sh

6 – Add custom expiration message for your shell script

shc -e 30/07/2017 -m contact 'my@mail.com' -f file.sh

tint2 panel openbox

1 – Install packages

apt-get install tint2 gsimplecal

2 – Add lines bellow in tint2 configuration file

vi .config/tint2/tint2rc

# Panel Icons
panel_items = LTSBC
launcher_padding = 0 3 5
launcher_icon_size = 21
launcher_item_app = /usr/share/applications/chromium.desktop
launcher_item_app = /usr/share/applications/firefox-esr.desktop

3 – Execute tint2

tint2

To reload tint2rc configuration file, kill and start tint2

pkill tint2 && tint2