Code Monkey home page Code Monkey logo

history-sync's Introduction

history-sync

An Oh My Zsh plugin for GPG encrypted, Internet synchronized Zsh history using Git.

Installation

sudo apt install gpg git
git clone [email protected]:wulfgarpro/history-sync.git
cp -r history-sync ~/.oh-my-zsh/plugins

Then open .zshrc file and append history-sync to the plugin line:

plugins=(... history-sync)

And finally, reload zsh:

zsh

Usage

Before history-sync can be useful, you need two things:

  1. A hosted git repository, e.g. GitHub, Bitbucket
    • Ideally with ssh key access
  2. A configured gpg key pair for encrypting and decrypting your history file and the enrolled public keys of all the nodes in your web of trust

Once you have these things in place, it's just a matter of updating the needed environment variables to suit your configuration:

  • ZSH_HISTORY_FILE: your zsh_history file location
  • ZSH_HISTORY_PROJ: your git project for housing your zsh_history file
  • ZSH_HISTORY_FILE_ENC: your encrypted zsh_history file location
  • GIT_COMMIT_MSG: your default message when pushing to $ZSH_HISTORY_PROJ

Which have the following defaults:

ZSH_HISTORY_FILE_NAME=".zsh_history"
ZSH_HISTORY_FILE="${HOME}/${ZSH_HISTORY_FILE_NAME}"
ZSH_HISTORY_PROJ="${HOME}/.zsh_history_proj"
ZSH_HISTORY_FILE_ENC_NAME="zsh_history"
ZSH_HISTORY_FILE_ENC="${ZSH_HISTORY_PROJ}/${ZSH_HISTORY_FILE_ENC_NAME}"
GIT_COMMIT_MSG="latest $(date)"

and running the commands:

# pull history
zhpl

# push history
zhps -r "John Brown" -r 876T3F78 -r ...

# pull and push history
zhsync

Demo

Check out the screen cast.

Licence

MIT @ James Fraser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.