_no, not that kind

Interesting useful stuff.

2024/02/04: how to create an user on oracle 21xe

Sorry, Oracle users, but I sometimes forget how to create a user on Oracle databases. Last day, I needed to set up an Oracle 21XE test environment. I just discovered this Vagrant official images space. So, after cloning that repo, navigate to the OracleDatabase directory and then to the 21.3.0-XE directory and start the vagrant with vagrant up; this will take many minutes to complete, so, at the end, enter the Vagrant using the vagrant ssh command.

Now, follow this in the Oracle Vagrant virtual machine:

  1. sudo su -
  2. su - oracle
  3. sqlplus / as sysdba
  4. alter session set "_ORACLE_SCRIPT"=true;
  5. CREATE USER username IDENTIFIED BY password;
  6. GRANT CONNECT, RESOURCE, DBA TO username;

That's it. Now we have a 100% funcional Oracle DB running in our localhost (port 1521).

2023/11/19: how to share the wifi connection with iptables

A lot of years ago I used a similar script to share the Wi-Fi Internet connection from a Debian-based old Netbook (tough days, I know) to my main wired box (an AMD FX-based box with Slackware Linux 14). The Netbook receives the Internet from a Wi-Fi card and shares that connectivity via an Ethernet NIC in a separate internal network.

Guess what, I'm still dealing with the same problem today: I have a Raspberry Pi 3b+ running FreeBSD 13.2, which doesn't support native Wi-Fi hardware. I had two choices: 1) Wipe the SD card and install a Linux distribution (bruh...), 2) connect the Raspberry Pi 3b+ directly to the router, or 3) recall how I fixed this issue previously.

Let's follow the hardest way:

┌─────────────────┐       ┌─────────────────┐       ┌────────────────┐
│                 │       │                 │       │                │
│   wi-fi router  │       │    bergelmir    │       │      rhea      │
│                 ├───┬───►                 ├───┬───►                │
│                 │   │   │  wlan0    eth0  │   │   │  ue0           │
└─────────────────┘   │   └─────────────────┘   │   └────────────────┘
                      │                         │
                      ▼                         ▼

                 wi-fi net                    wired net
                 192.168.1.X                  10.0.0.X

This script does the magic after connecting two boxes with an ethernet cable:

#!/bin/bash

# the eth0 interface is the raspberry pi 3b+ gateway
ip addr add 10.0.0.1/24 dev eth0

# share from wlan0 to eth0
iptables -A FORWARD -o wlan0 -i eth0 -s 10.0.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

# show the route table
route -n

# all done.

Note: The FreeBSD box must be configured as follows:

  1. Run the bsdconfig command as the root user.
  2. Go to the "Network Management" section of the main menu.
  3. Navigate to the second section, "Network Interfaces," and choose your nic interface (ue0 in my case), then set DHCP to "Disabled," "ipaddr" to 10.0.0.10 and "netmask" to 255.255.255.0. Exit.
  4. Next, go to the fourth box option called "Default Router/Gateway" and enter 10.0.0.1 before saving. Exit.
  5. Go to "DNS nameservers" option and set the default DNS resolver as 8.8.8.8. Exit
  6. Exit the bsdconfig utility.

Welcome to the family rhea.

2023/11/15: rundeck dynamic launcher and cleaner

I love all related to automation and usually, I have multiple versions of Rundeck installed on my computer for testing. So, the following scripts allow you to run any Rundeck version, the requirement is to save every war file in a folder named with the version number. In that way, you can provide the Rundeck version as an argument.

The launcher.sh script:

#!/bin/bash

cat <<EOF
Usage: $0 rundeck_version_number
Example: $0 4.17.2

EOF

if [ $# -eq 0 ]
  then
    echo "No Rundeck version supplied"
else
    cd $1
    java -jar -server -Xmx4096m -Xms1024m -Drundeck.jaaslogin=true -Dserver.servlet.session.timeout=300 rundeck-$1-*.war
fi

# all done.

cleaner.sh:

#!/bin/bash

cat <<EOF
Usage: $0 rundeck_version_number
Example: $0 4.17.2

EOF

if [ $# -eq 0 ]
  then
    echo "No Rundeck version supplied"
else
cd $1
rm -rf etc/ libext/ projects/ repository/ server/ user-assets/ var/

fi

# all done.

Enjoy.