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
import pyparsing as pp | |
from typing import Literal | |
class TermNode: | |
def __init__(self, term_type: Literal["WORD", "PHRASE"], value: "Node"): | |
self.term_type = term_type | |
self.value = value | |
def __repr__(self): | |
return f"TermNode({self.term_type}, {self.value})" |
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
/** | |
* A fully typed i18n micro library. The react import is optional for the hook (see below). | |
* | |
* Idea from https://dev.to/halolab/implementing-the-translate-function-with-typescript-5d8d | |
* | |
* TODO: check if we can get i18n-ally working: https://github.com/lokalise/i18n-ally/issues/678#issuecomment-947338325 | |
*/ | |
import { useEffect, useState } from "react" | |
type PathKeys<T> = T extends string |
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
import asyncio | |
from functools import wraps | |
def async_debounce(wait): | |
def decorator(func): | |
task = None | |
@wraps(func) | |
async def debounced(*args, **kwargs): | |
nonlocal task |
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
''' | |
rate_limit2.py | |
Copyright 2014, Josiah Carlson - josiah.carlson@gmail.com | |
Released under the MIT license | |
This module intends to show how to perform standard and sliding-window rate | |
limits as a companion to the two articles posted on Binpress entitled | |
"Introduction to rate limiting with Redis", parts 1 and 2: |
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
# C-b is not acceptable -- Vim uses it | |
set-option -g prefix C-a | |
setw -g xterm-keys on | |
# Fix colors tmux + vim | |
# if this still does not work then put this in your .bashrc: | |
# alias tmux='tmux -2' | |
set -g default-terminal "screen-256color" |
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
import argparse | |
import os | |
import pydicom | |
from pathlib import Path | |
parser = argparse.ArgumentParser() | |
parser.add_argument('input_folder', help='The DICOM input folder.') | |
parser.add_argument('output_folder', help='The DICOM output folder.') | |
parser.add_argument('-m', '--modify_dicom_tag', help='Modifies a DICOM tag.', type=str, nargs=2, action='append') |
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
{ | |
"editor.formatOnSave": true, | |
"html.format.enable": false, | |
"prettier.tabWidth": 4, | |
"prettier.disableLanguages": ["html", "django-html"], | |
"python.formatting.provider": "black", | |
"python.linting.pylintEnabled": true | |
} |
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
{ | |
"python.experiments.optInto": ["DeprecatePythonPath - experiment"], | |
"python.venvPath": "~/.cache/pypoetry/virtualenvs", | |
} |
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
{ | |
"git.autofetch": true, | |
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", | |
"python.formatting.provider": "black", | |
"[javascript]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
"editor.renderControlCharacters": false, | |
"editor.renderWhitespace": "none", | |
"prettier.disableLanguages": ["django-html"], |
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
/** | |
* Adapted (and translated in Kotlin) from https://gist.github.com/FrantisekGazo/d1a62fcddd0c97453ee6d57efef17916 | |
* Nice usage scenario https://www.novatec-gmbh.de/en/blog/building-android-components/ | |
*/ | |
object RxTextView { | |
private val textViewObservables = HashMap<TextView, Observable<CharSequence>>() | |
@JvmStatic | |
fun textChanges(view: TextView): Observable<CharSequence> { | |
val observable = textViewObservables[view] |
NewerOlder