Skip to content

Instantly share code, notes, and snippets.

@pseudokool
pseudokool / aws-backup-mysql.sh
Created August 30, 2019 06:59
Linux shell script to automate MySQL backups to a local filesystem, aws-s3 bucket, aws-glacier vault. Runs off amazon linux, by default.
#!/bin/bash
# set exec defaults
VERBOSE=true
DEBUG=false
FREQUENCY="daily"
FILE_SUFFIX="awsdb"
MAX_LOCAL_BAKS=2
MAX_S3_BACKUPS=4
MIN_FREE_SPACE=90 # in perc
# Create a subdomain on AWS EC2 (Apache2)
sudo mkdir -vp /var/www/vhosts/myapp.io/httpdocs
sudo chown -R ec2-user:apache /var/www/vhosts/myapp.io/httpdocs
mkdir -vp /var/www/vhosts/myapp.io/logs
sudo chown -R ec2-user:apache /var/www/vhosts/myapp.io/logs
sudo touch /etc/httpd/sites-enabled/myapp.io.conf
```
@pseudokool
pseudokool / common-linux-commands-quick-reference.md
Last active February 5, 2019 18:21
A few useful Linux commands #quickref

Copy

all files and folders from Downloads to Archived

cp -a ~/Downloads/. ~/Archived/

brace expansion - copies index.php to index.php.bak

cp /var/www/vhosts/domain.com/httpdocs/index.php{,.bak}
@pseudokool
pseudokool / desktop-mode-ubuntu-aws-ec2.markdown
Created September 11, 2018 17:05
Desktop (GUI) mode for Ubuntu 16.04 on AWS EC2

Ubuntu 16.04 on AWS EC2

This guide enables desktop mode in Ubuntu 16.04 (Xenial Xerus) running off an AWS EC2.

Setup

  • Launch an EC2 instance with Ubuntu 16.04 (should work on all versions greater too)
  • Ensure a security group is configured, that allows ingress on ports 22 (SSH) and 5901 (VNC, 5900+N, where N is the display number)
  • SSH into the instance, update the system, install the XFCE desktop and the lightweight VNC server:
@pseudokool
pseudokool / sftp-using-keypair-chroot-on-aws-ec2.md
Last active October 9, 2017 11:23
An attempt at demystifying the process of setting up sftp access to an EC2 instance on AWS, provisioning restricted access to folders (specifically webroots). This should also work on RHEL or most other UNIX flavours, with little changes. There's no claim to perfection however. All execution must be carefully done. Messing around with sshd_confi…

The Not So Ultimate Guide To SFTP with AWS EC2

(RHEL, but easily adaptable on other *nix servers)

Desired folder structure

Domain #1

fbk.com
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=0