Skip to content

Instantly share code, notes, and snippets.

View junaid18183's full-sized avatar

Juned Memon junaid18183

View GitHub Profile
@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 / Dockerfile
Created April 6, 2017 11:21
how to do docker healthcheck using Goss
From busybox
COPY goss.yaml /tmp/goss.yaml
COPY goss /usr/local/bin/
COPY goss-serve /usr/local/bin/
HEALTHCHECK --interval=5s --timeout=2s --retries=12 \
CMD /usr/local/bin/goss --gossfile /tmp/goss.yaml v --format documentation
@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 / Readme.md
Created January 12, 2017 14:57
Kubernetes API Example Usage

Copied from : kubernetes/kubernetes#17404

The API docs don't have a great on-ramp for explaining how to use the API directly. We have some example docs from the DCOS docs, that don't really belong there. I'd like to donate them to the k8s API docs, but I'm not sure where to put them. Any ideas where these would go?

Unfortunately, it somewhat overlaps with the walkthrough 101 page, but the rest API bits don't really belong there...

Create a Kubernetes Pod Definition

A pod is one or more containers that are co-located on the same host. In this example we’re creating a pod which runs nginx.

@junaid18183
junaid18183 / Readme.md
Created January 4, 2017 11:12
Terraform custom Provider Template

This is a template to be used to create the dummy Terraform provider. For the example purpose I am using check_mk provider , the complete code for that can be found here - https://github.com/reancloud/terraform-provider-checkmk

Since this dummy check_mk provider has single resource named host, you have resource_host.go. Ideally you have to create a file named resource_.go for each resource your provider support

This dummy check_mk provider will work as {code} provider "checkmk" { user = "autouser" password = "UPFKWAJJDPJWTOQMOWHY"

@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 / dashing.tf
Created September 28, 2016 11:41
This is the terraform template to use with docker provider, covers ports and volumes + tested on boo2docker + make sure you copy the certs to cert path
# Configure the Docker provider
provider "docker" {
host = "tcp://192.168.99.100:2376/"
cert_path = "/vagrant/docker-certs"
}
# Create a container
resource "docker_container" "dashing" {
image = "${docker_image.dashing.latest}"
name = "dashing"
yum install epel-release
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
yum install httpd24*