Skip to content

Instantly share code, notes, and snippets.

View mbdevpl's full-sized avatar

Mateusz Bysiek mbdevpl

View GitHub Profile
@mbdevpl
mbdevpl / millisecond_clock.tcl
Created January 5, 2021 04:07
Millisecond clock
#!/usr/bin/env wish8.6
set intervalms 1
variable theclock
proc setclock {} {
global intervalms theclock
set micros [clock microseconds]
set epoch [expr $micros / 1000000]
set micros [format "%06d" [expr $micros % 1000000]]
#!/usr/bin/env python3
"""Automate preparation of files for deployment to Bintray from CI.
Currently works with:
- Travis CI
- AppVeyor
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbdevpl
mbdevpl / pylint_wrong_error_loc.py
Last active January 13, 2018 07:15
Pylint issue - wrong location of too-many-public-methods error
"""Some code causing strange behavior in Pylint."""
import enum
import itertools
import logging
import re
import typing as t
import packaging.version
import pkg_resources
@mbdevpl
mbdevpl / .Bintray deployment for Travis CI and AppVeyor.md
Last active April 4, 2018 04:02
Bintray deployment for Travis CI and AppVeyor

Python scripts and YAML config samples to make deployment to Bintray from Travis CI and AppVeyor easier.

# solution for:
# https://stackoverflow.com/questions/12544056/how-to-i-get-the-current-ipython-notebook-name
#
# aimed at:
# IPython 4.2.0 and Python 3.5
import json
import os
import urllib.request
import ipykernel
@mbdevpl
mbdevpl / typing_sequence_unsubscriptable.py
Created January 12, 2016 14:15
Hmmm, but typing.Sequence is subscriptable!
"""
Hmmm, but typing.Sequence is subscriptable!
"""
import typing
T = typing.Sequence[int] # Value 'typing.Sequence' is unsubscriptable
print(T)
@mbdevpl
mbdevpl / my_metaclass.py
Created January 12, 2016 13:51
Testing metaclass support in Pylint.
"""
Testing metaclass support in Pylint.
Inspired by http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python
"""
import typing
class MyMetaclass(type):
""" This is my metaclass. """
# attempt for:
# http://stackoverflow.com/q/30193945/4973698
#
# Do `pip install pyreadline` and run this script.
#
# Unfortunately, it does not work!
import readline
def input_def2(prompt, default=''):