Skip to content

Instantly share code, notes, and snippets.

@gaurish
gaurish / Dockerfile
Last active March 7, 2023 17:29
Sample App to show how to use SSL / Secure connection to connect to AWS RDS using Python
FROM python:3
WORKDIR /usr/src/app
ADD https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem .
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
COPY requirements.txt ./
RUN pip install mysql-connector-python
ADD mysql_connect.py .
CMD [ "python", "./mysql_connect.py" ]
#!/bin/bash
shopt -s extdebug
function mothership2() {
CLUSTER=punchh-prod-2
PROFILE=mothership
REGION=us-west-2
NAMESPACE=mothership2
}
function service() {
@gaurish
gaurish / Versions
Last active April 3, 2021 20:09
write:errno=0 SSL api.push.apple.com
# openssl version
OpenSSL 1.1.1d 10 Sep 2019
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
# Running on Docker.
@gaurish
gaurish / scaler.py
Created August 7, 2020 02:07
Scale down all services in a ECS cluster.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import boto3
from pprint import pprint
ecs_cluster = 'my_cluster_mame'
client = boto3.client('ecs', region_name='us-east-1')
@gaurish
gaurish / function.js
Created November 7, 2011 11:43
JavaScript Function Declaration Patterns
// Style #1
function foo() {
//do something
}
//Style #2
var foo = function(){
//do something
}
var _gaq = _gaq || [];
//Enter GA Account ID
_gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
//extract parameters from URI
var extractParamFromUri = function(uri, paramName) {
if (!uri) {
return;
}

Keybase proof

I hereby claim:

  • I am gaurish on github.
  • I am gaurish (https://keybase.io/gaurish) on keybase.
  • I have a public key ASDUFHFszCkZizcKi-nfGolA-dO41pobZ0jueNi9EnPQYwo

To claim this, I am signing this object:

@gaurish
gaurish / apache2.conf
Created December 3, 2012 17:21
Part of Rails Server Bootstrap Script
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@gaurish
gaurish / install_monit.sh
Last active May 18, 2018 10:15
Install Latest Version of Monit on Ubuntu 14.04 LTS Server 64bit(x86_64)
cd ~
wget http://mmonit.com/monit/dist/binary/5.12/monit-5.12-linux-x64.tar.gz
tar zxf monit-5.12-linux-x64.tar.gz
cd monit-5.12/
cp bin/monit /usr/bin/
mkdir /etc/monit
touch /etc/monit/monitrc
chmod 0700 /etc/monit/monitrc
ln -s /etc/monit/monitrc /etc/monitrc
wget https://gist.githubusercontent.com/gaurish/964456aa08c9fa2e43ee/raw/1aa107e62ecaaa2dacfdb61a12f13efb6f15005b/monit -P /etc/init.d/
@gaurish
gaurish / redisinfo.go
Created February 2, 2018 10:34
Redis Info as JSON over HTTP powered by Go
package main
import (
"encoding/json"
"log"
"net/http"
"os"
"strings"
"fmt"