Skip to content

Instantly share code, notes, and snippets.

View Laxman-SM's full-sized avatar

Laxman Singh Laxman-SM

  • Ex-Phenome, Ex-Intertrust, Ex-Wipro
  • US, Hyderabad (india)
View GitHub Profile
@Laxman-SM
Laxman-SM / S3 buckets copy.md
Created August 26, 2016 10:39 — forked from ushu/S3 buckets copy.md
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@Laxman-SM
Laxman-SM / gist:c210afc077dffc909708eb47f239eb34
Created September 21, 2016 13:25 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
# example: python find_username_by_access_key.py <your_key>
import sys, boto3
TARGET_ACCESS_KEY = sys.argv[1]
client = boto3.client('iam')
paginator = client.get_paginator('list_users')
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 150,
@Laxman-SM
Laxman-SM / backup.sh
Created May 16, 2017 10:17 — forked from alexcreek/backup.sh
simple backup script using rsync + tar
#!/bin/bash
today=$(date +%m%d%Y)
targets=( '/etc' '/home' '/root' '/var/www' )
backup_root='/backups'
backup_dir=${backup_root}'/'${today}
log='/var/log/backup.log'
echo "$(date +%D" "%r): Beginning backup" >> $log
mkdir -p $backup_dir
@Laxman-SM
Laxman-SM / selfsigned_to_aws.sh
Created May 17, 2017 11:29 — forked from theist/selfsigned_to_aws.sh
This creates a selfsigned certificate/key pair an upload it to AWS iam for use in ELBs and the like
#!/bin/bash
DOMAIN=$1
openssl req -new -subj '/CN=${DOMAIN}/O=ACME./C=ES' -newkey rsa:2048 -days 365 -nodes -x509 -keyout ${DOMAIN}.key -out ${DOMAIN}.crt
if aws iam list-server-certificates --query "ServerCertificateMetadataList[*].ServerCertificateName" --output text | grep -q ${DOMAIN} ; then
aws iam delete-server-certificate --server-certificate-name ${DOMAIN}
fi
@Laxman-SM
Laxman-SM / install-graphite-ubuntu-11.10.sh
Created May 17, 2017 11:31 — forked from theist/install-graphite-ubuntu-11.10.sh
Changed to choice between "local" and EC2 setup. To do a local setup yo will do id_rsa created and authorized in your user. Your user must also possess sudo with no password (user or usergroup ALL=(ALL:ALL) NOPASSWD: ALL) This is useful to make local tests and changes to setup without wasting EC2 resources
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@Laxman-SM
Laxman-SM / gist:ffe295528ea54cc375b301237c3bb025
Created May 17, 2017 11:34 — forked from MrRoyce/gist:097edc0de2fe001288be2e8633f4b22a
AWS CodeDeploy Lamda formatter for Slack messages - node.js
var services = '/services/...'; // Update this with your Slack service...
var channel = "#aws-deployments" // And this with the Slack channel
var https = require('https');
var util = require('util');
var formatFields = function(string) {
var
message = JSON.parse(string),
fields = [],
#!/bin/bash
###########
# Script install and configure ELK stack Server and can be used for adding new clients to this stack.
# Last modified 3/3/2016
# Author: Aljo Antony
###########
# Define colors in case we decide to use them
color() {
Red='\e[0;31m'
@Laxman-SM
Laxman-SM / logstash.conf
Created May 17, 2017 11:45 — forked from clodio/logstash.conf
Serca ELK
#####################################################################
# Fichier de configuration logstash pour les logs serca tomcat
# claude.seguret@laposte.fr, frederic.soulie@laposte.fr
######################################################################
# Outil indispensable pour groker (regexp du log à dépouper)
# https://grokdebug.herokuapp.com/discover?#
# Exemple de log
# 10/Feb/2017:00:00:05 +0100] 10.91.64.28 GET /services/mascadia/legacy/controle?idClient=EBOUTIQUE&passwdClient=pass HTTP/1.1 ?idClient=EBOUTIQUE&passwdClient=pass 200 1795 254
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.