I recently ran into a classic case of "our code is using way more memory than it should". So I took my first dive into memory profiling Rust code. I read several posts about this, including the following
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Load / Unset env vars from file | |
# | |
function get_env_file() { | |
local env=$1 | |
local envfile=$([ -z "$env" ] && echo ".env" || echo ".env.${env}") | |
echo $envfile | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put into .aws/cli/alias | |
[toplevel] | |
get-secret = | |
!f() { | |
default_region=$(aws configure get region) | |
printf "Enter the ARN of the secret: " | |
read secret_arn | |
secret_arn=$(echo $secret_arn | xargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
lg = !"git lg2" | |
[user] | |
email = [email protected] | |
name = username | |
signingKey = |
If a Linux machine locks up or freezes completely, use REISUB to restart it more gently than pushing the Power Button.
Hold down Alt
and the SysReq
(Print Screen
) keys, and then type R
E
I
S
U
B
, with 2-3 second delays between the key presses to give the commands a better chance to complete.
R
: Switch the keyboard from raw mode to XLATE modeE
: Send the SIGTERM signal to all processes except initI
: Send the SIGKILL signal to all processes except initS
: Sync all mounted filesystems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to ~/.bashrc or ~/.bash_profile | |
# | |
# A simple and useful prompt for bash | |
# when zsh is not an option. | |
# | |
# - displays current directory | |
# - shows local git branch | |
# - prompt on new line | |
# - skips to new line after each command | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL:=/bin/bash | |
PROJECT=project | |
VERSION=3.7.4 | |
VENV=${PROJECT}-${VERSION} | |
VENV_DIR=$(shell pyenv root)/versions/${VENV} | |
PYTHON=${VENV_DIR}/bin/python | |
JUPYTER_ENV_NAME=${VENV} | |
JUPYTER_PORT=8888 | |
## Make sure you have `pyenv` and `pyenv-virtualenv` installed beforehand |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL:=/bin/bash | |
VIRTUAL_ENV=env | |
JUPYTER_ENV_NAME=env | |
PORT=8888 | |
PYTHON=${VIRTUAL_ENV}/bin/python3 | |
# .ONESHELL: | |
DEFAULT_GOAL: help | |
.PHONY: help run clean build venv ipykernel update jupyter |