Git Product home page Git Product logo

kroncli's Introduction

kronCLI

family

PowerShell Badge Windows Badge Android Badge Visual Studio Code Badge

This repo contains a PowerShell script for the creation of a templated markdown-based journal entry for yesterday which imports and compresses images from a given folder.

I use it as a morning ritual writing a privately distributed family chronicle which is turning out to be a keystone habbit.

1. demo

1.1. Item Creation

1.2. WebUI (optional)

2. setup

2.1. prereqs

2.2. environmental variables

  • you need the following environmental variables
Name Example Value
kronScript c:\kronCLI\kron.ps1
kronMasterImageFolder c:\photos
kronFolder c:\journal

2.3. manual work

  • You have to hard code the pattern catching the actual images for a selected timespan:
# c:\photos\2021

$timeStampPattern = "yyyyMMdd"          # put the value into script when done
$yesterdayPattern = ((Get-Date) - (New-TimeSpan -Days 1)).ToString($timeStampPattern) # IGNORE
$pattern = "IMG_$yesterdayPattern.*"    # put the value into script then done
(dir) -match $pattern | Select Name     # run interactive pattern-check 

# OUTPUT OF MATCHES
# -----------------
# IMG_20210716_1404144kron.jpg
# IMG_20210716_1416013kron.jpg
# IMG_20210716_1700289.jpg
# IMG_20210716_1700311.jpg

2.4. profile

  • You can set up an alias in PowerShell profile to call a script from anywhere
    • I set an alias as k in the $profile and just hit k to run it from anywhere
$profile
Import-Module $env:kronScript
Set-Alias k new-kron

3. instructions

  • Connect the phone to the PC in the PTP transfer mode
  • Windows Photo starts automatically (if configured as such)
  • Import your photos to the kronMasterImageFolder
    • I am syncing this with Google Photos at this point
    • I am also deleting photos from my phone

  • Recommended: Navigate to the master folder and delete redundant photos
  • Run the script . kron.ps1 (or any alias) and write about your yesterday
  • The script then:
    1. Copies, renames, and compresses images from the $env:kronMasterImageFolder
    2. The script puts them in $env:kronFolder\assets
    3. It populates the newly created markdown file with the image links in markdown format
  • You can write about your day with photos already populated
  • To merge all posts into .pdf to print out as a hard-copy:
    1. Navigate to the folder of the previous month
    2. Run . kron.ps1 -merge

4. sharing

  • I am storing and sharing my journal as a family chronicle as a private GitHub repo
  • See GitHub for Storage + UI for setting that up

kroncli's People

Contributors

pkutaj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.