Skip to content

Commit

Permalink
Ripgrep is awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
spagnoloG committed Mar 12, 2024
1 parent 0a35394 commit a956fb0
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 82 deletions.
146 changes: 73 additions & 73 deletions notes/index.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
- [address-space.md](address-space.md)
- [ansible.md](ansible.md)
- [autorandr.md](autorandr.md)
- [bash.md](bash.md)
- [binary-patching.md](binary-patching.md)
- [binary-vs-text-files.md](binary-vs-text-files.md)
- [burpsuite.md](burpsuite.md)
- [certs.md](certs.md)
- [clipboard.md](clipboard.md)
- [compression.md](compression.md)
- [curl.md](curl.md)
- [databases.md](databases.md)
- [dig.md](dig.md)
- [disk-usage.md](disk-usage.md)
- [disk-utils.md](disk-utils.md)
- [docker.md](docker.md)
- [emacs.md](emacs.md)
- [exec.md](exec.md)
- [ffmpeg.md](ffmpeg.md)
- [find.md](find.md)
- [forensics.md](forensics.md)
- [fork.md](fork.md)
- [fzf.md](fzf.md)
- [gcc.md](gcc.md)
- [gdb.md](gdb.md)
- [git.md](git.md)
- [gpg.md](gpg.md)
- [hardware.md](hardware.md)
- [hydra.md](hydra.md)
- [licesing.md](licesing.md)
- [locate.md](locate.md)
- [lxc.md](lxc.md)
- [mitmproxy.md](mitmproxy.md)
- [mosquitto.md](mosquitto.md)
- [mount.md](mount.md)
- [mpi.md](mpi.md)
- [multiprocessing.md](multiprocessing.md)
- [named-pipes.md](named-pipes.md)
- [networking.md](networking.md)
- [nextcloud.md](nextcloud.md)
- [nixos.md](nixos.md)
- [nmap.md](nmap.md)
- [os-flashing.md](os-flashing.md)
- [pdf.md](pdf.md)
- [permissions.md](permissions.md)
- [pipewire.md](pipewire.md)
- [powerusage.md](powerusage.md)
- [proces-sorting-algorithms.md](proces-sorting-algorithms.md)
- [proxmox.md](proxmox.md)
- [pwn.md](pwn.md)
- [python-specifics.md](python-specifics.md)
- [qemu.md](qemu.md)
- [regex.md](regex.md)
- [ros.md](ros.md)
- [rstudio.md](rstudio.md)
- [rust.md](rust.md)
- [services-and-process-management.md](services-and-process-management.md)
- [squid.md](squid.md)
- [ssh.md](ssh.md)
- [symlinks.md](symlinks.md)
- [system-information.md](system-information.md)
- [tmux.md](tmux.md)
- [tracks.md](tracks.md)
- [uart.md](uart.md)
- [ufw.md](ufw.md)
- [vfs.md](vfs.md)
- [vim.md](vim.md)
- [vim-tutor.md](vim-tutor.md)
- [wasm.md](wasm.md)
- [wfdb.md](wfdb.md)
- [wireguard.md](wireguard.md)
- [wl-mirror.md](wl-mirror.md)
- [yaml.md](yaml.md)
- [address-space.md](address-space.md)
- [ansible.md](ansible.md)
- [autorandr.md](autorandr.md)
- [bash.md](bash.md)
- [binary-patching.md](binary-patching.md)
- [binary-vs-text-files.md](binary-vs-text-files.md)
- [burpsuite.md](burpsuite.md)
- [certs.md](certs.md)
- [clipboard.md](clipboard.md)
- [compression.md](compression.md)
- [curl.md](curl.md)
- [databases.md](databases.md)
- [dig.md](dig.md)
- [disk-usage.md](disk-usage.md)
- [disk-utils.md](disk-utils.md)
- [docker.md](docker.md)
- [emacs.md](emacs.md)
- [exec.md](exec.md)
- [ffmpeg.md](ffmpeg.md)
- [find.md](find.md)
- [forensics.md](forensics.md)
- [fork.md](fork.md)
- [fzf.md](fzf.md)
- [gcc.md](gcc.md)
- [gdb.md](gdb.md)
- [git.md](git.md)
- [gpg.md](gpg.md)
- [hardware.md](hardware.md)
- [hydra.md](hydra.md)
- [licesing.md](licesing.md)
- [locate.md](locate.md)
- [lxc.md](lxc.md)
- [mitmproxy.md](mitmproxy.md)
- [mosquitto.md](mosquitto.md)
- [mount.md](mount.md)
- [mpi.md](mpi.md)
- [multiprocessing.md](multiprocessing.md)
- [named-pipes.md](named-pipes.md)
- [networking.md](networking.md)
- [nextcloud.md](nextcloud.md)
- [nixos.md](nixos.md)
- [nmap.md](nmap.md)
- [os-flashing.md](os-flashing.md)
- [pdf.md](pdf.md)
- [permissions.md](permissions.md)
- [pipewire.md](pipewire.md)
- [powerusage.md](powerusage.md)
- [proces-sorting-algorithms.md](proces-sorting-algorithms.md)
- [proxmox.md](proxmox.md)
- [pwn.md](pwn.md)
- [python-specifics.md](python-specifics.md)
- [qemu.md](qemu.md)
- [regex.md](regex.md)
- [ros.md](ros.md)
- [rstudio.md](rstudio.md)
- [rust.md](rust.md)
- [services-and-process-management.md](services-and-process-management.md)
- [squid.md](squid.md)
- [ssh.md](ssh.md)
- [symlinks.md](symlinks.md)
- [system-information.md](system-information.md)
- [tmux.md](tmux.md)
- [tracks.md](tracks.md)
- [uart.md](uart.md)
- [ufw.md](ufw.md)
- [vfs.md](vfs.md)
- [vim.md](vim.md)
- [vim-tutor.md](vim-tutor.md)
- [wasm.md](wasm.md)
- [wfdb.md](wfdb.md)
- [wireguard.md](wireguard.md)
- [wl-mirror.md](wl-mirror.md)
- [yaml.md](yaml.md)
20 changes: 20 additions & 0 deletions notes/math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Math

Here will be collected nice math books, articles, and other resources.
Mostly for computer and data science.

## Books

### Linear algebra / Computer vision

- [The Matrix Cookbook](https://www2.imm.dtu.dk/pubdb/edoc/imm3274.pdf)
- [Bayesian Reasoning and Machine Learning](http://web4.cs.ucl.ac.uk/staff/D.Barber/textbook/091213.pdf)
- [Computer Vision: Models, Learning, and Inference](http://www.computervisionmodels.com/)

### Statistics

- [Principles Of Uncertainty](https://github.com/fri-datascience/course_pou)

### Calculus

- tba
18 changes: 9 additions & 9 deletions notes/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

- install
`qemu-system-aarch64 \
-cpu cortex-a72 -smp 4 -M virt -m 4096 -nographic \
-drive if=pflash,format=raw,file=QEMU_EFI.img \
-drive if=pflash,file=varstore.img \
-drive if=virtio,file=arm.img\
-drive if=virtio, format=raw, file=file.iso`
-cpu cortex-a72 -smp 4 -M virt -m 4096 -nographic \
-drive if=pflash,format=raw,file=QEMU_EFI.img \
-drive if=pflash,file=varstore.img \
-drive if=virtio,file=arm.img\
-drive if=virtio, format=raw, file=file.iso`
- run
`qemu-system-aarch64 \
-cpu cortex-a72 -smp 4 -M virt -m 4096 -nographic \
-drive if=pflash,format=raw,file=QEMU_EFI.img \
-drive if=pflash,file=varstore.img \
-drive if=virtio,file=arm.img\`
-cpu cortex-a72 -smp 4 -M virt -m 4096 -nographic \
-drive if=pflash,format=raw,file=QEMU_EFI.img \
-drive if=pflash,file=varstore.img \
-drive if=virtio,file=arm.img\`

### VIRT MANAGER

Expand Down
57 changes: 57 additions & 0 deletions notes/rg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Ripgrep

## Basic Usage

- `rg <pattern>` - Search for a pattern in the current directory and all subdirectories.
- `rg -i <pattern>` - Case insensitive search.
- `rg -w <pattern>` - Search for whole words.

## File Inclusion/Exclusion

- `rg <pattern> -g '*.rs'` - Search only in Rust files.
- `rg <pattern> -g '!*.log'` - Exclude log files from the search.
- `rg --type-add 'web:*.{html,css,js}' -tweb <pattern>` - Search in files with custom type (html, css, js).

## Output Control

- `rg -C 3 <pattern>` - Show 3 lines of context around matches.
- `rg -A 3 <pattern>` - Show 3 lines after the match.
- `rg -B 3 <pattern>` - Show 3 lines before the match.
- `rg --color always <pattern>` - Force color output.

## Advanced Searching

- `rg '(foo|bar)'` - Search for foo or bar using regex.
- `rg -z <pattern>` - Search in compressed (gzip) files.
- `rg --multiline 'foo\nbar'` - Multiline search.
- `rg -uu <pattern>` - Search hidden files and directories, and traverse symlinked directories.

## Performance

- `rg -j4 <pattern>` - Use 4 threads for searching.

## File Types

- `rg --type-list` - List all supported file types.
- `rg -tpy <pattern>` - Search only in Python files.

## Ignoring Files

- `rg --ignore-file .gitignore <pattern>` - Respect ignore patterns listed in a .gitignore file.
- `rg --no-ignore <pattern>` - Ignore .ignore and .gitignore files

## Ignoring Specific Directories

To exclude specific directories from your search, use the `--glob` option with a negation (`!`) pattern. This tells `rg` to ignore files or directories that match the given pattern.

- `rg <pattern> -g '!dir_to_ignore/*'` - Ignore a specific directory.
- `rg <pattern> -g '!dir_to_ignore/**'` - Ignore a specific directory and all its subdirectories.
- `rg <pattern> -g '!{dir1,dir2}/*'` - Ignore multiple specific directories.
- `rg <pattern> -g '!*.ext'` - Ignore files with a specific extension.

### Some in practice examples

```bash
rg -i authorized_keys -g '!/proc/*' -g '!/sys/*' -g '!/dev/*' -g '!/nix/store/*' -j$(nproc) # quickly find all files containg authorized_keys
rg --files -g authorized_keys -g '!/proc/*' -g '!/sys/*' -g '!/dev/*' -g '!/nix/store/*' -j$(nproc) # list all files names containg authorized_keys
```
50 changes: 50 additions & 0 deletions notes/vimium.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Vimium

- [project site](https://vimium.github.io/)

| Action | Keyboard Shortcut |
| ------------------------------------------------ | ----------------- |
| **Navigating the page** | |
| Scroll down | `j` |
| Scroll up | `k` |
| Scroll to the top | `gg` |
| Scroll to the bottom | `G` |
| Scroll a half page down | `d` |
| Scroll a half page up | `u` |
| Scroll left | `h` |
| Scroll right | `l` |
| Reload the page | `r` |
| Copy the current URL to the clipboard | `yy` |
| Open the clipboard's URL in the current tab | `p` |
| Open the clipboard's URL in a new tab | `P` |
| Enter insert mode | `i` |
| Enter visual mode | `v` |
| Focus the first text input on the page | `gi` |
| Open a link in the current tab | `f` |
| Open a link in a new tab | `F` |
| Select the next frame on the page | `gf` |
| Select the page's main/top frame | `gF` |
| **Using find** | |
| Enter find mode | `/` |
| Cycle forward to the next find match | `n` |
| Cycle backward to the previous find match | `N` |
| **Using the vomnibar** | |
| Open URL, bookmark or history entry | `o` |
| Open URL, bookmark or history entry in a new tab | `O` |
| Open a bookmark | `b` |
| Open a bookmark in a new tab | `B` |
| Search through your open tabs | `T` |
| **Navigating history** | |
| Go back in history | `H` |
| Go forward in history | `L` |
| **Manipulating tabs** | |
| Create new tab | `t` |
| Go one tab left | `J` |
| Go one tab right | `K` |
| Go to the first tab | `g0` |
| Go to the last tab | `g$` |
| Duplicate current tab | `yt` |
| Close current tab | `x` |
| Restore closed tab | `X` |
| **Miscellaneous** | |
| Show help | `?` |

0 comments on commit a956fb0

Please sign in to comment.