A sed
solution that selects a column by number:
echo 0 1 2 3 iv 5 6 | sed -E 's/^(\S+\s+){4}(\S+).*/\2/'
or
echo 0 1 2 3 iv 5 6 | sed 's/^\(\S\+\s\+\)\{4\}\(\S\+\).*/\2/'
A sed
solution that selects a column by number:
echo 0 1 2 3 iv 5 6 | sed -E 's/^(\S+\s+){4}(\S+).*/\2/'
or
echo 0 1 2 3 iv 5 6 | sed 's/^\(\S\+\s\+\)\{4\}\(\S\+\).*/\2/'
basename -s .png *.png | xargs -P3 -IF bash -c "convert -density 400 F.pdf F.png; mogrify -trim -resize x740 F.png" | |
# probably something like | |
mogrify -format png -density 400 -trim -resize x740 F.pdf | |
# would do the same thing, but not the point of this gist |
""" | |
make_icons.py - make simple 4 color icons for the box00.png...box15.png | |
Could be adapted for other icon styles, iterates the 16 states in the | |
correct order. | |
WARNING: saves box00.png...box15.png in current directory | |
Terry Brown, [email protected], Tue Mar 27 12:01:11 2018 | |
""" |
theme_name = c.config.getString('theme-name') or c.config.getString('color-theme') | |
roots = [g.os_path_join(g.computeHomeDir(), '.leo'), g.computeLeoDir()] | |
theme_subs = ["themes/{theme}/Icons", "themes/{theme}", "Icons/{theme}"] | |
bare_subs = ["Icons", "."] # "." for icons referred to as Icons/blah/blah.png | |
paths = [] | |
for root in roots: | |
for sub in theme_subs: | |
paths.append(g.os_path_join(root, sub.format(theme=theme_name))) | |
for root in roots: |
from collections import namedtuple | |
Field = namedtuple("Field", 'name type') | |
# creates a `Field` class which has two fixed attributes, `name` and `type` | |
class TablesIndex: | |
"""TablesIndex - index of DB's and tables in an outline""" | |
def __init__(self, c): | |
"""initialize for c |
<html> | |
<head> | |
<style> | |
</style> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://d3js.org/d3-dispatch.v1.min.js"></script> | |
<script src="https://d3js.org/d3-selection.v1.min.js"></script> | |
<script src="https://d3js.org/d3-drag.v1.min.js"></script> | |
</head><body> | |
<svg width='900' height='600'> |
ls *.png | cat -n | sed 's/\(.*[0-9]\)\t\(.*\)/echo mv \2 $(printf %010d \1).png/' | bash |
#!/bin/sh | |
# capture stdin and show in separate window (virtual temporary paper) | |
# "git bash" version | |
cat >/tmp/$$.v.tmp | |
mintty --exec less /tmp/$$.v.tmp & |
""" | |
cross_factor.py - describe | |
Terry N. Brown, [email protected], Mon Apr 03 13:28:41 2017 | |
""" | |
from collections import namedtuple | |
def cross_factor(lists): | |
"""Return (as namedtuples) all combinations of elements from dict of lists""" |
This has moved to https://github.com/tbnorth/defaultdotdict