Giter Club home page Giter Club logo

bin's Introduction

What is this repo?

This is a repo with all my personal scripts that I use. Suggestions for improving the scripts are welcome. As it's for my personal scripts, I make no attempt to package the scripts that I use. However, I do try to keep my scripts platform independent, so it should be relatively easy to adapt any of these scripts for your own use.

About the contents

This file has helper functions for auto_gen_bookmarks.py. Each of the three functions has docstrings, and you can see those for information on the functions.

This script reads the bookmarks stored by the Brave browser, and then generates an Emacs org-mode or markdown file containing the bookmarks. The below shows usage informaiton:

usage: auto_gen_bookmarks.py [-h] [-p PROFILE_NUM] [-o OUTFILE_NAME] [-m] [-P]
                             [-t PANDOC_OUT_FORMAT] [-k]

Program to read the JSON that the Brave browser stores its bookmarks info in
and create an org mode (or markdown) file containing said bookmarks from it.

optional arguments:
  -h, --help            show this help message and exit
  -p PROFILE_NUM, --profile_num PROFILE_NUM
                        The profile to take the bookmarks from. If zero is
                        entered, the program reads from the profile named
                        'Default'. This argument defaults to 0
  -o OUTFILE_NAME, --outfile_name OUTFILE_NAME
                        The name of the file produced by the script and
                        written to the disk.
  -m, --as_markdown     Make the file produced be in markdown format instead
                        of the default org-mode.
  -P, --post_process    Convert the file to some format after the markdown or
                        org mode document is produced. This uses the program
                        pandoc, and this functionality requires it as a
                        dependency.
  -t PANDOC_OUT_FORMAT, --pandoc_out_format PANDOC_OUT_FORMAT
                        Format to pass to pandoc as the type of the output
                        format. Suggestions are pdf, docx, html, and others
                        that play nicely with naming. Use in conjunction with
                        -P. This argument will default to html.
  -k, --keep_pp_file    This flag will cause the intermediate markdown or org
                        mode file produced to be kept. Use in conjunction with
                        -P.

This is a script to get a screenshot of one's schedule using George's Schedule Machine and data from one's SIS. It gets login info from Bitwarden CLI, and then logs in to the user's SIS with their credentials. Note: to individualize this for your use, be sure to change the mechanism for getting the login info, even if you do use bw, as the way I have it configured, it queries using the object ID, which is not portable. Then, once obtaining the credentials, it goes to George's Schedule Machine and inputs the schedule data, saving screenshots of the table elements for the first and second semester.

This script is to automate the reporting of volunteer hours with HelperHelper. It requires a TOML input file, which it then uses to enter the form information into HelperHelper.

usage: make_volunteer_hrs_entry.py [-h] [-i INPUT_FILE] [-H]

Program to automate the reporting of volunteer hours for IMSA using Selenium
and TOML.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input_file INPUT_FILE
                        The TOML file to read as input containing the relevant
                        information to be inputed in their fields. See
                        ~/bin/mvhe/example.toml for an example.
  -H, --headful         Run the selenium webdriver in headful mode, opening
                        the browser so that the user can see what's happening.

Directories

This directory has a template and an example of the TOML used by the make_volunteerhrs_entry.py script. example.toml contains an example, while template.toml contains basically the same file with the fields replace by easily searchable placeholders. Each field name corresponds with the corresponding field name in the HelperHelper volunteer form.

The files in this directory are templates for the scripts I make. The names are self-explanatory.

bin's People

Contributors

vim-is-life avatar

Watchers

 avatar

bin's Issues

Issue with George Moe-ifed schedule

Contact Details

No response

Language

Python (.py)

Script or program

get_sched_ss.py

Platform

Windows

What did you expect to happen?

Expected the output from the script to show a properly George Moe-ifed schedule table.

What happened?

The output of the script for the second semester had fields that showed up as undefined.

Possible solution

Check the script to see if it refreshes after entering in the first bit of information for the first semester. Maybe the problem is that it's not clearing the input box before entering in second semester's info.

Relevant log output

No response

Relevant text of error message

No response

[Feature request]: Add a commandline option to control where the image outputs

Contact Details

No response

Script or program

get_sched_ss.py

Is it problem related?

There is no control over where the screenshot of the schedule gets made except to hardcode it into the script.

Feature or solution

We could add in some argparse stuff to be able to specify where the images get saved. We could probably add some flag -d to specify a directory, and two flags -o1 and -o2 to control where the individual files get saved.

We can handle the save paths with pathlib to be safe.

Alternatives

We could also rudimentarily have the user specify the save directory and individual filenames interactively with a call to the input function. However, I think this is a bit less elegant than argparse and it would be better to add this functionality as commandline options.

Anything else?

No response

[Feature request]: Refactor code to be more modular

Contact Details

No response

Script or program

get_sched_ss.py

Is it problem related?

It's not too big of a problem, but the code would be more clean if the nested functions in main were refactored to be defined at the top level. It may also be more portable this way as well.

Feature or solution

  • You can refactor the code by parameterizing the functions' interactions with the driver object, instead of relying on them inheriting it from the parent namespace main.
  • Since the driver object is stateful and you're modifying it to get things done, you'll also want to have the functions return the driver object.
  • Therefore, in each instance of those functions being called, you would call the functions the same way as before, but you would say driver = functioncall(args) as opposed to functioncall(args)

Alternatives

None

Anything else?

No response

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.