~ben/bin

408611b21c4a085477acdc41fdc75e94e86a9504 — Ben Sima 11 months ago a11c3f2
wip scripts
4 files changed, 106 insertions(+), 0 deletions(-)

A benhours
A desk
A domaincheck
A house.py
A benhours => benhours +41 -0
@@ 0,0 1,41 @@
#!/bin/bash -e

org2tc "$@"
    | ledger -f - --day-break print > /tmp/work.dat

echo
echo Daily totals
echo ================================================================================

ledger -f /tmp/work.dat                          \
    --columns=80 --day-break --daily            \
    --base --total='(1.00 hrs*amount)/3600'     \
    --sort date --collapse reg

echo
echo Daily breakdown
echo ================================================================================

ledger -f /tmp/work.dat                          \
    --columns=80 --day-break --daily            \
    --base --total='(1.00 hrs*amount)/3600'     \
    --sort date reg

echo
echo Weekly totals
echo ================================================================================

ledger -f /tmp/work.dat --weekly                 \
    --columns=80 --day-break                    \
    --base --total='(1.00 hrs*total)/3600'      \
    --sort date bal

echo

echo Allocations
echo ================================================================================

ledger -f /tmp/work.dat bal --base --percent --depth=1
echo

ledger -f /tmp/work.dat bal --base --percent --depth=2 55AJK

A desk => desk +51 -0
@@ 0,0 1,51 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python -p python3

"""
Create a ~/.deskrc file like so:

    [desk]
    location = ~/desk

    [work.git]
    remote = git@github.com/user/repo.git
    local = repo

    [work.git]
    remote = git@github.com/user/other.git
    local = other-repo

    [work.command]
    name = clock in
    exec = echo i $(date) > ~/.timelog

    [work.env]
    PATH = /whatever
    EDITOR = vim

    [work.command]
    name = block some websites
    exec = echo 'twitter.com 127.0.0.1' > /etc/hosts
    sudo = true

    [home.command]
    name = start media server
    exec = plex start # or whatever


The command 'desk work' will provision the 'work' environment for you, as well
as track your current state. Think of this like 'clocking in' to work. You could
also do 'desk home' and it would provision the 'home' environment. These are
meant to be *soft environments*.

The command 'desk clear' will attempt to close out all your existing work. It
will:

- Do a 'git status' on all 'work' projects to see if you have any unpushed changes
   - If so, fail and tell you where to save/push
   - If not, remove all the git repos
- Clock out of your work

This creates a clean separation of work, a nice way to close out whatever you're
working on for the day.
"""

A domaincheck => domaincheck +8 -0
@@ 0,0 1,8 @@
#! /usr/bin/env python3

import argparse
import urllib.request

for d in domains:
    deetz = pythonwhois.get_whois(d)
    print(deetz)

A house.py => house.py +6 -0
@@ 0,0 1,6 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python36.withPackages(ps: [ps.python3-phue-1.1])"

from phue import Bridge

print("ok")