Skip to content

Instantly share code, notes, and snippets.

View dwdraju's full-sized avatar

Raju Dawadi dwdraju

View GitHub Profile
@dwdraju
dwdraju / gitlab-ce-installation-fixes.md
Created August 13, 2018 06:21
Gitlab Installation Fixes
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo dpkg-reconfigure locales
@dwdraju
dwdraju / mysql-gcs-backup.sh
Last active May 7, 2022 18:04
Send MySQL Backup to Google Cloud Storage(GCS)
#!/bin/bash
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
BACKUP_DIR="/home/ubuntu/backup/$TIMESTAMP"
MYSQL_USER="****"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="****"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p "$BACKUP_DIR/"
@dwdraju
dwdraju / mail-test.php
Created August 1, 2018 06:19
mail test smtp
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "[email protected]";
$to = "[email protected]";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
@dwdraju
dwdraju / ssh-tunnel.md
Created July 23, 2018 11:38
Static SSH Tunneling
#!/bin/bash

RUNNING=`ps aux | grep "ssh -i /root/.ssh/id_rsa -L .:880:localhost:80 " | grep -v grep | wc -l`

if [ $RUNNING -eq 0 ]; then
    screen -dm ssh -i /root/.ssh/id_rsa -L *:880:localhost:80 -L 4443:www.google.com:443 -R 880:localhost:80 username@yourvpsdomain
fi
@dwdraju
dwdraju / ansible-send-pub-key.md
Created July 19, 2018 10:02
Ansible set ssh authorized keys to all hosts
- hosts: all
  become: true
  tasks:
   - name: Set authorized key taken from file
     authorized_key:
       user: ubuntu
       state: present
       key: "{{ lookup('file', '/home/ubuntu/new_id_rsa.pub') }}"
@dwdraju
dwdraju / init-envoy.md
Created July 10, 2018 10:08
envoy proxy
docker run -d --name httpbin kennethreitz/httpbin


docker run -it --rm --link httpbin tutum/curl curl -X GET http://httpbin/headers


docker run -it --rm envoyproxy/envoy envoy --help
docker run -it --rm envoyproxy/envoy envoy (no config
@dwdraju
dwdraju / kubectl-patch-deployment.md
Last active January 8, 2019 09:57
Kubernetes Istio update annotation, swagger
kubectl -n default patch deployment nginx-deployment -p '{"spec":{"template":{"metadata":{"annotations":{"sidecar.istio.io/inject": "true"}}}}}'
spec:
  replicas: 1
  template:
    metadata:
 labels:
@dwdraju
dwdraju / git-sync.sh
Created July 6, 2018 06:50
git pull sync
#!/bin/bash
LOCKFILE=/home/ubuntu/docker.lock
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
echo "already running"
exit
fi
# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}
@dwdraju
dwdraju / gcloud-compute-access-scope.md
Created July 2, 2018 09:06
Google Cloud Check Compute Instance Access Scope
curl --silent --connect-timeout 1 -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/scopes
@dwdraju
dwdraju / json-sed.md
Created June 27, 2018 17:26
sed replace json value
sed -i '/BaseURL/c\   \"BaseURL\" : \"http:\/\/google.com\/\"' config.json