Skip to content

Instantly share code, notes, and snippets.

View alexandrerocco's full-sized avatar
😁

Alexandre Rocco alexandrerocco

😁
View GitHub Profile
@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
@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
#!/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 / 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
@alexandrerocco
alexandrerocco / install-htop.sh
Last active May 8, 2022 09:18 — forked from magemore/gist:4499587
Amazon Linux - Install htop
# update
sudo yum -y update
sudo yum -y upgrade
# enable EPEL6 by changing enabled=0 -> enabled=1
sudo vim /etc/yum.repos.d/epel.repo
# install htop
sudo yum install htop
@alexandrerocco
alexandrerocco / install-node-centos.sh
Last active December 20, 2015 03:39
Install nodejs from source on Centos
sudo -s
## dependencies to build
yum -y groupinstall "Development Tools"
## download and build
cd /opt
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxf node-latest.tar.gz
cd node-latest
./configure
@alexandrerocco
alexandrerocco / install redmon on centos.sh
Created August 5, 2013 21:16
Install redmon on CentOS via rvm
sudo -s
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default
# ruby -v
# should be ruby 1.9.3
rvm rubygems current
# gem -v
@alexandrerocco
alexandrerocco / mongodb-single-instance.sh
Created August 13, 2013 14:27
Install a standalone MongoDb server with an attached volume
#!/bin/bash
sudo -s
yum -y update
yum -y install mdadm sysstat
cat <<EOF > /etc/yum.repos.d/10gen.repo2
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get -y install python-software-properties
sudo apt-add-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs
# Install git to get statsd
sudo apt-get -y install git
@alexandrerocco
alexandrerocco / install-nodejs-ubuntu.sh
Created September 2, 2013 13:47
Install nodejs on Ubuntu. Works on any release including Ubuntu 12.04 LTS, Ubuntu 12.10 and Ubuntu 13.04.
#!/bin/bash
apt-get update
apt-get install -y python-software-properties software-properties-common
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs