This file contains 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
from dataclasses import dataclass, fields, Field | |
from typish import SubscriptableType | |
import yunit | |
class QuantityMeta(SubscriptableType): | |
@property | |
def typed_unit(cls): |
This file contains 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
%config InteractiveShell.ast_node_interactivity = 'last_expr_or_assign' |
This file contains 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
# coding: utf-8 | |
# | |
# Montiors the total memory usage of all Chrome processes. | |
# To be run on a Windows machine. | |
# Requirements: | |
# - Python 3.6+ | |
# - Pandas | |
print('Press Ctrl-C to quit') | |
print('\n..', end='') |
This file contains 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
from pprint import pformat | |
from tabulate import tabulate | |
rows = [] | |
for name in dir(obj): | |
val = getattr(obj, name) | |
if callable(val): | |
try: | |
content = val() |
This file contains 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
-- Export to csv via SQLite Database Browser: | |
create table promo_post_data as select * from pagepostdata where post_name='Promo-post' | |
-- Export to csv via SQLite CLI: | |
sqlite> .header on | |
sqlite> .output c:/work/dataout.csv | |
sqlite> .mode csv | |
sqlite> SELECT * FROM pagepostdata WHERE post_name='Promo-post' | |
sqlite> .output stdout |
This file contains 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
class A: | |
def f(self, x): return self.f(x/2) + 1 | |
class B(A): | |
def f(self, x=10): | |
if x < 0: return self.f(x+200) + 2 | |
if x > 20: return A.f(self,x-50) + 3 | |
else: return x | |
from pylab import * |