Skip to content

Commit

Permalink
chore(md): Formatting conforms to NeoVim
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelLarkin committed Jul 16, 2024
1 parent 746299f commit d872774
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 83 deletions.
14 changes: 6 additions & 8 deletions docs/color.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Colors

## Bash Colors

[Script to display all terminal colors](https://askubuntu.com/a/1044802)

```sh
msgcat --color=test
```



## Putty Colors

We need to use `putty-256color` instead of `xterm-256color` or else the `Home` key is not working.

[Putty shows prompt with no color, but Linux SSH can](https://superuser.com/a/1502895)
In Putty, change Settings -> Connection > Data > Terminal-type string to: `putty-256color`.
["Emulate" 256 colors in PuTTY terminal](https://superuser.com/a/436928)

1. Configure Putty

In Settings > Windows > Colours there is a check box for "Allow terminal to use xterm 256-colour mode".
Expand All @@ -26,12 +28,11 @@ if your server has a terminfo entry for `putty-256color`, typically in `/usr/sha
The main thing here is to make the server use an available `Terminfo` entry that most closely matches the way `Putty` is configured.

### 24bit
* [Getting 24-bit color working in terminals](https://pisquare.osisoft.com/s/Blog-Detail/a8r1I000000GvXBQA0/console-things-getting-24bit-color-working-in-terminals)



* [Getting 24-bit color working in terminals](https://pisquare.osisoft.com/s/Blog-Detail/a8r1I000000GvXBQA0/console-things-getting-24bit-color-working-in-terminals)

## LSCOLORS Schemes

```sh
for theme in $(vivid themes); do
echo "Theme: $theme";
Expand All @@ -42,6 +43,3 @@ done
vivid generate one-light
LSCOLORS=$(vivid generate one-light)
```



1 change: 0 additions & 1 deletion docs/config_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* [Difference Between `.bashrc`, `.bash-profile`, and `.profile`](https://www.baeldung.com/linux/bashrc-vs-bash-profile-vs-profile)
* [What are the functional differences between .profile .bash_profile and .bashrc](https://serverfault.com/questions/261802/what-are-the-functional-differences-between-profile-bash-profile-and-bashrc)


`.bash_profile` and `.bashrc` are specific to `bash`, whereas `.profile` is read by many shells in the absence of their own shell-specific config files.
(`.profile` was used by the original Bourne shell.) `.bash_profile` or `.profile` is read by login shells, along with `.bashrc`; subshells read only `.bashrc`.
(Between job control and modern windowing systems, `.bashrc` by itself doesn't get used much. If you use `screen` or `tmux`, screens/windows usually run subshells instead of login shells.)
Expand Down
36 changes: 15 additions & 21 deletions docs/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ paste <(zcat OPUS-multiun-v1-eng-spa.spa.gz) <(zcat OPUS-multiun-v1-eng-spa.eng.
'BEGIN {OFS = FS} (split($1, a, " +")<5 && split($2, b, " +")< 5) {print $1, $2}'
```


## Sort

Sort according to a set of columns:

```sh
zcat FILE.gz | awk -F'\t' '!_[$4,$5]++'
```


## Where is the process running

If there is a running process like `vim` that you would like to properly stop, you need to find in which `tmux` window it is running.
Expand All @@ -27,6 +27,7 @@ To help figure this out, given the PID, you can ask `lsof` for its `CWD`.
```sh
lsof -a -d cwd -p PID
```

```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
vim 7688 larkins cwd DIR 0,47 4096 154447160 /gpfs/projects/DT/mtp/models/HoC-Senate/corpora/spm/v2
Expand All @@ -48,6 +49,7 @@ awk \
uniq.TRAIN_2021-2016_${BIFILTER}.tsv \
> TRAIN_indev.tsv
```

```sh
# Filter-out
awk \
Expand All @@ -58,14 +60,12 @@ awk \
> TRAIN_notindev.tsv
```


### Filter-out Testset From Train

```sh
grep --text --line-regexp --invert-match --fixed-strings --file=$testset_filename
```


## Seeded `shuf`

```sh
Expand All @@ -77,14 +77,14 @@ function get_seeded_random {
shuf -i1-100 --random-source=<(get_seeded_random 42)
```


## Broken Symlinks

```sh
find . -type l ! -exec test -e {} \; -print
```


## Refresh Bash's Cache

[How do I clear Bash's cache of paths to executables?](https://unix.stackexchange.com/a/5610)
`bash` does cache the full path to a command.
You can verify that the command you are trying to execute is hashed with the type command:
Expand All @@ -104,28 +104,25 @@ Or just one entry:

For additional information, consult help hash and man bash.



## BASH debugging

* [Bash debugging - Youtube](https://www.youtube.com/watch?v=9pbpevjuwmI)
* `PS4` `export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]}() - [${SHLVL},${BASH_SUBSHELL},$?] '`
* `bash -x`
* `bashdb`
* `shellcheck`



## `lvim`

Find commands `:WhichKey`.
This opens a popup and if you type the shortcut key you get submenus.

`<leader>sT` where `<leader>` is `space` opens a popup to do fuzzy finding across files.

`<leader>f` find a file.



## GNU parallel a la Spark

```sh
function desubtokenize {}
export -f desubtokenize
Expand All @@ -143,22 +140,22 @@ zcat --force train.gz \
> train.tok.gz
```


## Weather

[wttr.in - GitHub](https://github.com/chubin/wttr.in): The right way to check the weather
Get the weather:

* `curl wttr.in/CityName`
* `curl v2d.wttr.in/CityName`


## Login Name

Find the full name of a user from its username.

```sh
lslogins | fzf
```



## Python

How to profile python's import statements.
Expand All @@ -174,7 +171,6 @@ or:
PYTHONPROFILEIMPORTTIME=1 myscript.python
```


## Disk Usage

### Tools
Expand All @@ -189,12 +185,12 @@ PYTHONPROFILEIMPORTTIME=1 myscript.python
* [pdu: Highly parallelized, blazing fast directory tree analyzer](https://github.com/KSXGitHub/parallel-disk-usage)
* [tin-summer: Find build artifacts that are taking up disk space](https://github.com/vmchale/tin-summer)


### View disk usage by filetype.
### View disk usage by filetype

```sh
dust -t
```

```
3.0K ┌── (others) │ █ │ 0%
2.0K ├── .BLEU │ █ │ 0%
Expand All @@ -219,7 +215,6 @@ dust -t
3.9G ┌─┴ (total) │██████████████████████████████████████████████ │ 100%
```


## Activate

This is an example of an `activate` script when you compile a tool by hand and you don't install it a common place.
Expand Down Expand Up @@ -249,7 +244,6 @@ export CPLUS_INCLUDE_PATH=$SENTENCEPIECE_HOME/include${CPLUS_INCLUDE_PATH:+:$CPL
export PKG_CONFIG_PATH=$SENTENCEPIECE_HOME/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
```


## Grep for Emojis

[POSIX and Unicode character categories](https://github.com/Genivia/ugrep?tab=readme-ov-file#posix-and-unicode-character-categories)
Expand Down
26 changes: 12 additions & 14 deletions docs/fzf.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,32 @@
[tmux-fzf](https://github.com/sainnhe/tmux-fzf): Use fzf to manage your tmux work environment!

* List of bindings
* <kbd>prefix</kbd> <kbd>F</kbd> To launch tmux-fzf, press `prefix` + `F` (Shift+F).

* <kbd>prefix</kbd> <kbd>F</kbd> To launch tmux-fzf, press `prefix` + `F` (Shift+F).

## `fzf-git.sh`

[fzf-git.sh](https://github.com/junegunn/fzf-git.sh): bash and zsh key bindings for Git objects, powered by fzf.

* List of bindings
* <kbd>CTRL-G</kbd> <kbd>CTRL-F</kbd> for **F**iles
* <kbd>CTRL-G</kbd> <kbd>CTRL-B</kbd> for **B**ranches
* <kbd>CTRL-G</kbd> <kbd>CTRL-T</kbd> for **T**ags
* <kbd>CTRL-G</kbd> <kbd>CTRL-R</kbd> for **R**emotes
* <kbd>CTRL-G</kbd> <kbd>CTRL-H</kbd> for commit **H**ashes
* <kbd>CTRL-G</kbd> <kbd>CTRL-S</kbd> for **S**tashes
* <kbd>CTRL-G</kbd> <kbd>CTRL-E</kbd> for **E**ach ref (`git for-each-ref`)
* <kbd>CTRL-G</kbd> <kbd>CTRL-F</kbd> for **F**iles
* <kbd>CTRL-G</kbd> <kbd>CTRL-B</kbd> for **B**ranches
* <kbd>CTRL-G</kbd> <kbd>CTRL-T</kbd> for **T**ags
* <kbd>CTRL-G</kbd> <kbd>CTRL-R</kbd> for **R**emotes
* <kbd>CTRL-G</kbd> <kbd>CTRL-H</kbd> for commit **H**ashes
* <kbd>CTRL-G</kbd> <kbd>CTRL-S</kbd> for **S**tashes
* <kbd>CTRL-G</kbd> <kbd>CTRL-E</kbd> for **E**ach ref (`git for-each-ref`)
> :warning: You may have issues with these bindings in the following cases:
>
> * <kbd>CTRL-G</kbd> <kbd>CTRL-B</kbd> will not work if
> <kbd>CTRL-B</kbd> is used as the tmux prefix
> * <kbd>CTRL-G</kbd> <kbd>CTRL-S</kbd> will not work if flow control is enabled,
> <kbd>CTRL-S</kbd> will freeze the terminal instead
> * (`stty -ixon` will disable it)
> * (`stty -ixon` will disable it)
>
> To workaround the problems, you can use
> <kbd>CTRL-G</kbd> <kbd>*{key}*</kbd> instead of
> <kbd>CTRL-G</kbd> <kbd>CTRL-*{KEY}*</kbd>.
* Inside fzf
* <kbd>TAB</kbd> or <kbd>SHIFT-TAB</kbd> to select multiple objects
* <kbd>CTRL-/</kbd> to change preview window layout
* <kbd>CTRL-O</kbd> to open the object in the web browser (in GitHub URL scheme)

* <kbd>TAB</kbd> or <kbd>SHIFT-TAB</kbd> to select multiple objects
* <kbd>CTRL-/</kbd> to change preview window layout
* <kbd>CTRL-O</kbd> to open the object in the web browser (in GitHub URL scheme)
2 changes: 2 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Install

# Unsloth.ai

On GPSC7

* Set proxies(http and https) and correct `tmp` directories in `.profile`
Expand Down
8 changes: 7 additions & 1 deletion docs/miller.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* [GitHub](https://github.com/johnkerl/miller): Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON.

## Tabulate BLEU Scores

* Reading a csv dataframe
* Write a nice table using bars
* Print numbers with 2 decimal
Expand Down Expand Up @@ -32,6 +33,7 @@
```sh
bzcat sentence_word_count_fr.tsv.bz2 | head -n 3
```

```
id datetime wc sentence
House/House/391/Debates/001/HAN001 2006-04-03 11:05:00.000000 49 The 38th Parliament ...
Expand Down Expand Up @@ -61,6 +63,7 @@ bzcat sentence_word_count_fr.tsv.bz2 \
then \
reorder -f id,start,end,elapse
```

```
+------------------------------------+---------------------+---------------------+--------------------+
| id | start | end | elapse |
Expand All @@ -85,11 +88,13 @@ jq --raw-output --compact-output \
then rename en_sum,#en_word,fr_sum,#fr_word,fr_count,#sentence \
| mlr --opprint --barred summary -a count,null_count,distinct_count,mean,min,median,max,stddev
```

```
{"date":"2022-10-24","fr":18,"en":15}
{"date":"2022-10-24","fr":18,"en":18}
{"date":"2022-10-24","fr":29,"en":28}
```

```
date=2022-10-24,#en_word=55951,#fr_word=59892,#sentence=2692
date=2022-10-25,#en_word=73587,#fr_word=79288,#sentence=3660
Expand All @@ -103,7 +108,6 @@ date=2022-10-26,#en_word=29726,#fr_word=32800,#sentence=1492
| #fr_word | 112 | 0 | 112 | 71302.02678571429 | 27863.87682146542 | 3150 | 76163 | 133257 |
| #sentence | 112 | 0 | 112 | 3282.6160714285716 | 1318.6068832416186 | 128 | 3502 | 6373 |


## Group per Object

```sh
Expand All @@ -115,11 +119,13 @@ jq --raw-output --compact-output \
then rename en_sum,#en_word,fr_sum,#fr_word,fr_count,#sentence \
| mlr --opprint --barred summary -a count,null_count,distinct_count,mean,min,median,max,stddev
```

```
{"sitting":{"parliament":44,"session":1,"number":116},"fr":18,"en":15}
{"sitting":{"parliament":44,"session":1,"number":116},"fr":18,"en":18}
{"sitting":{"parliament":44,"session":1,"number":116},"fr":29,"en":28}
```

```
sitting.parliament=44,sitting.session=1,sitting.number=116,#en_word=55951,#fr_word=59892,#sentence=2692
sitting.parliament=44,sitting.session=1,sitting.number=117,#en_word=73587,#fr_word=79288,#sentence=3660
Expand Down
Loading

0 comments on commit d872774

Please sign in to comment.