mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 9fe6211e8eac0d0c04d0491f66cdb5de9fbab7c8
parent 92cf948d79db3f615d182dfffebf0743343846db
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed,  9 May 2018 23:33:45 +0200

Merge branch 'master' of a3nm.net:git/mybin

Diffstat:
get_android_photos | 9+++++++++
ircfilter.py | 21+++++++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/get_android_photos b/get_android_photos @@ -0,0 +1,9 @@ +#!/bin/bash + +D=$(date '+%Y-%m-%d') +DIR="$HOME/photos_android" +mkdir -p "$DIR" +cd "$DIR" +adb pull /sdcard/DCIM/ "$D/" && sudo chown -R $USER:$USER "$D" +echo "warning: adb should finish by giving a summary (N files pulled, 0 files skipped) otherwise it may have failed silently" +echo "if everything is OK, you can review the photos in $DIR/$D and then delete them from the phone" diff --git a/ircfilter.py b/ircfilter.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 -u + +# TODO: should remove non-printable chars + +import sys + +sys.stdin = sys.stdin.detach() +sys.stdout = sys.stdout.detach() + +try: + while True: + l = sys.stdin.readline() + if not l: + break + try: + line = l.decode('utf8') + except UnicodeDecodeError: + line = l.decode('latin1') + sys.stdout.write(line.encode('utf8')) +except IOError: + pass