This file contains hidden or 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 | |
| # async def aiter(num): | |
| # for i in range(num): | |
| # await asyncio.sleep(2) | |
| # yield i | |
| # async def run(num): | |
| # async for i in aiter(num): | |
| # print(i) |
This file contains hidden or 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 datetime | |
| async def foo(): | |
| now = datetime.now() | |
| ten_mins_from_now=now + datetime.timedelta(minutes=10) | |
| while datetime.now()< ten_mins_from_now: # must be changed into a coroutine? | |
| sleep(30) | |
| return 'foo has returned' | |
This file contains hidden or 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 datetime | |
| x=a_datetime_generator_obj | |
| datetime_date=next(x) | |
| times={'starttime':datetime_date,'endtime':datetime_date+datetime.timedelta(minutes=3)} | |
| timesformatted= {k: v.strftime(fmt)[:-3] for k,v in times.items()} |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # rand.py | |
| import asyncio | |
| import random | |
| # ANSI colors | |
| c = ( | |
| "\033[0m", # End of color | |
| "\033[36m", # Cyan |
This file contains hidden or 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
| j=[1,2,3] | |
| k=[5,4,1] | |
| for foo in j: # want to break out and move to next foo after if | |
| for bar in k: | |
| if foo=bar: | |
| make_bread() | |
| break |
This file contains hidden or 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
| In[92]: color | |
| Out[92]: ['#112623', '#BE8774', '#F38F6D', '#6AFE8E', '#FF6784', '#17D719', '#AD1EBB'] | |
| In[93]: cluster_labels.values() | |
| Out[93]: dict_values([1, 2, 6, 0, 5, 4, 3]) | |
| In[94]: {clust:color for clust,color in (cluster_labels.values(), color in color)} | |
| Traceback (most recent call last): | |
| File "C:\Users\sky1\PycharmProjects\untitled2\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3267, in run_code | |
| exec(code_obj, self.user_global_ns, self.user_ns) | |
| File "<ipython-input-94-7e1796abb8e5>", line 1, in <module> | |
| {clust:color for clust,color in (cluster_labels.values(), color in color)} |
This file contains hidden or 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
| # how can i get just the values instead of the array objects ? | |
| { | |
| "cluster" + str(int(i) + 1): i | |
| for i in clust_obj.predicted_clusters[["cluster"]].values[range(len(clust_obj.predicted_clusters))] | |
| } | |
| Out[40]: | |
| {'cluster2': array([1]), | |
| 'cluster3': array([2]), |
This file contains hidden or 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
| ~ ❯❯❯ echo "5)"| nc 172.16.2.25 10000 | |
| Please enther number of packets: Traceback (most recent call last): | |
| File "./ping.py", line 3, in <module> | |
| num_packets = int(input(' Please enther number of packets: ')) | |
| File "<string>", line 1 | |
| 5) | |
| ^ | |
| SyntaxError: unexpected EOF while parsing | |
| ~ ❯❯❯ echo "5')"| nc 172.16.2.25 10000 | |
| Please enther number of packets: Traceback (most recent call last): |
This file contains hidden or 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
| 00c34b01d7ceb48f32d0d72017d768f88a6c1a3edc9f51fb5803d52b53aa8bc4 | |
| 0474b466151470ca175c397982e0320ac49c6f355796cc6a04326ba1c4e80679 | |
| 06391591f2436ed4401babaf1cb5b04cdc49715913eabc794db3dda1ef7a6d00 | |
| 07b2bc7a0f96a4c733f5a26443be4d2bad02a8ee5b89b4a4e4efd2bdf889d699 | |
| 07c7e4d9d716c48b9eb5ad32f45d5036ecfbe544f3a4ce318c3aabe6e36c6e2e | |
| 096b4e4debed2090f96abb3531d2c4f4497834ec770c9af1112cb2bf71dbc5ae | |
| 09d388ca74f5fd26ad46af73f2455a157a18f6a3097de20acedcdf73d2487856 | |
| 09d7edd39a60aba76b7cd18bbeacee62393bf206aabe9c4e5fe03cfaf05e1d5e | |
| 105249d1725de95b5391b1eac959c6968729d7595a46370e68c453e6febadc19 | |
| 14608aeec352d1a1197f3d9cbc354c57a7d32cee1bc42c14feb4bcbc769e36bd |
This file contains hidden or 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
| >>> k=os.listdir('C:\\') | |
| >>> print [filemame for filename in k if 'Bin' in filename] | |
| Traceback (most recent call last): | |
| File "<input>", line 1, in <module> | |
| NameError: name 'filemame' is not defined | |
| >>> print [filemame for filename in k if 'Bin' in k] | |
| [] | |
| >>> print [k for k in k if 'Bin' in k] | |
| ['$Recycle.Bin'] | |
| >>> print [k for filename in k if 'Bin' in filename] |
NewerOlder