As configured in my dotfiles.
start new:
tmux
start new with session name:
| # Checkout the latest tag | |
| ## the first line will get all the tags, filter tags that only begin with 'v' followed by a number, sort the tags in reverse order (from highest to lowest), then get the first (i.e. most current tag) | |
| ## it uses -V which is version sort to keep it monotonically increasing. | |
| current_tag=$(git tag | grep '^v[0-9]' | sort --reverse -V | sed -n 1p) | |
| echo "${current_tag}" | |
| git checkout "${current_tag}" |
| # logging helper module inspired by https://www.toptal.com/python/in-depth-python-logging | |
| # to use, add module to a commons directory or at top-level of project | |
| # then import the module and setup the logger. | |
| # For example: | |
| # my_logger = get_logger("my module name") | |
| # my_logger.debug("a debug message") | |
| from __future__ import annotations | |
| import os | |
| import sys |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| # Form | |
| # ls -d <directory>/* | xargs -I {} bash -c "<some command> '{}'" | |
| # example: Goes through each directory and runs git fetch on each one | |
| ls -d core/* | xargs -I {} bash -c "cd '{}' && printf 'Processing repo {} \n' && git fetch stash" |
| alias docknproxy="jq 'del(.proxies)' $HOME/.docker/config.json | sponge $HOME/.docker/config.json" | |
| alias dockproxy="jq --argfile proxy $HOME/.docker/proxies.json '.proxies=\$proxy' $HOME/.docker/config.json | sponge $HOME/.docker/config.json" | |
| { | |
| "default": { | |
| "httpsProxy": "http://proxy01.pnl.gov:3128", | |
| "httpProxy": "http://proxy01.pnl.gov:3128", | |
| "noProxy": "pnl.gov,pnnl.gov,localhost,api,127.0.0.1,172.0.0.0/8,10.17.0.0/16,10.15.0.0/16,130.20.0.0/16" | |
| } | |
| } |
| import java.util.*; | |
| public class ReviewAnalysis { | |
| /** All user reviews to be included in this analysis */ private Review[] allReviews; | |
| /** Initializes allReviews to contain all the Review objects to be analyzed */ public ReviewAnalysis() | |
| { /* implementation not shown */ } | |
| /** Returns a double representing the average rating of all the Review objects to be | |
| * analyzed, as described in part (a) | |
| * Precondition: allReviews contains at least one Review. | |
| * No element of allReviews is null. |
| public class DNA { | |
| public static void main(String[] args) { | |
| // DNA strand | |
| // protein: | |
| // start codon: ATG | |
| // stop codon: TGA | |
| // sequence of three nucelotides | |
| // divisible by 3 |
| public class Palindrome { | |
| public static void isPalindrome(String str) { | |
| int left = 0; | |
| int right = str.length() - 1; | |
| String msgPartial = " is a palindrome"; | |
| while (left < right) { | |
| String leftLetter = str.substring(left, left+1); | |
| String rightLetter = str.substring(right, right + 1); | |
mkdir volttron_modular
cd volttron_modular