# find hosts with port 80 open
nmap -PE -p 80 xxx.yyy.zzz.*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
requirements: | |
$ pip install click | |
run with: | |
$ python tcp_proxy --listen=:5000 --connect=192.168.1.100:5000 | |
""" | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Execute with sudo | |
# Recipe at: https://unix.stackexchange.com/questions/152331/how-can-i-create-a-virtual-ethernet-interface-on-a-machine-without-a-physical-ad | |
NAME=bl04-eth | |
ALIAS=$NAME:0 | |
MAC=00:22:22:ff:ff:ff | |
IP=192.168.100.199 | |
# Create interface | |
ip link add $NAME type dummy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example output: | |
2020-05-05 20:04:47,200 trying to connect to bl04cryocon:5000 | |
2020-05-05 20:04:47,701 error: TimeoutError() | |
2020-05-05 20:04:47,702 trying to connect to bl04cryocon:5000 | |
2020-05-05 20:04:48,203 error: TimeoutError() | |
2020-05-05 20:04:48,204 trying to connect to bl04cryocon:5000 | |
2020-05-05 20:04:48,706 error: TimeoutError() | |
2020-05-05 20:04:48,707 trying to connect to bl04cryocon:5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
import threading | |
from tango.server import Device, attribute, command | |
attrs = [ | |
dict(name='voltage', dtype=float, label='Voltage', fget=lambda dev: 1.2345), | |
dict(name='power_level', dtype=str, label='Power level', fget=lambda d: 'high') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import serial_asyncio | |
I=0 | |
async def loop(): | |
global I | |
while True: | |
await asyncio.sleep(0.1) | |
I += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A gevent friendly version of inotify_simple | |
Either instanciate INotify objects directly from `ginotify_simple.INotify`: | |
```python | |
from ginotify_simple import INotify, flags | |
ify1 = INotify() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A gevent friendly version of inotify | |
Either instanciate Inotify (or InotifyTree) objects directly from `ginotify.Inotify`: | |
```python | |
from ginotify import Inotify | |
ify1 = Inotify() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
import threading | |
def sleep(): | |
time.sleep(random.random()) | |
N = 5 | |
sticks = [threading.Lock() for n in range(N)] |