Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -C
WORK_DIR=$HOME/.cache
DOWNLOAD_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
ZIP_FILE=awscliv2.zip
@holly
holly / wp.sh
Created April 30, 2023 11:25
wordpress backup script for rental server
#!/usr/bin/env bash
set -e
# default variables
BACKUP_DIR=$HOME/backup
AWSCLI=/usr/local/bin/aws
WPCLI=/usr/local/bin/wp
DATE=$(date +%Y%m%d%H%M%S)
ROTATE=3
@holly
holly / instances_ctrl.sh
Last active March 25, 2023 14:38
easy ec2 start|stop script
#!/bin/bash
MODE=$1
#get_instances() {
#aws ec2 describe-instances --filter "Name=instance-state-name,Values=${STATE}" "Name=tag:Environment,Values=development" | jq -r '.Reservations[].Instances[] | [ .InstanceId, (.Tags[] | select(.Key == "Name").Value) ] | @csv'
#aws ec2 describe-instances --filter "Name=instance-state-name,Values=${state}" "Name=tag:Environment,Values=development" | jq -r '.Reservations[].Instances[] | .InstanceId'
#}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ce:DescribeCostCategoryDefinition",
"ce:ListTagsForResource",
"ce:GetAnomalySubscriptions",
#!/usr/bin/env python
# vim:fileencoding=utf-8
import os
import json
import requests
import datetime
import time
import boto3
import calendar
#!/usr/bin/env python
# vim:fileencoding=utf-8
import os
import requests
import datetime
import boto3
from dateutil.relativedelta import relativedelta
dt = datetime.datetime.now()
#!/bin/bash
if [ -z "${AWS_DEFAULT_PROFILE}" ]; then
export AWS_DEFAULT_PROFILE=default
fi
set -e
set -u
START_TIME=$(date -u +%Y-%m-%dT00:00:00Z -d "1 day ago")
curl -sfL https://api.github.com/repos/nestjs/nest/git/refs/tags/ | jq -r ".[].ref" | perl -nle "s/^refs\/tags\/// && print if /^refs\/tags\/(v\d{1,2}\.\d{1,2}\.\d{1,2})$/"
curl -sfL https://api.github.com/repos/vercel/next.js/git/refs/tags/ | jq -r ".[].ref" | perl -nle "s/^refs\/tags\/// && print if /^refs\/tags\/(v\d{1,2}\.\d{1,2}\.\d{1,2})$/"
curl -sfL https://www.openssl.org/source/ | perl -nle 'print $1 if /<a href=\"openssl\-(.*)\.tar\.gz\">.*/'