Skip to content

Instantly share code, notes, and snippets.

View bonicim's full-sized avatar
🌍
Every Day I'm Hustlin'

Mark Bonicillo bonicim

🌍
Every Day I'm Hustlin'
View GitHub Profile
@bonicim
bonicim / get-tag.txt
Created June 10, 2024 22:45
Get the most current tag using Git
# 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}"
@bonicim
bonicim / log.py
Last active January 4, 2024 22:59
Python logging utility module
# 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
@bonicim
bonicim / tmux_cheatsheet.markdown
Last active September 18, 2023 17:47 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@bonicim
bonicim / iterm2.md
Created September 18, 2023 17:19 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@bonicim
bonicim / process-dir.sh
Created June 14, 2023 20:19
Process directories using bash
# 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"
@bonicim
bonicim / dockproxy.sh
Created March 24, 2023 23:33
docker proxy scripts
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
@bonicim
bonicim / isPalindrome.java
Created December 20, 2022 17:56
Is Palindrome Java
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);
@bonicim
bonicim / modular_volttron_notes.md
Created July 13, 2022 22:14
Steps to install Platform Driver Agent and fake driver on Volttron modular - developers
  • Create a directory called volttron_modular
mkdir volttron_modular
cd volttron_modular
  • Since the modular Driver framework has yet to be published on PyPi, we need to clone them to our machine. Clone the following repos: