Miscellany - nstarman/utilipy GitHub Wiki

Miscellaneous

This page is where sections start or die. It is a mess and that's alright.

.Astronomy Hack-Day Graveyard .Astronomy Hacks Collector

Markdown

Underlining:

<div style="text-decoration: underline">underlined text</div>

Symbolic Links

ln -s /path/to/original /path/to/link

Open Jupyter Files On Click

see https://stackoverflow.com/a/30955613, https://stackoverflow.com/a/54489884 they use nbopen

  1. Open ‘automator’ - this is a tool that lets you define your own scripts and save them as applications
  2. Select ‘application’ from the list of document options it gives you
  3. Drag and drop ‘run shell script’ from the big list of actions on the left of the screen
  4. Change ‘Pass Inputs’ to ‘as arguments’ (my default was the ‘to stdin’ option)
  5. Copy the code below, save as an application, then right click on an ipython notebook to select ‘open with…’ and set your new application as the default to open that file type with
#!/bin/sh
variable="'$1'"
the_script='tell application "terminal" to do script "jupyter notebook'
osascript -e "${the_script} ${variable}\""

Better Way to Open Jupyter

Pipe to dev null

jupyter lab >& /dev/null

or do screen, then jupyter lab


Terminal Tricks

You can alt-click on terminal to go to a direct position in the line

Ctrl-a and ctrl-e to get to start and end of terminal line

Mac terminal: command+up - shows you the last prompts

Pushd, cd -

git fire - add all files with changes and push to a new branch to repo in one command

Autocorrect command line: set correct=cmd in .cshrc file or equivalent


Python

Python PEP

Black - deterministic python formatter

Dead Code

https://pypi.org/project/vulture/


Markdown to RST

pandoc --from=markdown --to=rst --output=README.rst README.md

⚠️ **GitHub.com Fallback** ⚠️