Skip to content

Instantly share code, notes, and snippets.

View richlamdev's full-sized avatar

Richard Lam richlamdev

View GitHub Profile
@richlamdev
richlamdev / virus-scan.sh
Created October 8, 2023 03:47 — forked from svantoviit/virus-scan.sh
Watch download directory and scan downloaded files with ClamAV
#!/bin/bash
#
# Watch download directory and scan downloaded files with ClamAV
#
# Check if works by downloading:
# https://secure.eicar.org/eicar_com.zip
#
# Original script by Fitzcarraldo
# https://fitzcarraldoblog.wordpress.com/2016/02/20/\
# automatically-detecting-files-placed-in-my-downloads-directory-in-\
@richlamdev
richlamdev / Don't use Vim.md
Created June 9, 2023 05:49 — forked from romainl/Don't use Vim.md
Don't use Vim for the wrong reasons

Don't use Vim

Don't do the crime, if you can't do the time.

-- Anthony Vincenzo "Tony" Baretta

Vim is an amazing text editor. I love it. Really, I wouldn't [organize][organize] a Vim advent calendar if I didn't. But, as amazing as it is, Vim is not for everyone. It can't solve all your problems, or be a TUI version of your favorite IDE, or make you a better programmer, or land you that dream job in the Bay Area. But Vim can help you be more mindful, focused, and efficient, as long as you approach it with the right mindset.

Don't get me wrong, I certainly welcome you to try Vim, but I'm not a proselyte. I don't thrive on newbies. I just want you to use the right tool for the job and not waste your—and anyone's—time on a fruitless quest.

@richlamdev
richlamdev / path.md
Created June 9, 2023 05:49 — forked from romainl/path.md
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
@richlamdev
richlamdev / locals.tf
Created April 28, 2023 23:17 — forked from NosearY/locals.tf
Flatten a map in terraform
locals {
nested_map = {
"app1" = {
"port" = 80
"image" = "nginx:latest"
"url" = [
"https://www.google.com",
"https://www.github.com",
"https://www.hashicorp.com"
]

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

___ _____ ___ _ _ __ _ _ ___ _ _ ___ _ _ _
/_\ \ / / __| ___ / __|___ _ _| |_(_)/ _(_)___ __| | / __| ___ __ _ _ _ _(_) |_ _ _ / __|_ __ ___ __(_)__ _| | |_ _ _
/ _ \ \/\/ /\__ \ |___| | (__/ -_) '_| _| | _| / -_) _` | \__ \/ -_) _| || | '_| | _| || | \__ \ '_ \/ -_) _| / _` | | _| || |
/_/ \_\_/\_/ |___/ \___\___|_| \__|_|_| |_\___\__,_| |___/\___\__|\_,_|_| |_|\__|\_, | |___/ .__/\___\__|_\__,_|_|\__|\_, |
|__/ |_| |__/
Notes taken in Mar-2018, from acloud.guru and AWS FAQ
___ _ _ _ __ _
/ __| ___ __ _ _ _ _(_) |_ _ _ / |/ \/ |

VimWiki Cheatsheet

[number] refers to the wiki number, set by the order in your vimrc. The default is 1.

Wiki Management

  • [number] <leader> ww - open wiki index file
  • [number] <leader> wt - open wiki index file in new tab
  • <leader> ws - list and select available wikis
  • wd - delete wiki page
@richlamdev
richlamdev / vim_cheatsheet_multi_files.md
Last active December 19, 2022 19:44
VIM cheatsheet - multi files

VIM Cheatsheet - Working with multiple files / Programming

Buffers

:e {file}                  - edit {file} in a new buffer
:fin[d] {file}             - search and open {file}
:b[uffer] {id}             - move to buffer using {id}
:bn[ext], :bp[rev]         - go to the next/previous buffer
:bf[irst], :bl[ast]        - go to first/last buffer

:bd[elete] - delete a buffer (close a file)

@richlamdev
richlamdev / netrw.txt
Created December 11, 2021 16:58 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@richlamdev
richlamdev / openbsd.txt
Created December 3, 2020 02:14
openbsd random notes
ENABLE USER TO SU
sudo user mod -G wheel <username>
UNBOUND fixes
chown _unbound:wheel /var/unbound/etc
chmod 755 /var/unbound/etc
UPDATE KERNEL
syspatch