Skip to content

Instantly share code, notes, and snippets.

@bdiegel
bdiegel / jdk_linux_install
Created June 28, 2014 14:46
Install JDK 1.7 on Linux (Ubuntu 14.04)
cd /opt
sudo tar -xzvf ~/Downloads/jdk-7u60-linux-x64.tar.gz
sudo mkdir -p /usr/lib/jvm
sudo mv ./jdk1.7.0_60/ /usr/lib/jvm/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_60/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_60/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_60/bin/javaws" 1
@bdiegel
bdiegel / convert_dict_types.py
Created June 30, 2014 17:01
Python: convert types of values in dict that was creates by the csv.DictReader
"""
Originally wrote this to convert string values in dict created by csv.DictReader to int, float and bool.
Expects dictionary to be one-level (does not recurse into sub-dictionaries) and values to be type String.
"""
def convert_types(dict):
"""
Modifies types of values in dict in place
"""
def str2bool(value):
@bdiegel
bdiegel / robomongo_uuid.md
Last active August 29, 2015 14:03
Robomongo UUID configuration

Robomongo

Robomongo is a free MongoDB management tool for Mac, Linux and Windows. It has a convenient user interface and also does not sacrifice the powerful features of the mongo console.

Get the version for your platform here.

Configuration

Robomongo reads the ~/.robomongorc.js configuration script on startup.

@bdiegel
bdiegel / rpy2_install_error.md
Created June 30, 2014 18:32
rpy2 install error on OSX

rpy2 install error

Error installing on Mac OSX (Mavericks) using pip

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

Tell clang not to raise these errors:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
@bdiegel
bdiegel / mac_osx_version.txt
Created July 8, 2014 14:02
Find Mac OX X version from terminal
sw_vers -productVersion
system_profiler SPSoftwareDataType
@bdiegel
bdiegel / linux_image_cleanup
Created August 30, 2014 13:46
Removing old linux kernel images
## Find and remove old linux kernel images to free space on /boot
# how much free/used space on boot partition
df -h /boot
# identify currently used version of the kernel
uname -a
# list all the installed kernel images
dpkg -l | grep linux-image
@bdiegel
bdiegel / libGL.so error
Created October 5, 2014 17:03
Android emulator libGL error
Error running Android emulator on Linux:
libGL.so cannot open shared object file
$ sudo apt-get install libgl1-mesa-dev
@bdiegel
bdiegel / couchbase_bulk_insert.sh
Last active August 29, 2015 14:14
couchbase_bulk_insert
# example of inserting documents from zip file into a couchbase bucket
sudo /opt/couchbase/bin/cbdocloader -u <username> -p <password> -n localhost:8091 -b <bucket> -s 100 ~path/to/data.zip
@bdiegel
bdiegel / py_venv_couchbase
Last active August 29, 2015 14:14
Python Couchbase Virtualenv
workon venv
pip install git+git://github.com/couchbase/couchbase-python-client@2.0.0-beta
pip install flask
pip install flask-restful
@bdiegel
bdiegel / couchbase_change_password.sh
Created February 14, 2015 23:47
Change Couchbase password
./couchbase-cli cluster-init -c 127.0.0.1:8091 --user=[CURRENT_USERNAME] --password=[CURRENT_PASSWORD] --cluster-init-username=[NEW_USERNAME] --cluster-init-password=[NEW_PASSWORD]