Skip to content

Instantly share code, notes, and snippets.

View dnileshp's full-sized avatar

Nilesh Patil dnileshp

  • Patterns7 Technologies, Pune
  • pune
View GitHub Profile
Privacy Policy
DNilesh Patil built the BeforeTv app as a Free app. This SERVICE is provided by DNilesh Patil at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at BeforeTv unless otherwise defined in this Privacy Policy.
Information Collection and Use
@dnileshp
dnileshp / Cassandra_to_S3.sh
Last active August 7, 2017 09:45
Backup Cassandra to S3 Script
#!/bin/bash
TIMESTAMP=`date +%F-%H%M`
# Create backup
#mongodump --out mongodb-$HOSTNAME-$TIMESTAMP
cqlsh -e"copy propatterns_test.meterreadings to './cassandra.csv';"
cqlsh -e"copy propatterns_test.dailyconsumption to './cassandradaily.csv';"
# Add timestamp to backup
@dnileshp
dnileshp / Mongodb_to_s3.sh
Last active August 7, 2017 09:44
Backup Mongodb to Amazon s3 script
#!/bin/bash
#Force file syncronization and lock writes
mongo admin --eval "printjson(db.fsyncLock())"
MONGODUMP_PATH="/usr/bin/mongodump"
MONGO_HOST="IP ADDRESS"
MONGO_PORT="27017"
MONGO_DATABASE="admin"
@dnileshp
dnileshp / Mongodb_to_Google.sh
Last active August 7, 2017 09:40
Backup Mongodb to google storage script
#!/bin/bash
#Force file syncronization and lock writes
mongo admin --eval "printjson(db.fsyncLock())"
MONGODUMP_PATH="/usr/bin/mongodump"
MONGO_HOST="IPADDRESS"
MONGO_PORT="27017"
MONGO_DATABASE="admin"
TIMESTAMP=`date +%F-%H%M`
# Create backup
mongodump --authenticationDatabase admin --username 'gtadb' --password 'gtaAcc0unts&' --out mongodb-$HOSTNAME-$TIME
@dnileshp
dnileshp / Cassandra_to_Google.sh
Last active August 7, 2017 09:43
Cassandra backup to google storage script
#!/bin/bash
TIMESTAMP=`date +%F-%H%M`
# Create backup
#mongodump --out mongodb-$HOSTNAME-$TIMESTAMP
cqlsh -e"copy propatterns_test.meterreadings to './cassandra.csv';"
cqlsh -e"copy propatterns_test.dailyconsumption to './cassandradaily.csv';"
# Add timestamp to backup
@dnileshp
dnileshp / ScalaCache.scala
Created June 9, 2017 11:44
ScalaCache in scala
import scalacache.memcached.MemcachedCache
/**
* Created by dnilesh on 9/6/17.
*
*/
class ScalaCache {
import scalacache._
import memoization._
@dnileshp
dnileshp / KafkaProducer.scala
Last active May 26, 2017 06:54
Kafka Producer in scala Kafka version : 0.10.1.0 scala : 2.11.0
import java.util.Properties
import com.gta.config.GlobalVariables
import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord}
import scala.util.Random
object KafkaProducer {
def produceToKafka(message : String): Unit ={
@dnileshp
dnileshp / KafkaSubscriber.scala
Last active May 25, 2017 08:42
Kafka-Subscriber-Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object KafkaSubscriber {
import java.util.Properties
val TOPIC="test"