Skip to content

Instantly share code, notes, and snippets.

@bcchenbc
bcchenbc / pip_for_user.sh
Created February 10, 2015 03:09
simple process to have a working pip without root privilege
#!/bin/bash
##
# Adopted and edited from the solution by Evgeny at askbot.org
# http://askbot.org/en/question/2492/how-to-install-python-easy_install-python-distutils-in-root-or-non-root-account/
# and instruction provided by authors of setuptools.
# https://pypi.python.org/pypi/setuptools
#
# Please be noticed that the virtual environment directory was set to ~/.pyvenv
# you might want to change it.
#!/bin/bash
echo "PYTHONPATH=~.pyvenv/lib/python3.3/site-packages" >> ~/.bashrc
echo "export PYTHONPATH" >> ~/.bashrc
echo "PATH=~/.local/bin/:$PATH" >> ~/.bashrc
echo "export PATH" >> ~/.bashrc
echo "alias pipu='~/.local/bin/pip3 install --user'" >> ~/.bashrc
@bcchenbc
bcchenbc / mongod.conf...yaml
Last active November 26, 2015 09:09
mongod.conf with modified pathes and engine
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /mongodb
journal:
enabled: true
sudo mkdir /D
sudo chown $USER:$USER /D
mkdir /D/git
# packages and dependencies
sudo apt-get update
sudo apt-get install -y build-essential gfortran cmake
sudo apt-get install -y libtool libblas-dev liblapack-dev libhdf5-dev libzmq-dev libxml2-dev
sudo apt-get install -y autoconf automake uuid-dev pkg-config alien
sudo apt-get install -y python3-dev python3-pip
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y python3-pip
sudo apt-get install -y mongodb-org
sudo apt-get install -y nodejs nodejs-legacy
sudo pip3 install mysqlclient dataset
sudo pip3 install pymongo
sudo pip3 install twitter birdy
@bcchenbc
bcchenbc / gist:a871a343c5c4f1efb1a3
Created December 30, 2015 06:12 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@bcchenbc
bcchenbc / run-multiple-redis-instances.md
Created August 27, 2016 06:32 — forked from jarvys/run-multiple-redis-instances.md
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...
# prepare celery worker
sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
# for msgpack 0.4+ in python3, see http://neuro.debian.net/pkgs/python3-msgpack.html
### Ubuntu 14.04
# wget -O- http://neuro.debian.net/lists/trusty.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
# sudo apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9
### Ubuntu 16.04
wget -O- http://neuro.debian.net/lists/xenial.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9
@bcchenbc
bcchenbc / prepare_rabbitmq.sh
Created January 2, 2017 01:16
Prepare Rabbitmq server on new system
# install current version
echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install rabbitmq-server
# enable web interface
rabbitmq-plugins enable rabbitmq_management
# create admin account, guest/guest doesn't seem to work
# http://tqdev.com/2016-installing-adminer-ubuntu
# http://askubuntu.com/questions/760787/php-rendered-as-text-after-ubuntu-16-04-upgrade
sudo apt install apache2 libapache2-mod-php
sudo a2enmod php7.0
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
sudo mkdir /usr/share/adminer
sudo wget "http://www.adminer.org/latest.php" -O /usr/share/adminer/latest.php
sudo ln -s /usr/share/adminer/latest.php /usr/share/adminer/adminer.php