$ docker run ubuntu env
$ env
PYTHONUNBUFFERED=1
CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
CHOKIDAR_USEPOLLING=true
HOSTNAME=af072bc9372e
PYTHON_VERSION=3.8.17
CELERY_RESULT_BACKEND=django-db
PWD=/app/backend
PYTHON_SETUPTOOLS_VERSION=57.5.0
HOME=/root
LANG=C.UTF-8
AWS_SECRET_ACCESS_KEY=
ONEVIEW_ENV=DEV
TERM=xterm
SHLVL=1
AWS_ACCESS_KEY_ID=
PYTHON_PIP_VERSION=23.0.1
PYTHON_GET_PIP_SHA256=96461deced5c2a487ddc65207ec5a9cffeca0d34e7af7ea1afc470ff0d746207
PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/0d8570dc44796f4369b652222cf176b3db6ac70e/public/get-pip.py
PATH=/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
AWS_SESSION_TOKEN=
_=/usr/bin/env
> dscacheutil -q host -a name google.com
name: google.com
ipv6_address: 2a00:1450:4009:820::200e
name: google.com
ip_address: 142.250.187.238
> nslookup google.com
Server: fe80::1%15
Address: fe80::1%15#53
Non-authoritative answer:
Name: google.com
Address: 142.250.187.238
TLDR - date -j -f '%d/%b/%y' $INPUT_DATE +%Y-%m-%d
-f
takes strftime
format string,
man strftime
datetime.strftime
also uses the exact
same format string, because python internally uses standard c library’s
strftime
+%Y-%m-%d
is the output format-j
do not try to set the date, this allows the usage of
-f
and +
to convert one date format to
anotherlpr
to print
hardcopiesTL;DR:
lpr -p -o EPIJ_Silt=1 -o Resolution=720x720dpi -o EPIJ_Qual=307 ./lpoptoins.pdf
Use lpoptions -l
to show custom options for printer,
such as
EPIJ_Qual/Print Quality: 308 311 *303 309 304 305 306 307
.
Note that only EPIJ_Qual
is used in printing option
e.g. lpr -o EPIJ_Qual=308
, the text after /
is
an short description of the option.
Example output of lpoptions -l
$ lpoptions -l
...
EPIJ_Ink_/Grayscale: *1 0
EPIJ_Qual/Print Quality: 308 311 *303 309 304 305 306 307
ColorModel/ColorModel: *RGB Mono
Resolution/Resolution: 180x180dpi *360x360dpi 720x720dpi
PageSize/Media Size: *A4 EPKG EPKG.NMgn EPPhotoPaper2L A6 A5 B5 B6 EPPhotoPaperLRoll EPPhotoPaperLRoll.NMgn EPIndexCard5x8 EP8x10in EPHiVision102x180 EPHiVision102x180.NMgn EPPostcard100x148 EPPostcard100x148.NMgn Env10 EnvDL EnvC6 Letter EP216x330mm EPIndianLegal Legal EP16K195x270mm Custom.WIDTHxHEIGHT
EPIJ_Silt/Quiet Mode: *0 1
...
upzip
/Library/Printers/PPDs/Contents/Resources/EPSON\ ET-2810\ Series.gz
to ~/Documents/downloads/
read the mearning of options.
Run the following command in the unzipped downloads
folder
$ cat EPSON\ ET-2820\ Series | grep Qua
...
*EPIJ_Qual 308/Draft: ""
*EPIJ_Qual 311/Draft-Vivid : ""
*EPIJ_Qual 303/Normal: ""
*EPIJ_Qual 309/Normal-Vivid: ""
*EPIJ_Qual 304/Fine: ""
*EPIJ_Qual 305/Quality: ""
*EPIJ_Qual 306/High Quality: ""
*EPIJ_Qual 307/Best Quality: ""
...
Other Useful Links:
/private/etc/cups/ppd
Question: How to exclude *.tsx
, migrations files, and
python tests files?
git grep 'tiger' -- '*.py' ':!*tests*' ':!*migrations*'
# same as
git grep 'tiger' -- '*.py' ':(exclude)*tests*' ':(exclude)*migrations*'
After the --
the patterns used are
<pathspec>
, see man gitglossary
.
rg 'tiger' --glob '!{**/tests/*,**/migrations/*}'
# if you are sure there are no files with name `tests` or `migations`, you
# can do
rg 'tiger' --glob '!{tests,migrations}'
rg 'tiger' -g '!tests' -g '!migrations'
du -d 1 -h | sort --human-numeric-sort --reverse | head
worth noting that
--human-numeric-sort
specifically
for human output i.e. du -h
Notes for the future:
to have alt-v
works I need to set the right
alt
key to be Esc+
in iTerm2
Q: How do I make the option/alt key act like Meta or send escape codes? A: Go to Preferences > Profiles tab. Select your profile on the left, and then open the Keyboard tab. At the bottom is a set of buttons that lets you select the behavior of the Option key. For most users, Esc+ will be the best choice.
from iterm2 faq
# -c Create a new archive
# -v Verbose output
# -f file.tar.gz Use archive file
# -z Filter the archive through gzip i.e. compress or decompress archive
tar -c -z -v -f yuhao_huang.tar.gz foo/
# -x Extract files from an arc
# -x Extract files from an archive
# -z Filter the archive through gzip i.e. compress or decompress archive
# -v Verbose output
# -f file.tar.gz Use archive file
tar -x -z -v -f yuhao_huang.tar.gz -C ~/Downloads/bar/
# -z Filter the archive through gzip i.e. compress or decompress archive
# -v Verbose output
# -f file.tar.gz Use archive file
# -t List the contents of an archive
tar -z -t -v -f yuhao_huang.tar.gz
Certain shell commands are builtin to zsh
, others are
exposed in PATH. echo
is a shell built-in command
cat
is exposed in PATH.
$ which echo
echo: shell built-in command
$ which cat
/bin/cat
BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in bzip2, coreutils, dhcp, diffutils, e2fsprogs, file, findutils, gawk, grep, inetutils, less, modutils, net-tools, procps, sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The utilities in BusyBox often have fewer options than their full-featured cousins; however, the options that are included provide the expected functionality and behave very much like their larger counterparts.
BusyBox seems useful to
cat
in C
https://github.com/mirror/busybox/blob/master/coreutils/cat.c
docker run -it --rm busybox
/bin # ls -l | wc -l
406
There are 406 utilities in busybox /bin, whereas MacOS has 980 in
/usr/bin
.