Skip to content

Instantly share code, notes, and snippets.

@lrhache
lrhache / install
Last active August 29, 2015 13:57
neo4j install
mkdir ~/neo4j
mv neo4j-community-2.0.1-unix.tar.gz ~/neo4j/neo4j-community-2.0.1-unix.tar.gz
cd ~/neo4j
tar -xzf neo4j-community-2.0.1-unix.tar.gz
cp neo4j-community-2.0.1 <graph-name>
git clone git://github.com/neo4j/spatial.git spatial
cd spatial
mvn clean package -Dmaven.test.skip=true install
unzip target/neo4j-spatial-0.11-SNAPSHOT-server-plugin.zip -d ~/neo4j/<graph-name>/plugins/
~/neo4j/<graph-name>/bin/neo4j start
@lrhache
lrhache / install.sh
Last active August 29, 2015 13:58
PyQt in virtualenv
mkdir lib
cd lib
wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10.4/PyQt-x11-gpl-4.10.4.tar.gz
tar xvf PyQt-x11-gpl-4.10.4.tar.gz
cd PyQt-x11-gpl-4.10.4/
python configure.py
make && make install
@lrhache
lrhache / install.sh
Created April 5, 2014 03:19
phantomjs
cd /usr/local/share
wget http://phantomjs.googlecode.com/files/phantomjs-1.9.7-linux-x86_64.tar.bz2
tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
@lrhache
lrhache / bash
Created April 15, 2015 02:39
Set MySQL to EBS storage
sudo service mysql stop
sudo mkdir /ebs1/etc /ebs1/lib /ebs1/log
sudo mv /etc/mysql /ebs1/etc
sudo mv /var/lib/mysql /ebs1/lib
sudo mv /var/log/mysql /ebs1/log
sudo mkdir /etc/mysql /var/lib/mysql /var/log/mysql
echo "/ebs1/etc/mysql /etc/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /etc/mysql
echo "/ebs1/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql
@lrhache
lrhache / bash
Created April 15, 2015 02:57
Load up multiple .sql dump files into MySQL
find . -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch -u xxx -p <database>
@lrhache
lrhache / bash.sh
Created April 15, 2015 13:59
MySQL import from CSV files
mysqlimport -u root -p<password or prompt> -f --local <database> `pwd`/*.csv &> ../db_insert.log
@lrhache
lrhache / match-doublequote-enclosed.awk
Created April 21, 2015 01:05
Get text in enclosed in double quote
awk -F\" '{print $(NF-1)}'
@lrhache
lrhache / file-extension.awk
Created April 21, 2015 01:06
Find unique file extension from list of files
awk -F. '!a[$NF]++{print $NF}'
@lrhache
lrhache / missing-lines.sh
Last active August 29, 2015 14:19
Find all the missing lines from file B that are in file A
grep -F -x -v -f <file to compare:file B>.txt <base file:file A>.txt
# or:
comm <(sort fileB) <(sort fileA) -3 > output.txt
# prints lines that are both in file1 and file2 (intersection)
awk 'NR==FNR{a[$0];next} $0 in a' file1 file2
@lrhache
lrhache / ElasticSearch.sh
Last active September 2, 2015 13:22 — forked from ricardo-rossi/ElasticSearch.sh
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch