Skip to content

Instantly share code, notes, and snippets.

View dwdraju's full-sized avatar

Raju Dawadi dwdraju

View GitHub Profile
@dwdraju
dwdraju / hangout-chat-webhook.py
Created June 1, 2019 11:40
Google Hangout Chat Webhook
from httplib2 import Http
from json import dumps
#
# Hangouts Chat incoming webhook quickstart
#
def main():
url = 'URL'
bot_message = {
'text' : 'Hello there!'}
@dwdraju
dwdraju / slack-webhook.py
Created May 1, 2019 06:42
Slack incoming webhook in python
import json
import requests
# Set the webhook_url to the one provided by Slack when you create the webhook at https://my.slack.com/services/new/incoming-webhook/
webhook_url = 'https://hooks.slack.com/services/T*******Y/BCU****4/8YaPzL******MUk***Tz'
slack_data = {'text': "Sup! We're hacking shit together :spaghetti:"}
response = requests.post(
webhook_url, data=json.dumps(slack_data),
headers={'Content-Type': 'application/json'}
@dwdraju
dwdraju / curl.md
Created March 28, 2019 04:40 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@dwdraju
dwdraju / telnet-alpine.md
Last active August 31, 2020 09:19
Telnet on Alpine Linux

Install busybox-extras

apk add busybox-extras

Run telnet command

busybox-extras telnet 127.0.0.1 8080
@dwdraju
dwdraju / install-jenkins-ubuntu18.04.md
Created January 15, 2019 11:01
Install jenkins on ubuntu:18.04
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt install openjdk-8-jdk -y
sudo apt update
sudo apt install jenkins -y
sudo systemctl start jenkins
sudo systemctl status jenkins
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
@dwdraju
dwdraju / istio-real-ip.yaml
Created January 12, 2019 13:17
istio get host real ip
---
apiVersion: v1
kind: Service
metadata:
name: istio-ingressgateway
namespace: istio-system
annotations:
labels:
chart: gateways-1.0.5
release: istio
@dwdraju
dwdraju / ec2-spot-demand-node.yaml
Last active June 7, 2020 15:40
EKS Spot and OnDemand EC2 node
# aws ssm get-parameter --name /aws/service/eks/optimized-ami/1.16/amazon-linux-2/recommended/image_id --region us-west-2 --query "Parameter.Value" --output text
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Amazon EKS - Node Group - Released 2018-08-30 with addition for Spot'
Metadata:
Author:
Description: Madhuri Peri <[email protected]> Shawn OConnor <[email protected]>
License:
Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved.
@dwdraju
dwdraju / le-wildcard-generation.md
Created December 27, 2018 10:42
Letsencrypt Wildcard Certificate Generation with TXT record using Docker
sudo docker run -it --rm --name letsencrypt \
-v '/etc/letsencrypt:/etc/letsencrypt' \
-v '/var/lib/letsencrypt:/var/lib/letsencrypt' \
certbot/certbot \
certonly \
-d [site] -d *.[site] \
--manual --preferred-challenges dns \
--server https://acme-v02.api.letsencrypt.org/directory
@dwdraju
dwdraju / nginx-htaccess.md
Last active March 5, 2019 16:30
Nginx htaccess block

Generate password & user

sudo sh -c "echo -n 'user:' >> /etc/nginx/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
cat /etc/nginx/.htpasswd

Nginx conf

location / {
@dwdraju
dwdraju / ssl-termination-lb-https-redirect.md
Last active November 4, 2018 06:09
SSL Termination on Load Balancer HTTPS Redirect

Apache

<VirtualHost *:80>
    RequestHeader set X-Forwarded-Proto "http"
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    ...
</VirtualHost>