Skip to content

Instantly share code, notes, and snippets.

💭
🔢 👍

Wes Turner westurner

💭
🔢 👍
Block or report user

Report or block westurner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@westurner
westurner / 010-variables.ipynb
Last active Jun 4, 2018
Python variables, references, aliases, garbage collection, scope
View 010-variables.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@westurner
westurner / site_discover.py
Created Nov 16, 2017
find all python*.exe and pip*.exe binaries on os.environ['PATH']
View site_discover.py
#!/usr/bin/env python
"""
Something like this as e.g site.discover
(for use as ``python -m site.discover``)
could be helpful for explaining and diagnosing multiple pythons and pips
"""
import os
import re
from distutils.spawn import find_executable
View search_python_operators.py
def search_operators(str_):
matches = []
for thing in [[x, getattr(int, x).__doc__] for x in dir(int) if x.startswith('__')]:
print((">>>>", (thing[0], thing[1])))
if thing[1] is not None and "<==>" in thing[1]:
print(('<==>', thing[1].split(" <==> ")[::-1]))
if str_ in thing[1]:
matches.append(thing)
print('')
@westurner
westurner / parse_inputrc.py
Last active Sep 19, 2016
parse a readline .inputrc file with Python
View parse_inputrc.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
parse_inputrc -- parse a readline .inputrc file
.. note:: This probably only handles a subset of ``.inputrc`` syntax.
"""
View onenamegist+westurner.txt
Verifying that +westurner is my blockchain ID. https://onename.com/westurner
@westurner
westurner / loglevels.py
Created Feb 15, 2016
loglevels.py: logging._levelNames { (0) NOTSET ; (10) DEBUG ; (20) INFO ; (30) WARN / WARNING ; (40) ERROR ; (50) CRITICAL / FATAL }
View loglevels.py
#!/usr/bin/env python
from __future__ import print_function
import logging
###
def addLevelName__TRACE():
logging.addLevelName(8, 'TRACE')
###
@westurner
westurner / ordereddefaultdict.py
Created Feb 12, 2016
OrderedDefaultDict_.py
View ordereddefaultdict.py
#!/usr/bin/env python
"""
ordereddefaultdict.OrderedDefaultDict
.. code:: bash
$ python ./ordereddefaultdict.py -t
$ nosetests ./ordereddefaultdict.py
$ py.test ./ordereddefaultdict.py
View rdfx_lightweightmarkuplanguages.n3
# :*_markdown_github[__html]
# :*_markdown_commonmark[__html]
# Markdown[HTML] > MarkdownGithub[HTML]
# Markdown[HTML] > MarkdownCommonmark[HTML]
rdfx:Markdown a rdfs:Datatype ;
.
rdfx:MarkdownGithub a rdfs:Datatype ;
@westurner
westurner / i3t.py
Last active Jun 19, 2019
i3wm <alt><tab> alternative
View i3t.py
#!/usr/bin/env python
"""
i3t.py -- list i3wm windows, get next window id, wrap/loop around
Configuration (``.i3/config``)::
set $i3t_alt_tab ~/-dotfiles/src/i3t/i3t.py n
set $i3t_alt_shift_tab ~/-dotfiles/src/i3t/i3t.py p
bindsym Mod1+Tab exec exec $i3t_alt_tab
bindsym Mod1+Shift+Tab exec $i3t_alt_shift_tab
You can’t perform that action at this time.