Skip to content

Instantly share code, notes, and snippets.

View kaihendry's full-sized avatar

Kai Hendry kaihendry

View GitHub Profile
<div id="root"></div>
<script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script type="jsx" src="main.js"></script>
#!/bin/bash
cache=~/.cache/sloc2
count() {
echo Arg "$@" >&2
if ! test -d "$1"
then
echo $1 not a dir >&2
#!/bin/bash -e
cache=~/.cache/sloc
count () {
local in
read -r in
set -- "$in"
fullpath=$(readlink -f "${1:-.}")
echo Full path: "$fullpath"
foo () {
set -- < /dev/stdin
echo Arghs $0 $1
}
printf "one\ntwo\nthree" | dmenu | foo
#!/bin/bash
count () {
test -d "$1" || cd "$1"
for i in *
do
dirsep=$(test -d $i && echo /)
echo ${i}${dirsep} $(find $i -type f -exec cat {} + | wc -l)
done | dmenu -l 10 | count
}
[hendry@t480s src]$ find firefox-78.0.1 -type f -exec wc -l {} \; | awk '{ SUM += $1} END { print SUM }'
43627834
[hendry@t480s src]$ find firefox-78.0.1 -type f -exec wc -l {} + | awk '{ SUM += $1} END { print SUM }'
87255668
[hendry@t480s src]$ find firefox-78.0.1 -type f | xargs wc -l | grep 'total$' | awk '{ SUM += $1} END { print SUM }'
wc: firefox-78.0.1/obj-x86_64-pc-linux-gnu/_virtualenvs/init/lib/python2.7/site-packages/setuptools/script: No such file or directory
wc: '(dev).tmpl': No such file or directory
wc: firefox-78.0.1/obj-x86_64-pc-linux-gnu/_virtualenvs/init/lib/python2.7/site-packages/setuptools/command/launcher: No such file or directory
wc: manifest.xml: No such file or directory
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
10024971
[hendry@t480s src]$ find firefox-78.0.1 -type f | xargs -0 wc -l | grep 'total$' | awk '{ SUM += $1} END { print SUM }'
xargs: argument line too long
[root@knuckles mnt]# mount -t exfat /dev/mmcblk0p1 /mnt/sdcard
FUSE exfat 1.3.0
Usage: /sbin/mount.exfat [-d] [-o options] [-V] <device> <dir>
[root@knuckles mnt]# mount.exfat /dev/mmcblk0p1 /mnt/sdcard
FUSE exfat 1.3.0
WARN: '/dev/mmcblk0p1' is write-protected, mounting read-only.
input=/mnt/sdcard/
find $input -iname "*.jpg" | while read fn
do
if test $(exiv2 -Pv -g Xmp.xmp.Rating $fn) == 3
then
dt=$(exiv2 -g Exif.Image.DateTime -Pv $fn)
read -r date time <<< "$dt"
IFS=: read -r year month day hour min secs <<< "$date"
IFS=: read -r hour min secs <<< "$time"
ymd=$(date -u -d "${year}-${month}-${day}T${hour}:${min}:${secs}" +%Y-%m-%d)
input=/mnt/sdcard/
find $input -iname "*.jpg" | while read fn
do
if test $(exiv2 -Pv -g Xmp.xmp.Rating $fn) == 3
then
dt=$(exiv2 -g Exif.Image.DateTime -Pv $fn)
read -r date time <<< "$dt"
IFS=: read -r year month day hour min secs <<< "$date"
IFS=: read -r hour min secs <<< "$time"
ymd=$(date -u -d "${year}-${month}-${day}T${hour}:${min}:${secs}" +%Y-%m-%d)