Skip to content

Instantly share code, notes, and snippets.

View alexandrerocco's full-sized avatar
🏠
Working from home

Alexandre Rocco alexandrerocco

🏠
Working from home
View GitHub Profile
@alexandrerocco
alexandrerocco / init-script-solr
Created June 21, 2013 21:33
Init Script for Apache Solr
#!/bin/sh -e
# chkconfig: 2345 95 20
# description: Solr Server
# Solr Server service start, stop, restart
# @author Shay Alexandre Rocco
SOLR_DIR="/opt/solr"
JAVA="/usr/bin/java -Xmx256m -DSTOP.PORT=8079 -DSTOP.KEY=a09df7a0d -jar start.jar"
case $1 in
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
@alexandrerocco
alexandrerocco / redis install.sh
Last active December 18, 2015 14:59 — forked from antond/redis install
Automated setup script for Redis Server on CentOS
### Set up SO:
sudo -s
yum -y update
yum -y install gcc gcc-c++ make
### Download and install Redis:
cd /opt
wget -q http://redis.googlecode.com/files/redis-2.6.14.tar.gz
tar xzf redis-2.6.14.tar.gz
rm -f redis-2.6.14.tar.gz
@alexandrerocco
alexandrerocco / gist:3289289
Created August 7, 2012 20:58
Migrate a mongodb collection to another structure (eg. rename fields)
// you can copy the collection from one old db to the new one (if needed)
db.oldcollection.find().forEach(function(d) {db.getSiblingDB('anotherdb')['newcollection'].insert(d);});
// gets all the current docs
var docs = db.oldcollecion.find();
// for each old doc, insert it into the new collection
docs.forEach(function(old) { var doc = {_id:old._id, ac:old.action}; if(old.advertiserid) doc.adid=old.advertiserid; db.newcollection.insert(doc); });
// removes the old collection