Skip to content

Instantly share code, notes, and snippets.

View natitomattis's full-sized avatar

natitomattis natitomattis

  • 04:39 (UTC +02:00)
View GitHub Profile
@natitomattis
natitomattis / client.py
Created February 28, 2019 11:44
Python TCP client/server
# Streaming Client
import socket
import time
HOST = 'localhost'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
## Source https://github.com/DonJayamanne/vscode-python-samples/tree/master/remote-debugging-docker
## Dockerfile
FROM python:3.6-alpine
COPY . src/
RUN pip install --no-cache ptvsd
EXPOSE 3000
CMD ["python", "src/sample.py"]
## sample.py
@natitomattis
natitomattis / bot.py
Created October 3, 2018 20:35 — forked from lucaspg96/bot.py
A python script to send messages to a telegram user. Useful to notify when long scripts are finished!
#This script is independet of lib or python version (tested on python 2.7 and 3.5)
import telegram
#token that can be generated talking with @BotFather on telegram
my_token = ''
def send(msg, chat_id, token=my_token):
"""
Send a mensage to a telegram user specified on chatId
chat_id must be a number!