Skip to content

Instantly share code, notes, and snippets.

@zoultrex
zoultrex / Zoultrex-Typescript-cheatcheet.txt
Last active February 26, 2023 20:17
Typescript quick reminders and snippets
# Typescript
Quick reminders and snippets for Typescript, a work in progress
## Typings
### Functional components: prop types + default props
Example how to create a functional component, define and type its props and correctly setup defaultprops that will never fallback to undefined
Using default values on the function param declaration is the safe way to avoid the problem of passing undefined as a prop.
Use example below instead of declaring a defaultProps object and assigngin it to props param
@zoultrex
zoultrex / Zoultrex-redux-cheatcheet.md
Last active February 26, 2023 20:14
Redux cheatcheet and quick start examples

Redux

Redux reminders and guides, a work in progress

Redux Base Definitions

What are Redux reducers?

Reducers are pure functions that take the current state of an application, perform an action, and return a new state. The reducer handles how the state (application data) will change in response to an action.

@zoultrex
zoultrex / gist:c624e8140223840b7b0b680886b52006
Created January 29, 2023 21:09
install pyenv on ubuntu 18.04 that only worked for GCP
#install pyenv on ubuntu 18.04
sudo apt update
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH" && eval "$(pyenv init --path)" && echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec $SHELL
pyenv --version
@zoultrex
zoultrex / Nvidia cuda + docker nvidia drivers
Last active December 8, 2022 21:58
Install nvidia + cuda + docker nvidia drivers
nvidia+cuda:
https://towardsdatascience.com/deep-learning-gpu-installation-on-ubuntu-18-4-9b12230a1d31
nvidia for docker
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker