Skip to content

Instantly share code, notes, and snippets.

View scientificRat's full-sized avatar
😝
Working

Zhengyue Huang scientificRat

😝
Working
  • Tsinghua University
View GitHub Profile
@scientificRat
scientificRat / print_table_console.py
Created August 14, 2018 03:37
print table to console
def print_table(head, body, padding_left=1, padding_right=2):
# calc column lens
head = list(head)
col_lens = [len(c) + padding_left + padding_right for c in head]
for i in range(len(body)):
body[i] = list(body[i])
row = body[i]
if len(row) > len(head):
head.append('')
col_lens.append(0)
@scientificRat
scientificRat / nat_traversal_local.py
Last active July 9, 2018 04:28
Nat traversal (text communication)
import socket as sc
import argparse
import os, sys
class NatTraversalTool(object):
def __init__(self, server_address, local_name, remote_name):
self.server_address = server_address
self.local_name = local_name
self.remote_name = remote_name