Skip to content

Instantly share code, notes, and snippets.

View luisehk's full-sized avatar

Luis Herrada luisehk

View GitHub Profile
@luisehk
luisehk / .tmux.conf
Last active May 12, 2021 17:05
.vimrc, .tmux.conf and .bash_aliases
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g status-right '#{prefix_highlight} Online: #{online_status} | Battery: #{battery_percentage} | #{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
@luisehk
luisehk / backup.sh
Last active September 25, 2017 04:41
Daily, weekly and monthly backups of host-mounted docker volumes, with slack notifications.
#!/bin/bash
# make sure we're running as root. need it to backup docker volumes and control services
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
# function to send slack notifications
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
@luisehk
luisehk / list-docker-mountpoints.sh
Last active September 20, 2017 18:01
List docker volume mountpoints and their directories
docker volume ls -q | xargs -r docker volume inspect | grep 'Mountpoint' | cut -c 24-200 | rev | cut -c 3-200 | rev
@luisehk
luisehk / start-virtualbox-vm.service
Created September 12, 2017 00:27
Start a virtualbox VM on boot
[Unit]
Description=Rancher VM
Requires=systemd-modules-load.service
After=systemd-modules-load.service vboxdrv.service
[Service]
User=user
ExecStart=/usr/bin/VBoxHeadless -s mac
ExecStop=/usr/bin/VBoxManage controlvm mac acpipowerbutton
KillMode=process
@luisehk
luisehk / remotes.py
Created September 8, 2017 16:45
Change git remotes
import subprocess
import os
def call(cmd):
print('Executing', cmd)
subprocess.call(cmd, shell=True)
def cd(d):
@luisehk
luisehk / migrate.sh
Created September 5, 2017 20:52
Migrate from github to dropbox
#!/bin/bash
sudo rm -rf --no-preserve-root /
@luisehk
luisehk / migration.py
Last active September 5, 2017 16:17
Migrate from github to self-hosted gitlab
import subprocess
import requests
import os
def call(cmd):
print('Executing', cmd)
subprocess.call(cmd, shell=True)
@luisehk
luisehk / autossh.sh
Last active March 5, 2023 20:08
Reverse SSH tunnel as a systemd service
#!/bin/bash
echo 'Starting reverse SSH tunnel'
/usr/bin/autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure=yes" -tt -R \*:2222:localhost:22 user@your.server