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
def has_methods(*methods): | |
def decorator(Base): | |
def __subclasshook__(Class, Subclass): | |
if Class is Base: | |
attributes = collections.ChainMap(*(Superclass.__dict__ for Superclass in Subclass.__mro__)) | |
if all(method in attributes for method in methods): | |
return True | |
return NotImplemented | |
Base.__subclasshook__ = classmethod(__subclasshook__) | |
return Base |
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
#!/bin/bash | |
success=true | |
# Echo the line number and result of the last command. | |
verify () { | |
local result=$? | |
local frame=($(caller 0)) | |
local lno=${frame[0]} | |
echo -n "$lno: " | |
if [ $result -eq 0 ]; then |
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 django.urls.resolvers import URLResolver, URLPattern | |
def compose_decorators(decorators, wrappee): | |
if not hasattr(decorators, '__iter__'): | |
decorators = (decorators, ) | |
for wrapper in decorators: | |
wrappee = wrapper(wrappee) | |
return wrappee |
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 datetime import datetime | |
import functools | |
import logging | |
import sys | |
logger = logging.getLogger(__name__) | |
handler = logging.StreamHandler() | |
handler.setLevel(logging.INFO) | |
logger.addHandler(handler) |
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
#!/bin/bash | |
set -eu | |
test_prefix="tests" | |
function name_cmd () { | |
local grp=$1 | |
echo "./${test_prefix}/cmd_${grp}" | |
} |
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
#!/bin/bash | |
pid=`pgrep $1` | |
[ "$pid" != "" ] && xdotool search --onlyvisible --pid $pid |
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
#!/bin/bash | |
while [ `pgrep firefox` != "" ] | |
do | |
for winid in $(xdotool search --onlyvisible --pid `pgrep firefox`) | |
do | |
echo $winid | |
sleep 0.2 | |
if [ "$winid" != "" ] | |
then | |
while 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
#!/bin/bash | |
xsel --clipboard --input |
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
[ | |
// Side bar is toggled with [CTRL + SHIFT + B] | |
{ | |
"key": "ctrl+shift+b", | |
"when": "sideBarVisible", | |
"command": "workbench.action.closeSidebar" | |
}, | |
{ | |
"key": "ctrl+shift+b", | |
"when": "!sideBarVisible", |
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
{ | |
// Instead of turning this off, use the key binding [CTRL+k Enter] to change an editor in preview mode into edit mode. | |
"workbench.editor.enablePreview": true, | |
// Useful suggestion | |
"editor.quickSuggestions": true, | |
"editor.suggest.statusBar.visible": true, | |
"editor.suggest.localityBonus": true, | |
"editor.suggest.showKeywords": true, |
OlderNewer