Wednesday, October 1, 2014

Kostik Matvienko - обманщик

Константин Матвиенко - мошенник, жулик. Не доверяйте фрилансеру по имени
Kostik Matvienko. Подробности могу описать личным сообщением. Будьте бдительны.


 

Wednesday, August 27, 2014

Cache Directory - tar

Regardless of where the application decides to (or is configured to) place its cache directory, it should place within this directory a file named:
CACHEDIR.TAG
This file must be an ordinary file, not for example a symbolic link. Additionally, the first 43 octets of this file must consist of the following ASCII header string:
Signature: 8a477f597d28d172789f06886806bc55

http://www.brynosaurus.com/cachedir/spec.html

Wednesday, July 23, 2014

Python: How to check if a port is open

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex(("127.0.0.1", 80))
if result == 0:
    print "Port is open"
else:
    print "Port is not open"

Original: stackoverflow


import socket
import time
 
HOST=""
PORT=""
TIMEOUT=1.0
 
while True:
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.settimeout(TIMEOUT)
        s.connect((HOST, PORT))
        print "[%s] Connection established" % time.strftime("%H:%M:%S")
        time.sleep(1)
        s.close()
    except:
        print "[%s] Cannot connect" % time.strftime("%H:%M:%S")

Original: sysadminpy.com