Skip to content

Instantly share code, notes, and snippets.

View kunalarya's full-sized avatar

kunalarya

  • Seattle, WA
View GitHub Profile
@kunalarya
kunalarya / mutate-rust-struct-match.md
Last active September 30, 2018 19:07
Mutating struct members in a match arm in Rust

It's sometimes useful to mutate struct members within a match statement: Playground link

struct Foo {
    elms: Option<Vec<u32>>
}

fn main() {
    let mut f = Foo { elms: Some(vec![1, 2, 3]) };
 let replace_with = vec![4, 5, 6];
@kunalarya
kunalarya / vim-pip-macos.md
Last active October 26, 2023 13:58
Using pip to install packages for vim's python 3 on Mac
  1. Determine vim's python 3 location. From vim:
:py3 import os; print(os.__file__)

It will print something like: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py

  1. From a shell, set a convenience variable based on the above path (note the change from lib/python3.7/os.py to bin/python3):
export VIMPY="/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/bin/python3"