Skip to content

Instantly share code, notes, and snippets.

@patientzero
patientzero / backup_hist.sh
Last active January 3, 2023 09:52
regular backup of bash_history
#!/bin/bash
# This is a script to backup your command history.
# How to use:
# 1.) create dir (mkdir ~/history) and place this script as backup_hist.sh in it.
# 2.) add daily cronjob
# to run daily at midnight, add this line to the crontab(crontab -e):
# 0 0 * * * /bin/bash ~/history/backup_hist.sh > /dev/null 2>&1
# 3.) To allow filtering of commands by date, add this to your .bashrc:
# HISTTIMEFORMAT="%d/%m/%y %T " and also here:
# hist command in non interactive shells by defautl disabled, so enable by adding historyfile
@patientzero
patientzero / migrate_vscode.sh
Last active March 6, 2019 17:37
Migrate vscode extensions to new machine
#!/bin/bash
# Install all vscode extensions on another machine
# based on https://stackoverflow.com/questions/35773299/how-can-you-export-vs-code-extension-list
# paste this in your terminal window on the base machine, it creates an sh file to execute on your new machine
echo '#!/bin/bash' > install_vscode_extensions.sh
code --list-extensions | xargs -L 1 echo code --install-extension >> install_vscode_extensions.sh
@patientzero
patientzero / awslogin.sh
Created October 25, 2017 16:17
Login to aws eu-central-1
DOCKER_LOGIN=`aws ecr get-login --region eu-central-1`
${DOCKER_LOGIN}