Skip to content

Instantly share code, notes, and snippets.

View ioagel's full-sized avatar

Ioannis Angelakopoulos ioagel

View GitHub Profile
@ioagel
ioagel / uptime_pretty
Last active July 13, 2020 14:12
Outputs only the 'up' section of the uptime command in pretty form, supporting most Linux distro and Mac OS X.
#!/bin/sh
# Referenced this stackoverflow answer by John1024: https://stackoverflow.com/a/28353785/2372698
uptime -p >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
# Supports most Linux distro
# when the machine is up for less than '0' minutes then
# 'uptime -p' returns ONLY 'up', so we need to set a default value
UP_SET_OR_EMPTY=$(uptime -p | awk -F 'up ' '{print $2}')
@ioagel
ioagel / remotepaste.md
Created November 3, 2019 16:18 — forked from burke/remotepaste.md
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@ioagel
ioagel / mysql_backup.sh
Last active October 22, 2019 07:55
Backup script for mysql/mariadb databases with optional encryption optimized for docker containers.
#!/usr/bin/env bash
# Author: Ioannis Angelakopoulos <ioagel@gmail.com>
# Date: 18/01/2019
###########################
# REQUIREMENTS
###########################
#
# * Required commands:
@ioagel
ioagel / encrypt_openssl_files.md
Last active January 21, 2019 08:05 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Private/Public key Creation

# Generate a new RSA 4096bit(default is 2048bits) key
# and encrypt it with a passphrase based on AES CBC 256 cipher:
openssl genrsa -aes256 -out private_key.pem 4096

# Generate a new RSA 4096bit(default is 2048bits) key without a passphrase:
openssl genrsa -out private_key.pem 4096

extract the Public key