Acme.sh

January 5, 2022 - Reading time: ~1 minute

Just so I don't forget, here are some notes on using the acme.sh script for SSL/TLS certs.

Install

curl https://get.acme.sh | sh

Advanced Install

./acme.sh --install \
          --home ~/myacme \
          --config-home ~/myacme/data \
          --cert-home ~/mycerts \
          --accountemail "[email protected]" \
          --accountkey ~/myaccount.key \
          --accountconf ~/myaccount.conf \
          --useragent "this is my client."

Just set the ones you care about.

https://www.howtoforge.com/getting-started-with-acmesh-lets-encrypt-client/

Issue

.acme.sh/acme.sh --issue --standalone -d DOMAIN

Upgrade

acme.sh --upgrade [--auto-upgrade]

tmux vim select pane

January 4, 2022 - Reading time: 2 minutes

This is a tweak of https://github.com/mislav/dotfiles/blob/master/bin/tmux-vim-select-pane which is linked from https://github.com/christoomey/vim-tmux-navigator as a possible fix for the vim integration.

I couldn't get the original one to work right on tmux 1.8 so I fixed it up.

These go into tmux config file:

bind-key -n C-h run-shell "~/tmux-vim-select-pane -L"
bind-key -n C-j run-shell "~/tmux-vim-select-pane -D"
bind-key -n C-k run-shell "~/tmux-vim-select-pane -U"
bind-key -n C-l run-shell "~/tmux-vim-select-pane -R"
bind-key -n C-\ run-shell "~/tmux-vim-select-pane -l"
bind C-l send-keys 'C-l'

The new script is:

#!/bin/bash
# Like `tmux select-pane`, but sends a `<c-h j="" k="" l="">` keystroke if Vim is
# running in the current pane, or only one pane exists.
#set -e
cmd="$(tmux list-panes -F '#{pane_active} #{pane_tty}' | grep '^1')"
X=$(ps -o comm= -t $(echo $cmd | cut -f2 -d' ') | grep vim)
isvim=$?
pane_count="$(printf %d $(tmux list-panes | wc -l))"
if [[ ($isvim = 0) || ($pane_count = 1) ]]; then
#if [ $isvim -eq 0 ]; then
  direction="$(echo "${1#-}" | tr 'lLDUR' '\\hjkl')"
  # forward the keystroke to Vim
  tmux send-keys "C-$direction"
else
  tmux select-pane "$@"
fi


C Defines for Printing Colors

June 14, 2021 - Reading time: ~1 minute

A header file to define colors to use when printing to the console in C.

#ifndef __COLORS_H_
#define __COLORS_H_
#define _COLOR_CYAN            "\x1b[36m"
#define _COLOR_VIOLET          "\x1b[35m"
#define _COLOR_GREEN           "\x1b[32m"
#define _COLOR_BLUE            "\x1b[34m"
#define _COLOR_YELLOW          "\x1b[33m"
#define _COLOR_RED             "\x1b[31m"
#define _COLOR_LRED            "\x1b[1;31m"
#define _COLOR_YELLOWONRED     "\x1b[1;33;41m"
#define _COLOR_UYELLOWONRED    "\x1b[1;4;5;33;41m"
#define _COLOR_RESET           "\x1b[0m"
#define _COLOR_OUTPUT          _COLOR_CYAN
#define _COLOR_DEBUG           _COLOR_VIOLET
#define _COLOR_INFO            _COLOR_GREEN
#define _COLOR_NOTICE          _COLOR_BLUE
#define _COLOR_WARNING         _COLOR_YELLOW
#define _COLOR_ERROR           _COLOR_RED
#define _COLOR_CRITICAL        _COLOR_LRED
#define _COLOR_ALERT           _COLOR_YELLOWONRED
#define _COLOR_EMERGENCY       _COLOR_UYELLOWONRED
#endif

Add Some Color to Man Pages

June 14, 2021 - Reading time: ~1 minute

I was looking through my .bashrc and came across this. I've been using it so long that I had forgotten that colorized Man pages aren't usually the default. I can't remember where I found it.

Add some color to your man pages.

    man() {
    LESS_TERMCAP_md=$'\e[01;31m' \
    LESS_TERMCAP_me=$'\e[0m' \
    LESS_TERMCAP_us=$'\e[01;32m' \
    LESS_TERMCAP_ue=$'\e[0m' \
    LESS_TERMCAP_so=$'\e[45;93m' \
    LESS_TERMCAP_se=$'\e[0m' \
    command man "$@"
    }

SSL Test Script

April 30, 2021 - Reading time: 5 minutes

This is a very useful script by jaydansand that I found on gist.github. Keeping it handy here.

See the original gist

Read more

Sync a git Repo with Upstream

April 21, 2021 - Reading time: ~1 minute

Steps to add a remote repo to a local project and sync with it.

  • git remote add upstream # Add the upstream as a remote
  • git fetch upstream # Fetch the upstream
  • git checkout master # Checkout brach to sync with upstream
  • git merge upstream/master # Sync upstream's master branch locally

Categories