An example in python 2
on how you can run a shell command from within your python program. Further examples can be found in the python 2 documentary on subprocess.
# -*- coding: utf-8 -*-
#
# utils.py
# GIT PS1 | |
# COLORS | |
LIGHT_GRAY="\[\033[0;37m\]"; BLUE="\[\033[0;34m\]"; RED="\[\033[0;31m\]"; LIGHT_RED="\[\033[1;31m\]"; | |
GREEN="\[\033[0;32m\]"; WHITE="\[\033[1;37m\]"; LIGHT_GRAY="\[\033[0;37m\]"; YELLOW="\[\033[1;33m\]"; | |
BROWN="\[\033[0;33m\]"; BLACK="\[\033[0;30m\]";PURPLE="\[\033[0;35m\]";CYAN="\[\033[0;36m\]"; | |
# GIT PROMPT (http://gist.github.com/120804) | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/'; | |
} | |
function parse_git_status { |
import signal | |
class InterruptableRegion(object): | |
def __init__(self, sig=signal.SIGINT): | |
self.sig = sig | |
self.interrupted = False | |
self.released = False | |
self.original_handler = None | |
def __enter__(self): |
Here are a list of headless browsers that I know about:
s = "abcdba"
all(f==e for f, in zip(s[0:len(s)//2:1], s[len(s):(len(s)-1)//2:-1]))
VSCode remote in WSL
MikTex installation:
Fonts in Windows
from sqlalchemy import event | |
from sqlalchemy import DDL | |
def _mysql_cidr_overlap(metadata): | |
@event.listens_for(metadata, "after_create") | |
def _create_mysql_proc(target, connection, **kw): | |
if connection.engine.name != 'mysql': | |
return |