Skip to content

Instantly share code, notes, and snippets.

@ameir
ameir / gist:15194cbde2d04021f511ef1a00a1284a
Created September 2, 2021 20:53
Delete GitHub releases and tags in bulk
for i in {7..50}; do
version="v0.0.${i}"
echo $version;
gh release delete $version -y
git push --delete origin $version
done
@ameir
ameir / cfn-delete.sh
Created February 2, 2021 18:16
Delete CloudFormation stacks based on prefix or regex
#!/usr/bin/env bash
set -euo pipefail
export AWS_PAGER=""
REGEX="^prefix-"
WAIT=true
stacks=$(aws cloudformation describe-stacks --query Stacks[].StackName --output=text)
for stack in $stacks; do
if [[ $stack =~ $REGEX ]]; then
@ameir
ameir / usbjtag-install.sh
Created August 26, 2018 18:18
usbjtag on mac
#!/bin/bash
set -e
if [[ "$USER" != "root" ]]; then
echo "You must run this as root. e.g. sudo $0"
exit 1
fi
cd ~/Downloads
wget -nc http://www.usbjtag.com/filedownload/files/libusb.tar \
@ameir
ameir / userdata.sh
Created July 12, 2016 16:17
Run chef-client with AWS tags
#!/bin/bash -ex
export HOME=/root
INSTANCE_ID=$(curl -s http://instance-data/latest/meta-data/instance-id)
REGION=$(curl -s http://instance-data/latest/meta-data/placement/availability-zone | sed 's/.$//')
mkdir -vp /tmp/chef ; cd $_
aws ec2 --region $REGION describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" --output=text | awk -F '\t' -v q=\' '{gsub(/:/,"_",$2); print "TAG_" $2 "=" q$5q}' > instance-tags
. instance-tags
eval $TAG_chef_init
@ameir
ameir / gist:b9d437b9311c31c1fe4d
Created March 18, 2015 21:28
chef-php-ubuntu
case node['platform']
when 'ubuntu'
apt_repository "ondrej-php" do
uri "http://ppa.launchpad.net/ondrej/php5/ubuntu"
distribution node['lsb']['codename']
components ["main"]
keyserver "keyserver.ubuntu.com"
key "E5267A6C"
action :add
end
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/6/$basearch/