cat ... | sort-by your command ...
$ cat toto.jsons
{"a": 1, "b": 2}
#!/bin/bash | |
# what real Python executable to use | |
PYVER=2.7 | |
PATHTOPYTHON=/usr/local/bin/ | |
PYTHON=${PATHTOPYTHON}python${PYVER} | |
# find the root of the virtualenv, it should be the parent of the dir this script is in | |
ENV=`$PYTHON -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"` |
#! /bin/bash | |
# meq = multi-line eq | |
# See https://github.com/jonase/eq#eq-edn-query | |
EQ=eq | |
while read line; do echo "$line" | $EQ $@ ; done |
Perl:
"test" =~ s/(.*)$/\1s/gr # => "testss
Ruby (same engine as Perl):
"test".gsub(/(.*)$/, "\\1s") # => "testss"
I hereby claim:
To claim this, I am signing this object:
G={} | |
for L in open("T"):a,b=L[5::31];G={a:set(),**G};G[b]=G.get(b,{a})|{a} | |
while G:C=min(c for c in G if not G[c]);G={c:G[c]-{C}for c in G if c!=C};print(C,end="") |
#! /bin/bash -e | |
# https://wiki.panotools.org/Panorama_scripting_in_a_nutshell | |
# http://hugin.sourceforge.net/tutorials/scans/en.shtml | |
# This is a tool to vertically stitch together screenshots of black and white | |
# scans. | |
# | |
# Install: | |
# | |
# brew cask install hugin |
# HAR to EditThisCookie converter | |
def domain: | |
.url | |
| sub("^https?://"; "") | |
| sub("/.*"; ""); | |
def cookies: | |
domain as $d | |
| .cookies|map(. + {"domain": $d, |
# save 1 char by using 'for' instead of 'while' | |
x=42;while(c) | |
for(x=42;c;) | |
# save 1 char by using a missing variable instead of "" | |
split($0,b,"") | |
split($0,b,X) | |
# use ternary operations when possible | |
if(c)a else b |