Category Archives: Uncategorized

Git change remote repo

Sometimes you start a git repo and some time later, you have to change your remote repo. This can be done really easy with a small catch:

Your new repo should be completely clean.

git remote -v
git remote set-url origin<NEW_USER>/<NEW_REPO_NAME>.git
git merge --allow-unrelated-histories FETCH_HEAD

This will work now:

git push

… and will transfer your old repo’s history to the new repo.

Python Logging Config Sample with Multiple Sinks

Multiple sinks for default logger’s levels


keys=consoleHandler, fileHandler


handlers=consoleHandler, fileHandler


args=("%(log_path)s/%(log_filename)s", "a", "utf-8", False)

format=[%(levelname)-8s] - %(asctime)s (%(threadName)-10s) %(message)s

Test like this:

import logging
import logging.config
from logging import debug, log
from os import path

def main():
    debug("Hello %s", 1)

if __name__ == "__main__":
        r"C:\Workspace\Python\VS Code\Logging\default.conf",
            'log_path': path.dirname(path.realpath(__file__)),
            'log_filename': "%s.log" % path.basename(__file__)[:-3]

    log(logging.INFO, "Started")
    log(logging.INFO, "Finished")

Windows TCP 49154 – What is it!!?

Just had a tough struggle with my “MUTE” friend – Windows Server – trying to understand what’s running behind tcp/49154 on my server, accepting connection.

There are many ALLOW ALL PROFILES WITH ANY PORTS listed on windows’ firewall by default and thinking of them as being secure is not right.

File Server Remote Management (WMI-In) was listening on that port! Disabled the rule and now I’m in peace again! 😀


Use Powershell 5 to start automatic services not running

There are times when windows doesn’t start some automatic services. In situations like this, the best way would be a clean fresh windows installation; but what if you can’t re-install the OS?

This script will be very handy when you can’t re-install the Windows. It runs those nasty services 🙂

$svcs=Get-Service | Where-Object {$_.Status -eq 'stopped' -and $_.StartType -like "*Automatic*"}
foreach ($svc in $svcs){
    Write-Host Starting $svc.Name
    Start-Service $svc

Linux – Find last 10 modified folders.

This post will be updated, but for the mean time this should work:

find . -maxdepth 2 -type d -exec stat -c "%y %n" {} \; | sort | tail -n 20

Update 1:

This is much faster:

find . -maxdepth 2 -type d -printf "%TY-%Tm-%Td %TH:%TM:%TS %TZ %p\n" | sort | tail -n 20


%Path% variable analyzer

Use this in Powershell:

 $env:Path.Split(";".ToCharArray()) | Select-Object @{Name="Path";Expression={$_}},@{Name="Exists";Expression={[System.IO.Directory]::Exists($_)}}

Refresh Intellisense Cache in Microsoft SQL Server Management Studio

When you create a new object in SSMS, its intellisense will not recognize it right away. I had to close and re-open the SSMS to make it see these new objects.

Well, there’s a very nice shortcut to make SSMS see these new objects right away! Press Ctrl+Shift+R to refresh the Intellisense cache after you’ve created a new object and everything will be fine.

PS to those fellas using Red-Gate SQL Prompt:
Don’t forget to press Ctrl+Shift+D refresh SQL Prompt’s cache either.