GiGl first alpha version available

GiGl (Glycemic index/Glycemic load) is an app that I developed for personal usage. It is a fast way to check the expected response of your body to most of the commonly available foods. Key points:

  • No tracking. No adds. The app doesn’t require network permissions.
  • Insulin index (II where scientific study available).
  • Open-source.

Continue reading “GiGl first alpha version available”

Fighting SPAM with postfix and fail2ban

After detecting spammers with an RBL list you can block them for a predefined period of time with the help of fail2ban. How does it work:
– fail2ban parses mail.log
– when a spammer IP is found it is added to a temporary list
– future requests from the spammer’s IP is blocked Continue reading “Fighting SPAM with postfix and fail2ban”

Copy data from bloomberg sft with winscp cmd

It is a little bit tricky to run winscp command. Here is a working example:

  1. connect and authenticate with pre shared key
  2. synchronize all except bin,etc
  3. exit with correct exit code
  4. eventually run powershell script
@echo off
"C:\Path\WinSCP.com" ^
  /log="C:\Path\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://username@sftp.bloomberg.com/ -hostkey=""ssh-rsa 2048 AA:BB:CC:DD:EE:FF:AA:BB:CC:DD:EE:FF:00:00:00:00"" -privatekey=""C:\Path\bloomberg.ppk""" ^
    "synchronize -filemask=""|/bin/;/etc/""  local ""SFTP"""^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

powershell -file sync2r.ps1
exit /b %WINSCP_RESULT%

 

Change local admin password with PowerShell

Change local admin password on multiple machines with PowerShell.

$computers = "srv1","srv2","srv3"
$adminPassword = "PAssW00rrrDdd123"
$logfile = "log.txt"
$ErrorActionPreference = 'stop'
ForEach ($computerName in $computers){
        Try { 
            
             $adminUser = [ADSI] "WinNT://$computerName/Administrator,User"
             $adminUser.SetPassword($adminPassword)

        } 
        Catch { 
            "$(get-date) :: Server:$($computerName) :: $($error[0].exception)" | Out-File -append $logfile                                          
        } 
}