Skip to content

Instantly share code, notes, and snippets.

View akkerman's full-sized avatar

Marcel Akkerman akkerman

View GitHub Profile
# AKKERMAN ZSH Theme - initially based on AVIT
# vi: set ft=sh:
# settings
typeset +H _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} "
typeset +H _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}"
typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
PROMPT='
$(_user_host)${_current_dir} $(node_version) $(node_package) $(docker_context) $(git_prompt_info)
@akkerman
akkerman / docker wrapper.sh
Created June 12, 2021 07:10
Wraps the docker command to add some functionality
function docker() {
case "$1" in
ip)
command docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${@:2}"
;;
env)
command docker inspect --format '{{json .Config.Env}}' "${@:2}" | jq
;;
service)
if [ "$2" = env ]; then
set -g prefix C-a
unbind C-b
bind C-a send-prefix # press C-a twice to send it through
bind r source-file ~/.config/tmux/tmux.conf \; display "tmux.conf Reloaded"
set -g mouse
set -as terminal-overrides ',st*:Ss@' # fix for crashes (st, tmux, nvim)
setw -g mode-keys vi
@akkerman
akkerman / tpwd
Created November 13, 2021 18:20
start a tmux session in the current directory
#!/usr/bin/env bash
# start a tmux session in the current directory
dirname="$(basename $PWD)"
# tmux sessionname cannot contain a dot, replace with underscore
session="${dirname/./_}"
tmux_sessions=$(tmux ls -F '#{session_name}')
@akkerman
akkerman / jwt.js
Created March 11, 2022 07:19
Decode a Json Web Token and add dates that a human understands.
#!/usr/bin/env node
const jwt = require('jsonwebtoken')
const token = jwt.decode(process.argv[2])
const output = {
token,
issued: new Date(1000*token.iat).toLocaleString(),
expires: new Date(1000*token.exp).toLocaleString(),
}
@akkerman
akkerman / automatically git commit & branch.org
Created September 7, 2022 14:25
Scripts to to automatically commit changes and create branches in git branches triggered by cron.

Use these scripts in a cron job to automatically commit daily to a git repo and create a weekly Git branch.

Commit Daily

The following script will commit, pull and push changes when needed. It is used daily, or if wanted hourly.

filename: commit-daily.sh

#!/bin/sh
@akkerman
akkerman / docker-custom-commands.sh
Last active November 20, 2024 12:16
docker custom commands
# Description: Custom docker commands
# Usage: docker <command> <args>
#
# docker ip <container_name> - Get the IP address of a container
# docker env <container_name> - Get the environment variables of a container
# docker labels <container_name> - Get the labels of a container
# docker id <container_name> - Get the ID of a container
#
# docker name inspect <container_name> - Inspect a container by name
# docker name ip <container_name> - Get the IP address of a container by name