Skip to content

Instantly share code, notes, and snippets.

@vigneshmanix
vigneshmanix / pac3200dataLoggin.py
Last active March 11, 2019 16:53
Python code to log data from SENTRON PAC3200 every second using pymodbus for Modbus TCP communication
#!/usr/bin/env python
# Title: anyfloat.py
# Author: Gribouillis for the python forum at www.daniweb.com
# Created: 2012-05-02 06:46:42.708131 (isoformat date)
# License: Public Domain
# Use this code freely.
from __future__ import print_function
from collections import namedtuple
from math import isnan
import struct
du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'
#!/usr/bin/python
import sys;
import imaplib;
host = 'webmail.nitt.edu';
port = 143;
uname = sys.argv[1];
passwd = sys.argv[2];
conn = imaplib.IMAP4(host,port);
try: