Skip to content

Instantly share code, notes, and snippets.

View pindlebot's full-sized avatar

Ben Gardner pindlebot

View GitHub Profile
#!/bin/sh
touch /etc/yum.repos.d/google-chrome.repo
echo -e "[google-chrome]\nname=google-chrome\nbaseurl=http://dl.google.com/linux/chrome/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\ngpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub" >> /etc/yum.repos.d/google-chrome.repo
touch /etc/yum.repos.d/centos.repo
echo -e "[CentOS-base]\nname=CentOS-6 - Base\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6\n\n" >> /etc/yum.repos.d/centos.repo
echo -e "#released updates\n[CentOS-updates]\nname=CentOS-6 - Updates\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6\n\n" >> /etc/yum.repos.d/centos.repo
echo -e "#additional packages that may be useful\n[CentOS-extras]\nname=CentOS-6 - Extras\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/
#!/bin/bash
export PATH=$PATH:/usr/pgsql-10/bin/
export PGUSER=postgres
yum group install -y "Development Tools"
yum install -y openssl-devel
cd /tmp && git clone https://github.com/citusdata/citus.git
cd citus && ./configure
make
#!/bin/bash
DATE=`date +%m-%d-%Y`
HOSTNAME=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
AWS_BUCKET=postgres-data
AWS_REGION=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}')
export PGUSER=postgres
pg_dumpall | aws --region $AWS_REGION s3 cp - "s3://$AWS_BUCKET/$HOSTNAME/$DATE.bak"
echo "Backup saved on $(date)"
#!/bin/bash
export PATH=$PATH:/usr/pgsql-10/bin/
cd /tmp
git clone https://github.com/michelp/pgjwt.git && cd pgjwt
make && make install
cd /tmp
git clone https://github.com/unshift/pg_gen_uid.git && cd pg_gen_uid
package main
import (
"bytes"
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
#!/usr/bin/bash env
export AWS_DEFAULT_REGION=us-east-1
SG="ec2-webserver-$(openssl rand 3 -hex)"
DEFAULT_SG=$(aws ec2 describe-security-groups --group-name default | jq -r '.SecurityGroups[0].GroupId')
SUBNET_ID=$(aws ec2 describe-subnets | jq -r '.Subnets[0].SubnetId')
KEY_NAME=$(aws ec2 describe-key-pairs | jq -r '.KeyPairs[0].KeyName')
INSTANCE_TYPE=t2.micro
IMAGE_ID=$(aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --query 'Parameters[0].[Value]' --output text)
#!/bin/bash -v
su ec2-user -c "curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash"
su ec2-user -c "source /home/ec2-user/.nvm/nvm.sh && nvm install node"
su ec2-user -c "source /home/ec2-user/.nvm/nvm.sh && nvm use node"
ln -s /home/ec2-user/.nvm/versions/node/v10.11.0/bin/node /usr/bin/node
ln -s /home/ec2-user/.nvm/versions/node/v10.11.0/bin/npm /usr/bin/npm
require('http').createServer((req, res) => {
res.setHeader('content-type', 'text/html')
res.end('OK')
}).listen(process.env.PORT || 80)
CREATE EXTENSION pg_cron;
select cron.schedule(
'* * * * *',
$$select * from http_post(
'http://requestbin.fullcontact.com/y7bgepy7',
'{ "foo": "bar" }',
'application/json'
)$$
);
cd /tmp
yum install libcurl-devel
git clone https://github.com/pramsey/pgsql-http.git
cd pgsql-http
make && make install
cd /tmp
git clone https://github.com/citusdata/pg_cron.git
cd pg_cron
make && make install