Skip to content

Instantly share code, notes, and snippets.

@harmy
harmy / gist:ca3574c8971cb9e44ec003ea783ac7af
Created December 11, 2019 08:14
create your own nonce on Unix with this simple command
head -c 12 /dev/urandom | base64
@harmy
harmy / Amazon Linux
Last active March 17, 2020 03:03
Resize AWS EC2 Instance EBS volume
#!/bin/bash
# Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Install the jq command-line JSON processor.
sudo yum -y install jq
# Get the ID of the envrionment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id)
@harmy
harmy / add-swap.sh
Last active August 12, 2020 07:26
add swap to ubuntu server
sudo dd if=/dev/zero of=/swap bs=1G count=16
sudo chmod 0600 /swap
sudo mkswap -f /swap
sudo swapon /swap
echo "sudo vim /etc/fstab"