Skip to content

Instantly share code, notes, and snippets.

@junaid18183
junaid18183 / userdata.sh
Created October 12, 2022 08:25 — forked from dkeightley/userdata.sh
RKE2 AWS cloud controller manager
#!/bin/sh
PUBLIC_IP=$(curl ifconfig.io)
# export INSTALL_RKE2_VERSION="v1.20.5+rke2r1"
curl -sfL https://get.rke2.io | sh -
provider_id="$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)/$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
@junaid18183
junaid18183 / check_vpn_status.py
Created March 9, 2018 13:06 — forked from mjbommar/check_vpn_status.py
This script monitors and logs to CSV the status of all tunnels for all VPNs for a single EC2 region.
'''
@author Bommarito Consulting, LLC; http://bommaritollc.com/
@date 20131029
This script monitors and logs to CSV the status of all tunnels for all VPNs for a single EC2 region.
'''
# Imports
import boto
import boto.ec2
import boto.vpc
@junaid18183
junaid18183 / taint_module.sh
Created February 15, 2018 05:47 — forked from justinclayton/taint_module.sh
Terraform: taint all resources from one module
#!/bin/bash
module=$1
for resource in `terraform show -module-depth=1 | grep module.${module} | tr -d ':' | sed -e 's/module.${module}.//'`; do
terraform taint -module ${module} ${resource}
done
@junaid18183
junaid18183 / gist:17c5b94e38a3072722440051074c9b5d
Created January 8, 2018 09:21 — forked from cktricky/gist:8f4e9912f757d1ccdcd00ad8e8630620
Lambda Function to Alert (Slack) of Unauthorized IAM Attempt
var AWS = require('aws-sdk');
var url = require('url');
var https = require('https');
var hookUrl, kmsEncyptedHookUrl, slackChannel;
kmsEncyptedHookUrl = 'abcd1234'; // Enter the base-64 encoded, encrypted key (CiphertextBlob)
slackChannel = 'example_channel'; // Enter the Slack channel to send a message to
var postMessage = function(message, callback) {
@junaid18183
junaid18183 / backup-github.sh
Created September 6, 2017 11:35 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
# NOTE: if you have more than 100 repositories, you'll need to step thru the list of repos
# returned by GitHub one page at a time, as described at https://gist.github.com/darktim/5582423
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
@junaid18183
junaid18183 / collaborator api
Last active April 4, 2017 05:05 — forked from marchampson/collaborator api
Add collaborator from command line
curl -i -u "my_user_name:my_password" -X PUT -d '' 'https://api.github.com/repos/my_gh_userid/my_repo/collaborators/my_collaborator_id'
@junaid18183
junaid18183 / gist:1997537207891dea1821056b40bfc37c
Created November 25, 2016 06:26 — forked from elijahchancey/gist:98a40f5b033ac3b61f7c
Relaying mail through AWS SES | Chef + Postfix Cookbook + Sasl
HOWTO: Use the Postfix Chef Cookbook to have your EC2 server relay all mail through AWS SES.
node.default['postfix']['mailtype'] = "master"
node.override['postfix']['main']['relayhost'] = "[email-smtp.us-west-2.amazonaws.com]:25"
node.default['postfix']['main']['smtp_sasl_auth_enable'] = "yes"
node.default['postfix']['main']['smtp_sasl_password_maps'] = "hash:/etc/postfix/sasl_passwd"
node.default['postfix']['main']['smtp_sasl_security_options'] = "noanonymous"
node.default['postfix']['main']['smtpd_use_tls'] = "yes"
node.default['postfix']['main']['mynetworks'] = "42.42.42.0/24, 127.0.0.1/32"
node.default['postfix']['main']['mydomain'] = "solongandthanksforallthefi.sh"
@junaid18183
junaid18183 / git_submodules.md
Created November 17, 2016 12:57 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@junaid18183
junaid18183 / AWS Swarm cluster.md
Created August 23, 2016 09:39 — forked from ghoranyi/AWS Swarm cluster.md
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know