Python - Checking times and dates
In Python, you can use a function called
datetime.now()
to retrieve
the current date and time. First you need to import the
datetime library
so that it can be used in the script, which can be done with
from datetime import datetime
. You can then display the
current date and time with
print datetime.now()
. E.g.:
$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>>
>>> print datetime.now()
2016-06-22 12:34:06.719688
>>>
You can also use datetime.today()
.
>>> print datetime.today()
2016-06-22 14:31:26.736321
>>>
The time is in hours, minutes, seconds, and fractions of a second.
[ More Info ]
[/languages/python]
permanent link
Open sites list for a Chrome process on OS X
Chrome on a MacBook Pro laptop running OS X Yosemite (10.10.5) that I
was using became unresponsive.
Activity
Monitor showed a Google Chrome process was using about 100% of the CPU
cycles. I wanted to see what web sites the process was accessing in the browser
tabs associated with the process. One way to do so is to double-click
on the Chrome process in the Activity Monitor, which will open a
smaller window showing information on that process. Click on the
Open Files and Ports tab on that window. You can then copy the
information you see in that window into a file and, using
grep, extract all of the lines containing
the IP address of the system, which will provide a list of sites accessed by
the Chrome process.
[ More Info ]
[/network/web/browser/chrome]
permanent link