Skip to content

Instantly share code, notes, and snippets.

@shuckc
shuckc / attempt2.py
Last active August 7, 2023 15:19
Pop open either the L large or S small dialog, and see how the buttons are 'compressed' into a single row, since they fail to get allocated a height of 3 needed for layout. The dialogs height is set dynamically depending on the number of rows required. However the distribution of those rows to the contents is the issue.
from textual.app import App, ComposeResult
from textual.widgets import Label, Button, Footer
from typing import Dict, Optional, List
from textual.screen import ModalScreen
from textual.binding import Binding
from textual.widget import Widget
from textual.containers import Grid, Horizontal, Vertical
from textual.app import App, ComposeResult
from textual.widgets import DataTable
from typing import Dict
ROWS = [
(4, "Joseph Schooling", "Singapore", 50.39),
(1, "Aleksandr Sadovnikov", "Russia", 51.84),
(10, "Darren Burns", "Scotland", 51.84),
]
0x3856db0ac0a8b1fe5fe65e3629358742f1a0b5f2
@shuckc
shuckc / kubemerge.py
Last active February 1, 2021 12:18
Merge multiple kube config files to a single file (manage multiple clusters)
import argparse
import yaml
parser = argparse.ArgumentParser()
parser.add_argument('files', metavar='YAMLFILES', type=argparse.FileType('r'), nargs='*')
args = parser.parse_args()
y = {'apiVersion': 'v1', 'kind': 'Config', 'clusters': [],'contexts': [],
'current-context': 'dev-eu-west-1-aws-bitmex', 'preferences': {}, 'users': []}
for a in args.files:
f = yaml.load(a, Loader=yaml.Loader)
@shuckc
shuckc / main.py
Last active October 25, 2018 20:25
Example order book printing
from bitmex_websocket import BitMEXWebsocket
import logging
from time import sleep
def run():
ws = BitMEXWebsocket(endpoint="https://www.bitmex.com/api/v1", symbol="XBTUSD",
api_key=None, api_secret=None)
logger = logging.getLogger()
@shuckc
shuckc / win32_dns.py
Last active September 30, 2015 19:15
import sys, os
from twisted.python.runtime import platform
from twisted.python import log
from twisted.names import root, resolve, cache, client
from twisted.internet import utils
def parseIpconfigDNSServers(output):
servers = []
found = False