Skip to content

Instantly share code, notes, and snippets.

View dwdraju's full-sized avatar

Raju Dawadi dwdraju

View GitHub Profile
@dwdraju
dwdraju / bash_strict_mode.md
Created November 3, 2023 01:15 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@dwdraju
dwdraju / install-docker.sh
Last active February 3, 2021 07:27
install docker
#!/bin/sh
set -o errexit
set -o nounset
IFS=$(printf '\n\t')
# Docker
sudo apt update
sudo apt --yes --no-install-recommends install apt-transport-https ca-certificates
@dwdraju
dwdraju / netflix.md
Created July 3, 2020 20:05
Fasten playback speed of netflix

On the browser console, enter for 2X speed

document.querySelector('video').playbackRate = 2.0;
@dwdraju
dwdraju / create-gce-instance.go
Created June 14, 2020 16:05 — forked from martinomburajr/create-gce-instance.go
How to create a Google Compute Engine Instance using REST calls in Golang.
func CreateGCEInstance() {
//STEP 1 - INIT DATA - Add all your initialization data e.g. projectid, zones, accessTokens.
project := "<your-project-here>"
zone := "<your-zone-here>" //e.g. europe-west1-d
accessToken := "" ////retrieve from https://developers.google.com/oauthplayground/ select relevant compute engine scopes e.g. devstorage/read_write and auth/compute
endpoint := fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instances", project, zone)
//STEP 2 - REQUEST BODY
//Create a REST representation of whats required. see https://cloud.google.com/compute/docs/reference/rest/v1/instances/insert
reqBody := struct {
@dwdraju
dwdraju / SSL.md
Created May 30, 2020 12:15 — forked from gangsta/SSL.md
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr
@dwdraju
dwdraju / Dockerfile
Created May 12, 2020 10:39
Github package usage dockerfile
FROM node:12-alpine
ARG GITHUB_AUTH_TOKEN
ENV GITHUB_AUTH_TOKEN=$GITHUB_AUTH_TOKEN
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package.json ./
@dwdraju
dwdraju / github-package-flow.yml
Created May 12, 2020 10:27
Github Package Release Flow
name: git tag release and npm package publisher
on:
push:
branches:
- master
jobs:
publish_tag_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
apiVersion: v1
kind: Pod
metadata:
name: {{ .Release.Name }}-post-upgrade-hook
labels:
app.kubernetes.io/name: {{ .Release.Name }}
annotations:
"helm.sh/hook": "post-upgrade"
"helm.sh/hook-delete-policy": "hook-succeeded"
"sidecar.istio.io/inject": "false"
@dwdraju
dwdraju / README.md
Last active October 30, 2019 12:21
Docker Monitoring Stack

Monitoring Stack for Docker and Host System

Installation

  1. Docker
  2. Docker Compose

Folder Structure

.
├── docker-compose.yml
@dwdraju
dwdraju / s3-upload.py
Created September 17, 2019 11:47
Python S3 File Upload
import boto3
# Create an S3 client
s3 = boto3.client(
's3',
aws_access_key_id='KEY',
aws_secret_access_key='SECRET'
)
filename = '/path/to/file'