Archive for the ‘Uncategorized’ Category

Linux: setcap

Wednesday, October 22nd, 2025

Some settings to run Linux commands under unprivileged user without sudo:

After these steps you will be able to run tcpdump and sngrep as a non-root user.

Lubuntu: edit application menu

Tuesday, October 14th, 2025

A tool for editing an application menu in Lubuntu is called ‘menulibre‘, it is available in standard repositories.

I had to edit ‘Menu -> Internet -> Linphone’ – after downloading and updated snap package of Linphone the menu entry became broken and could not launch the application, so I needed to edit the path to the new update package.

If to edit it manually (without MenuLibre), it is located here:

Ubuntu: disabling IBus input method

Tuesday, September 30th, 2025

Tried in Lubuntu 24.04.3 LTS, should work in all *buntu.

To disable:

… and then reboot. To enable back:

OpenSIPS: killing a plenty of dialogs manually

Monday, June 23rd, 2025

This is almost the same as I’ve already posted.

The difference is that now we will kill dialogs not based by the remote side IP address, but based on datestart. There was some short-term connectivity interruption which caused a sudden increase in dialogs count. It’s normal for such a situation and they will end by the configured lifetime (‘default_timeout‘ parameter), e.g. 1 hour.

But what if we don’t want to wait and if we want to kill them manually?

The idea is to pick dialogs which were created during time range, assuming that you know an average call duration, and it’s obvious that if such calls are still shown by ‘opensips-cli -x mi dlg_list’ , it means that it is not valid alive call and you can kill it.

As it’s seen on the graph, the increasing was between 12:14 and 12:23. Let’s say it’s 12:30 now, and an average call duration is 30 … 60 seconds. So, we can kill dialogs which were created between 12:14 and 12:23 and which are still visible with ‘opensips-cli -x mi dlg_list’.

… and so on, up to 12:23. After that you’ll have several txt files with dialog IDs. Not it’s time to kill them:

… and the same for each file.

So, as a summary commands set we may use this one (just setting date/time you need):

SQL: sed-like replacement of a string

Wednesday, April 30th, 2025

Imagine the situation: you have an SQL table with some string in some column. There is a plenty of such rows, and you want to replace this string in each row with some other string, something like in Bash – sed ‘s/green apple/blue apple/g’.

The original table looks like this.

Select:

Result:

We want to change “from ACME” to “moved from ACME”.

First, let’s test our SQL statement with SELECT, no changes will be made:

Now do an SQL UPDATE in a sed-like style:

The result after an UPDATE:

So, to test the statement, do:

To replace, do:

If you need case-insensitive, use ILIKE instead of LIKE.

Asterisk: skip some action within timeout after a call

Tuesday, April 29th, 2025

Let’s skip playing an annoying greeting for the caller, if he already called us withing the last 10 minutes.

Create a macro:

And use this macro in your dialplan:

OpenSIPS: dialplan module usage examples

Sunday, December 8th, 2024

Use case 1:
convert the username consisting of letters in incoming INVITE from your VoIP provider to digits
(e.g. INVITE: rt_user1@192.168.1.203 -> INVITE: 13511654321@192.168.1.203, where country-city-subscriber is 1-3511-654321):

Add to your dialplan table:

So, the SQL record is as follows:

(more…)

Linux Application Firewall

Wednesday, December 4th, 2024

OpenSnitch – a Linux firewall for applications – interactive outbound connections filtering.
https://www.linux-magazine.com/index.php/Issues/2022/259/OpenSnitch
https://github.com/evilsocket/opensnitch

A Bash web server

Wednesday, December 4th, 2024

Nice oneliners which may be useful to show some console output via HTTP.

An example of showing the iptables FORWARD chain:

Then go to http://ip.add.re.ss:8080 and you will see the output as a web page. In case of adding new rules renew the webpage and you will see the newly added rules.

To report file system disk space usage:

More info: https://www.linux-magazine.com/Issues/2021/250/Bash-Web-Server/(offset)/3/(tagID)/92#

Slackware Tagfiles

Saturday, October 12th, 2024

Found some old notes concerning tagfiles. This all is for Slackware 14, but mainly should be useful for newer versions as well, though may have differences, I haven’t checked and compared. See below…

(more…)