<commit_before><p align="center"><img height="180px" width="180px" src="https://github.com/fabric-8/borg/raw/master/assets/borg_mascot.png" alt=""></p>

BORG - Search and save shell snippets without leaving your terminal 
===
![cruft guaranteed](https://img.shields.io/badge/cruft-guaranteed-green.svg) [![Travis CI](https://api.travis-ci.org/ok-borg/borg.svg?branch=master)](https://travis-ci.org/ok-borg/borg) [![Go Report Card](https://goreportcard.com/badge/github.com/ok-borg/borg)](https://goreportcard.com/report/github.com/ok-borg/borg) [![Slack Status](http://ok-b.org:1492/badge.svg)](http://ok-b.org:1492)

Borg was built out of the frustration of having to leave the terminal to search and click around for bash snippets.
Borg's succint output also makes it easy to glance over multiple snippets quickly.

### Search

```
borg "find all txt"
```

```
(1) Find and delete .txt files in bash
        [a] find . -name "*.txt" | xargs rm
        [b] find . -name "*.txt" -exec rm {} \;
        [c] $ find  . -name "*.txt" -type f -delete

(2) bash loop through all find recursively in sub-directories
        [a] FILES=$(find public_html -type f -name '*.php')
        [b] FILES=`find public_html -type d`
```

Can't find what you are looking for? Be a good hacker and contribute your wisdom to the hive mind - [add your own snippets or tweak the existing ones.](https://github.com/ok-borg/borg/tree/master/docs)

### Install

The following releases only let you search, to use add/edit install from source, releases are coming soon.

```
brew install borg
```

For linux, download a release manually [releases](https://github.com/ok-borg/borg/releases)

```
wget https://github.com/ok-borg/borg/releases/download/v0.0.1/borg_linux_amd64 -O /usr/local/bin/borg
chmod 755 /usr/local/bin/borg
```

Or download a release manually for Mac:

```
wget https://github.com/ok-borg/borg/releases/download/v0.0.1/borg_darwin_amd64 -O /usr/local/bin/borg
chmod 755 /usr/local/bin/borg
```

### Rate results: `worked`

When you see a result that worked for you, you can use the `worked` command to give feedback:
<commit_msg>Readme edit - new example<commit_after><p align="center"><img height="180px" width="180px" src="https://github.com/fabric-8/borg/raw/master/assets/borg_mascot.png" alt=""></p>

BORG - Search and save shell snippets without leaving your terminal 
===
![cruft guaranteed](https://img.shields.io/badge/cruft-guaranteed-green.svg) [![Travis CI](https://api.travis-ci.org/ok-borg/borg.svg?branch=master)](https://travis-ci.org/ok-borg/borg) [![Go Report Card](https://goreportcard.com/badge/github.com/ok-borg/borg)](https://goreportcard.com/report/github.com/ok-borg/borg) [![Slack Status](http://ok-b.org:1492/badge.svg)](http://ok-b.org:1492)

Borg was built out of the frustration of having to leave the terminal to search and click around for bash snippets.
Borg's succint output also makes it easy to glance over multiple snippets quickly.

### Search

```
borg "list only files"
```

```
(1) Bash: How to list only files?
        [a] find . -maxdepth 1 -type f
        [b] ls -l | egrep -v '^d'
            ls -l | grep -v '^d'

(2) List only common parent directories for files
          [a] # read a line into the variable "prefix", split at slashes
              IFS=/ read -a prefix
              # while there are more lines, one after another read them into "next",
              # also split at slashes
              while IFS=/ read -a next; do
                  new_prefix=()
                  # for all indexes in prefix
                  for ((i=0; i < "${#prefix[@]}"; ++i)); do
                      # if the word in the new line matches the old one
                      if [[ "${prefix[i]}" == "${next[i]}" ]]; then
         ...
```

Can't find what you are looking for? Be a good hacker and contribute your wisdom to the hive mind - [add your own snippets or tweak the existing ones.](https://github.com/ok-borg/borg/tree/master/docs)

### Install

The following releases only let you search, to use add/edit install from source, releases are coming soon.

```
brew install borg
```

For linux, download a release manually [releases](https://github.com/ok-borg/borg/releases)

```
wget https://github.com/ok-borg/borg/releases/download/v0.0.1/borg_linux_amd64 -O /usr/local/bin/borg
chmod 755 /usr/local/bin/borg
```

Or download a release manually for Mac:

```
wget https://github.com/ok-borg/borg/releases/download/v0.0.1/borg_darwin_amd64 -O /usr/local/bin/borg
chmod 755 /usr/local/bin/borg
```

### Rate results: `worked`

When you see a result that worked for you, you can use the `worked` command to give feedback:

{'fraction_non_alphanumeric': 0.14736164736164736, 'fraction_numerical': 0.014586014586014585, 'mean_word_length': 3.258447488584475, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3536803', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1500, 'n_words': 471}