Skip to content

Instantly share code, notes, and snippets.

View gowthamgts's full-sized avatar
💭
It's not much, but it's honest work.

Gowtham gowthamgts

💭
It's not much, but it's honest work.
View GitHub Profile
@gowthamgts
gowthamgts / cloudflare.sh
Created June 7, 2023 17:45 — forked from Manouchehri/cloudflare.sh
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
@gowthamgts
gowthamgts / server.go
Created November 28, 2022 17:52
a starter golang server - https://go.dev/doc/articles/wiki/
package main
import (
"html/template"
"log"
"net/http"
"os"
"regexp"
)
# Default values for Traefik
image:
name: traefik
# defaults to appVersion
tag: ""
pullPolicy: IfNotPresent
#
# Configure the deployment
#
@gowthamgts
gowthamgts / reset.md
Created August 23, 2019 18:37 — forked from hitautodestruct/reset.md
Reset root password on scaleway.com
@gowthamgts
gowthamgts / docker-compose.yml
Created May 13, 2019 18:12
Elastic Search 6 Docker Compose
version: "2.0"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.0.1
ports:
- "9200:9200"
- "9300:9300"
networks:
- docker_elk
environment:
@gowthamgts
gowthamgts / docker-compose.yml
Last active April 16, 2019 07:28
Elastic search with kibana docker-compose.yml
version: "2.0"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.0.1
ports:
- "9200:9200"
- "9300:9300"
networks:
- docker_elk
environment:
@gowthamgts
gowthamgts / rm_mysql.md
Created April 12, 2019 08:17 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@gowthamgts
gowthamgts / shell.sh
Created March 26, 2019 10:04
Confirm a user in cognito
# initiate and get session token
aws cognito-idp admin-initiate-auth --user-pool-id <pool_id> --client-id <client_id> --auth-flow ADMIN_NO_SRP_AUTH\
--auth-parameters USERNAME=<username>,PASSWORD=<pw>
# update with new password
aws cognito-idp admin-respond-to-auth-challenge --user-pool-id <pool_id> \
--client-id <client_id> --challenge-name NEW_PASSWORD_REQUIRED \
--challenge-responses NEW_PASSWORD=<new_password>,USERNAME=<username>,userAttributes.name="<if there are any>"\
--session "<session_key>"
@gowthamgts
gowthamgts / DrawableExtension.kt
Created October 14, 2018 07:59
A kotlin extension to convert a Drawable object to Bitmap
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
fun Drawable.toBitmap(): Bitmap {
if (this is BitmapDrawable) {
return this.bitmap
}
@gowthamgts
gowthamgts / 0. nginx_setup.sh
Created February 18, 2018 13:50 — forked from mikhailov/0. nginx_setup.sh
Nginx + secure pseudo-streaming
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz