сряда, април 08, 2026

Windows CMD & PowerShell (like bash) aliases

How to check the used environment (shell):


Command
Confirm CMDecho %COMSPEC%
Confirm CMD (stronger)echo %cmdcmdline%
Confirm PowerShell$PSVersionTable
Confirm Bashecho $SHELL
Confirm WSL vs Git Bashuname -a


for CMD:

notepad C:\Users\%USERNAME%\cmd_aliases.cmd    
    @echo off
    doskey ll=dir /a
    doskey cd..=cd ..
    doskey gs=git status $*
$* = forward all arguments (like $@ in Bash)

CheatSheet:
BashCMD
alias ll='ls -la'doskey ll=dir /a
alias gs='git status'doskey gs=git status
alias k='kubectl'doskey k=kubectl $*

Auto-run:
reg add "HKLM\Software\Microsoft\Command Processor" ^
/v AutoRun ^
/t REG_SZ ^
/d "C:\Users\%USERNAME%\cmd_aliases.cmd"




for PowerShell
notepad $PROFILE
    $TerraformBackends = @{
        f1        = "C:\f1.conf"
        f2        = "C:\f2.conf"
       'f3-hub'   = "C:\f4_hub.conf"      ### spaces in names are not supported
       'f4-spoke' = "C:\f4_spoke.conf"  ### hypens (-) are not valid. That is why f3-hub is closed with ''
        f5       = "C:\f5-phxmedsl-hub.conf"
    }

    function init {
        param (
            [Parameter(Mandatory)]
            [ValidateSet("f1", "f2", "f3-hub", "f4-spoke", "f5")]
            [string]$Env
        )

        terraform init --backend-config $TerraformBackends[$Env]
    }

Auto-run: (reload ps profile)
. $PROFILE
 
Execute:
PS C:\init f1  
will execute terraform init --backend-config= 
"C:\f1.conf"

CheatSheet:
BashPowerShell
alias ll='ls -la'function ll { Get-ChildItem -Force }
alias gs='git status'function gs { git status @args }
alias k='kubectl'function k { kubectl @args }
alias grep='grep --color'function grep { grep --color=auto @args }

понеделник, април 06, 2026

Disability scooter

В автомобила имам лифт/кран, който е включен към 12V акумулатор и с него качвам и свалям електрическият си скутер в/от багажника . Този кран/лифт епоръчван от фирма в Холандия и монтиран тук, в България. Не съм търсил специализиран сервиз. Мисля, че всеки сервиз би се справил, защото те компанията предоставя много добра документация със схема на свързване и напътствия.

Директният линк към техният продукт е: https://www.onbeperktinbeweging.nl/en/mobility/wheelchair-hoist/

Техните лифтове са съобразени с конкретна тежест (което пък беше ключов параметър при търсенето на скутер) 25/42/58кг

Имат и други продукти - роботизирана ръка, която да качва инвалидна количка, автоматични рампи и прочие.

Предполагам, че има или поне би ми се искало да има компании предоставящи подобни услуги и в България, но ... аз не съм попадал на такива (и ще съм благодарен ако Вие сте попадали и ги споделите с мен)

Колкото до скутера: търсих скутер който да се сгъва (foldable), да е достъчно лек за да може да се качва на ръка в багажника или да е достатъчен за подемната мощност на лифта по-горе.

Първият отговарящ на горните изисквания, който притежавах, беше закупен от Макс Моторс и се сгъваше на ръка. 

https://maxmotors.bg/product/elektricheska-chetirikolka-750w-mini/

Този също си струва да се погледне (с различна седалка е):  https://maxmotors.bg/product/elektricheska-chetirikolka-750w-eco-m/

Струва си да се обмисли и този модел: https://maxmotors.bg/product/elektricheska-trikolka-a3-750w-yellow/ защото е доста по-подходящ за пресечена местност, по-високи бордюри и пр., но в крайна сметка да се има предвид, че не е сглобяем.

Подобни модели има в алиекспресс и алибаба на по-ниски цени, но срока на доставка е около 2-3-4 месеца. 

Примерно: New upgrade folding electric scooter adult double motor 4 wheels folding electric wheelchair scooter elderly 

или: New handicapped Foldable Electric Scooter Adult Dual motor 4 Wheels Folding Electric Wheelchair Scooter For Elderly People


Този който използвам в момента е: 2025 max load 120kg fordable dual motor 4 wheel portable automatic folding electric mobility scooter seniors

Разликата му спрямо другите е:


    1.сгъва се автоматично (от дистанционното на ключа)


    2.Батерията му се сваля - което е много удобно, когато трябва да се зарежда - без да се качва до апартамента целият скутер, а само батерията се вади, зарежда и връща. 

    3.Също така някои авиокомпании искат батерията да е removable за да приемат с кутера в салона или в багажното (ограничението е 300Wh!)

Рейнджа му е около 10-15 км, като батерията от 10% до 90% се зарежда за около 3 часа. Тежи 32кг заедно с батерията и може да се качи и прибере в багажника и на ръка, не само с авто-лифта.

Другият вариант, който си струва да се обмисли (при използване на инвалидна количка): устройство, с батерия и ел.мотор, което се закача към инвалидната количка и то "дърпа" количката.

Примерно:  Wheelchair Drive Motors Kit for Disabled People Wheelchair Attachment Handcycle

Или дори още по-сериозният вариант: Powerfully Factory Best Price Supply 12inch Suspension Model 36v 1200w Wheelchair Electric Vehicle Attachment

Второто е доста по-скъпо, но и доста по-мощно, което за  разходки навън/в парка/на планина/плаж/язовир е неоценимо!


петък, октомври 10, 2025

Retrieving passwords from Fortigate

 https://community.fortinet.com/t5/FortiGate/Technical-Tip-How-to-Recover-BGP-Password/ta-p/414414

 1. Copy ENC password from CLI

sh vpn ipsec phase1-interface test-vpn-tunnel
config vpn ipsec phase1-interface
    edit "test-vpn-tunnel"
        .....
        set psksecret ENC tP2sK9fIsnZfffZg9cG6u5hkyC/MUVXBsIcaOTJlH2cV4K89XjE86c98KyolJrmiWJsQqT12rK82a1o2EiUZFWrTxik8JQegsPVbIZvq2qIPfcNCifgQAco/NjuQ4f5PyIipJzS5tyWMbysWYsP4GTNlQ==
    next
end

 2. Create an SSID in Fortigate (enable WiFi Controller under System -> Feature Visibility) 

    2.1. Set Pre-shared Key -> Passprase

    2.2 Edit in CLI & change the passphrase of the SSID to the BGP password copied from Step 1

config wireless-controller vap
    edit "TEST"
        set passphrase ENC <----- Encrypted BGP Password copied from Step 1.
    next
end

3. From FortiGate GUI, go to WiFi Controller -> SSID -> Edit SSID. On the 'Passphrase' parameter, select the 'eye' icon to reveal the password.

 That method is tested and confirmed working on Fortigate 7.0 for local users, radius secret, IPSec PSK

 

Another way of retrieving IPSec PSK password:  

Retrieving IPsec VPN PSK key from Fortigate 


 

 

 

сряда, октомври 08, 2025

iRedMail greylisting

 Disable greylisting for sender IP:
python3 greylisting_admin.py --disable --from '45.56.127.226'

To whitelist IP addresses/networks of some mail domain, for example, outlook.com, microsoft.com, please run command like below:
cd /opt/iredapd/tools/
python3 spf_to_greylist_whitelists.py outlook.com microsoft.com



Show and add server-wide whitelists or blacklists:

python3 wblist_admin.py --list --whitelist
python3 wblist_admin.py --list --blacklist

# Whitelist IP address, email address, entire domain, subdomain (including main domain)
python3 wblist_admin.py --add --whitelist 192.168.1.10 user@domain.com @iredmail.org @.example.com

# Blacklist IP address, email address, entire domain, subdomain (including main domain)
python3 wblist_admin.py --add --blacklist 202.96.134.133 bad-user@domain.com @bad-domain.com @.sub-domain.com

For per-user or per-domain whitelists and blacklists, please use option --account. for example:

python3 wblist_admin.py --account @mydomain.com --add --whitelist 192.168.1.10 user@example.com
python3 wblist_admin.py --account user@mydomain.com --add --blacklist 172.16.1.10 baduser@example.com

python3 wblist_admin.py --account @mydomain.com --list --whitelist
python3 wblist_admin.py --account user@mydomain.com --list --blacklist

четвъртък, април 03, 2025

Lost in translation (Български поговорки)

 

Don't call "bear" not to come.    Не викай "мецо" да не дойде.
From the drunk even the madman runs away.    От пияния и лудият бяга.
Finished her like the dog in the field.    Свърши я като кучето на нивата.
The vineyard does not want a prayer, wants a mattock.    Лозето не иска молитва, а мотика.
The dogs bark to themselves, the caravan is walking.    Кучетата си лаят, керванът си върви.
Noone is bigger than the bread.    Никой не е по-голям от хляба.
Neither fish nor cancer (crab, lobster).    Ни риба, ни рак.
Quiet waters are the deepest.    Тихите води са най-дълбоки.
On bare ass (belly) a pair of pistols.    На гол гъз (тумбак) чифте пищови.
For the wolf we're talking and he is in the pen.    За вълка говорим, а той е в кошарата.
The wolf is stuffed and the lamb in its entirety.    И вълкът - сит, и агнето - цяло.
Meal wrestling makes.    'Ранътъ пра'и борбътъ.
Eagle, crab and pike.    Орел, рак и щука.
For him who blows.    За тоя, дето духа.
For him who swings the fores.    За тоя, дето клати гората.
On every hair times 108.    На всеки косъм по сто и осем.
Line an ass on the bridge.    Като магаре на мост.
Like an elephant in a glassware shop.    Като слон в стъкларски магазин.
Like a calf in a train.    Като теле в железница. 
On the ant a road costs.    На мравката път стува.
Bent sits, staithgt reasons.    Криво седи, право съди.
With a cloak in the summer, with a purse in the winter.    Лете със абичка, зиме със торбичка.
Strike the seddle the donkey to conceive.    Бий самара да се сеща магарето.
Many grannies, feeble child.    Много баби - хилаво дете.
Which watch?    Колко е часът?
Help yourself God to help you too.    Помогни си сам, за да ти помогне и Господ.
These are flowers, there will be fruit too.    (Russian proverb) Это цветочки, а еще и ягодки будут.
Under the road and over the road.    Под път и над път.
Ears don't stand higher than the eyes.    Ушите не стоят по-горе от очите.
For green spawn (cavier).    За зелен хайвер.
To see where the crabs hybernate.    Да види къде зимуват раците.
House on fire to burn the rats.    Запали къщата да изгори мишките.
Patient, horse, for green grass.    Трай, коньо, за зелена трева.
Two water-mellons under the armpit.    Две дини под една мишница.
Sick healthy brings.    Болен здрав носи.
To plant him on duck's eggs.    Да го насадиш на пачи яйца.
Water stamps - thirsty walks.    Вода гази - жаден ходи.
White coins for black days.    Бели пари за черни дни.
He who studies will succeed.    Който учи ще сполучи.
Piper house does not feed.    Свирач къща не храни.

вторник, декември 10, 2024

Безглаголно стихотворение -3

 Кръчма. Музика. Мезе.

Маса. Пепелник. Кафе.

Водка. Бира. Вино. Джин.

Скоч със лед. Цигарен дим.


Сервитьорка с бронзов тен.

Бюст. Прозрачен сутиен.

Гледка. Мисъл за любов!

Жажда. Питие 'Смирноф'!


Утро. Слънце. Светлина.

Махмурлук. Метро. Жена.

Викове. Скандал. Сълзи.

Съд. Развод. Живот. Мечти.


Автор неизвестен

вторник, ноември 19, 2024

Azure VNET name resolving

 

VNET resolving steps

  1. If a custom DNS /Private Resolver is configured -> send all requests there
  2. If Azure DNS services (Azure Public DNS) are configured
    1. Check for a private zone attached to the vnet
    •  if yes -> answer with Private DNS RR; done
    • If no -> b.
    1. Send query to Public Azure DNS-es

That is why under Private DNS zone -> Settings -> Virtual Network Links we have to have a bound link to the Vnet

Only attached to the Private Zones VNETs will be able to resolve entries inside the zone (i.e. they are not shared outside of vnet linked resource)

If I want to use Private DNS zone with Custom DNS I have to configure <private DNS zone> forwarding ruleset on Custom DNS to 168.63.129.16.

 BIND format -> private DNS zone= example.internal

/etc/bind/named.conf.options

 

zone "example.internal" {

    type forward;

    forwarders { 168.63.129.16; };

};

 

 

https://xkln.net/blog/dns-name-resolution-in-azure/

https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances?tabs=redhat

https://learn.microsoft.com/en-us/azure/dns/private-dns-overview

сряда, юли 17, 2024

ЗАЩО ЧОВЕК СЕ РАЖДА

ЗАЩО ЧОВЕК СЕ РАЖДА


Ако е мъртъв камъкът; ако пръстта е няма;

ако небето синьо е измама;

ако звездите светят само в тъмнината;

ако изгасва огънят; ако листата

растат напролет и изгниват есента;

ако до време духа всеки вятър;

ако заглъхва над земята песента;

ако надолу всичките реки текат;

ако с вода се утолява всяка жажда;

ако до гроба свършва всеки път,

кажи ми ти - защо човек се ражда?

Георги Джагаров. 



понеделник, май 13, 2024

Extract 500k lines from Azure logs and process them against geoip

 

Which countries accessed some.site.tld (10.248.1.1)  last 30 days 

[located in Azure behind Azure Firewall and AzureApplication Gateway]

 

The query:

AzureDiagnostics

| where ResourceProvider == "MICROSOFT.NETWORK" and Category == "ApplicationGatewayFirewallLog"

| project TimeGenerated, clientIp_s, hostname_s //, requestUri_s, action_s, ruleId_s, Message, details_message_s

| where hostname_s contains "some.site.tld"

//| distinct clientIp_s // сортира по различни clientIp_s e.g. uniq ?

//| distinct clientIp_s, TimeGenerated

//| order by hostname_s

//| summarize count() by clientIp_s, bin(TimeGenerated, 5m)

//| summarize count() by clientIp_s, bin(TimeGenerated, 1m)

//| render timechart

 

 

Category == "ApplicationGatewayAccessLog"

Category == "ApplicationGatewayFirewallLog"

 

ResourceProvider

        MICROSOFT.NETWORK

            Resource

        CS-HUB-P-WAF-PUBLIC-AGW

 

Producing more than 30k lines  (restrictions are 10k or 30k max - GUI limitations)

The PowerBI integration for Logs works with Logs API – therefore the limitation is not the UI limitation of 30K results but the API limitation of 500k results

 From <https://learn.microsoft.com/en-us/answers/questions/1328922/query-output-limits-%28laws-pbi%29>

 

Export to excel

Azure  -> logs -> Query -> Run (>30k lines)

  • Update query to reduce the number of lines (e.g. where, distinct, etc)
  • Export - Power BI ( as an M query) -> will generate and download txt file with API command

Excel -> Data -> Get Data -> From Other Sources -> Blank query => Advanced editor => paste content of txt file (API command with credentials)

The result is 500k lines output based on log query log

 

 

Select only IP addresses and export them to txt/csv file

GeoLite2 data created by MaxMind : https://www.miyuru.lk/geoiplegacy (April 2024)

GeoIP archive (2013) https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/

DB-IP: https://db-ip.com/db/

 

On bash:

apt-get install geoip-bin geoip-database

    MacOS: brew install GeoIP

    dockerfile: dockerfile.run/geoiplookup 

cat ./ip_list.txt | sort | uniq | xargs -n 1 geoiplookup { }

 

Or running the script bellow:

cat geoip_lookup.sh

#!/usr/bin/bash

#cat /var/log/apache2/ | awk '{print $1}' > ips.txt

#uniq ips.txt > uniques.txt

IPS=`cat IPs.txt`

#echo $IPS

for ip in $IPS

do

echo "`geoiplookup $ip | cut -d "," -f2 | sed -e 's/^[ \t]*//'` `geoiplookup -f /usr/share/GeoIP/GeoLiteCity.dat $ip | cut -d "," -f4,5 | sed -e 's/^[ \t]*//'` $ip"

#echo

done

Will provide a result like:

Netherlands Noord-Holland, Amsterdam 52.142.230.106

United States N/A, Boydton 52.167.144.137

Germany N/A, N/A 194.37.84.209

Sweden Sodermanlands Lan, Nyköping 93.158.90.70

 

 

MaxMind Country:

wget --no-check-certificate https://dl.miyuru.lk/geoip/maxmind/country/maxmind4.dat.gz

MaxMind City:

wget --no-check-certificate https://dl.miyuru.lk/geoip/maxmind/city/maxmind4.dat.gz