Skip to content

Instantly share code, notes, and snippets.

View alekslario's full-sized avatar
🎯
Focusing

Aleksandrs Larionovs alekslario

🎯
Focusing
View GitHub Profile
@alekslario
alekslario / remove last commit form github
Last active February 27, 2024 18:23
remove last commit form github
// remove last commit from Github HEAD^^ also works
git push -f origin HEAD^:master
// remove last commit locally, keep files intact
git reset HEAD^
@alekslario
alekslario / GLOBAL NPM INSTALL IN DOCKER
Created February 26, 2024 02:34
GLOBAL NPM INSTALL IN DOCKER
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
# optionally if you want to run npm global bin without specifying path
ENV PATH=$PATH:/home/node/.npm-global/bin
@alekslario
alekslario / windows setup
Created January 11, 2024 13:01
windows setup
#!/bin/bash
#doppler
mkdir -p $HOME/bin
curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh | sh -s -- --install-path $HOME/bin
doppler update
#rust
curl https://sh.rustup.rs -sSf | sh
#install pyenv
git clone https://github.com/pyenv-win/pyenv-win.git "$HOME/.pyenv"
pyenv update
@alekslario
alekslario / git
Created March 22, 2023 20:09
git
#undo last push
git push -f origin HEAD^:master
@alekslario
alekslario / wifi fix on Rasberry 3A+
Last active March 20, 2023 14:30
wifi fix on Rasberry 3A+
rfkill list all
sudo rfkill unblock wifi
sudo ifconfig wlan0 up
sudo iwlist wlan0 scan
etc..
https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant
In general, if we want to distribute k crosses among n categories, the number of possible distributions can be found using the formula:
n + k - 1 choose k
which is equivalent to:
(n+k-1)! / (k! * (n-1)!)
@alekslario
alekslario / docker commands
Last active November 4, 2022 17:09
docker commands
#connect to container shell
docker exec -it <mycontainer> bash
#running image
docker run -dp 3000:3000 <myimage>
#list all containers, running or stopped
docker ps -a
#remove all containers
sudo docker stop $(sudo docker ps -a -q) && sudo docker rm $(sudo docker ps -a -q)
# docker compose forcinh to rebuild image
sudo docker-compose -f docker-compose.yml up --build
@alekslario
alekslario / gpg
Last active October 11, 2022 21:59
gpg
# encrypt decrypt combo
echo "sekret123" | gpg --encrypt -r ID --armor | base64 --wrap 0 | base64 -d | gpg --decrypt
# export pub key
gpg --export --armor ID > mypublickey.asc
# gen key
gpg --generate-key
# delete
gpg --delete-secret-key "User Name"
gpg --delete-key "User Name"
#list keys
@alekslario
alekslario / set envs from a file
Created October 5, 2022 16:33
set envs from a file
https://unix.stackexchange.com/questions/643126/setting-enivorment-variables-permanently-with-a-s
#help .
. /path/to/setup-env.sh
@alekslario
alekslario / set bash for npm-scripts
Created September 26, 2022 00:44
set bash for npm-scripts
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
#You can revert it by running:
npm config delete script-shell