Skip to content

Instantly share code, notes, and snippets.

View genyrosk's full-sized avatar
🚀

Evgeny Roskach genyrosk

🚀
View GitHub Profile
@genyrosk
genyrosk / load-env.sh
Created June 10, 2023 23:20
Some short helper bash functions to load, set and unset environment variables from .env.* files
#!/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
}
@genyrosk
genyrosk / rust_mem_profiling.md
Created November 24, 2022 21:32 — forked from HenningTimm/rust_mem_profiling.md
Memory profiling Rust code with heaptrack in 2019
@genyrosk
genyrosk / aws-cli-alias
Created November 3, 2022 19:03
AWS cli aliases
# 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)
@genyrosk
genyrosk / .gitconfig
Last active June 10, 2023 23:17
.gitconfig
[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 = youremail@gmail.com
name = username
signingKey =
@genyrosk
genyrosk / REISUB.md
Created November 3, 2022 18:52
REISUB: A gentle Linux restart

REISUB

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 mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
@genyrosk
genyrosk / .bashrc
Created December 19, 2019 10:42
A simple and useful prompt for bash
# 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
#
@genyrosk
genyrosk / Makefile
Last active February 8, 2024 18:26
Makefile for a Python environment with pyenv-virtualenv
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
@genyrosk
genyrosk / tomayto-tomahto.ipynb
Last active September 3, 2019 02:02
tomayto-tomahto
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@genyrosk
genyrosk / Makefile
Last active April 26, 2024 15:59
Makefile for a Python environment with virtualenv
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