Skip to content

Instantly share code, notes, and snippets.

@selenamarie
Last active December 16, 2015 11:38
Show Gist options
  • Save selenamarie/5428411 to your computer and use it in GitHub Desktop.
Save selenamarie/5428411 to your computer and use it in GitHub Desktop.
Installing plv8
# http://nonantolando.blogspot.tw/2012/10/using-json-on-ubuntu-1204-server-with.html
sudo apt-get install libv8-3.7.12.22 libv8-dev
# Install d8
# http://askubuntu.com/questions/141252/is-there-a-package-for-an-executable-version-of-v8
svn checkout http://v8.googlecode.com/svn/trunk/ ./v8
cd v8
make dependencies
make native
sudo ln -s `pwd`/out/native/d8 /usr/local/bin/d8
# Install plv8
wget https://plv8js.googlecode.com/files/plv8-1.3.0.zip
unzip plv8-1.3.0.zip
cd plv8-1.3.0
make
sudo make install
# Make sure npm is installed
sudo apt-get install npm
# create extension
psql -c "create extension plv8"
# NODE https://github.com/brianc/node-postgres/issues/335#issuecomment-16707881
sudo apt-get remove nodejs
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
# Don't know why it is needed, but works on Ubuntu
# Jesse says: I SEE THIS ON EVERY INSTALL :D
export NODE_PATH=/usr/lib/node_modules
#
sudo npm i -g LiveScript
sudo npm install pg@1.0.2 -g
# Install plv8x
sudo npm i -g plv8x
# now we are in audrey's slides
# and other stuff in here
sudo npm i -g uax11
selena@wuzetian:pgrest #1104 21:57 ♥: lsc -pe 'require \uax11 .toFullwidth \hello-selena'
# Installing the module into the declared database
selena@wuzetian:pgrest #1104 21:57 😱: plv8x -i uax11
selena@wuzetian:pgrest #1105 21:57 ♥: plv8x -l
pgrest: 80769 bytes
uax11: 137984 bytes
plv8x: 716954 bytes
selena@wuzetian:pgrest #1106 21:57 ♥: plv8x -f 'text fw(text)=uax11:toFullwidth'
ok text fw(text)
selena@wuzetian:pgrest #1107 21:58 ♥: psql selena
psql (9.2.4)
Type "help" for help.
selena=# select fw("askhxoashdxoiahsdx");
ERROR: column "askhxoashdxoiahsdx" does not exist
LINE 1: select fw("askhxoashdxoiahsdx");
^
selena=# select fw('askhxoashdxoiahsdx');
fw
--------------------------------------
askhxoashdxoiahsdx
(1 row)
selena=# \q
# POST MIDDLEWARE middlewares
# API
https://support.mongolab.com/entries/20433053-REST-API-for-MongoDB
# JSON insert
cat << 'EOF' > test.json
[ { "x" : 1 }, { "x" : 2 }, { "x" : 3 } ]
EOF
# csv insert
cat << 'EOF' > test.csv
x
1
2
3
EOF
# curl for creating these
curl -i -X PUT -H "Content-Type: application/json" --data-binary @test.json http://127.0.0.1:3000/collections/test1
curl -i -X PUT -H "Content-Type: text/csv" --data-binary test.csv http://127.0.0.1:3000/collections/test2
curl 'http://en.wikipedia.org/w/api.php?action=query&titles=List_of_birds&prop=revisions&rvprop=content&format=json' | sed -e 's/\(.\)\*\+/\1\
/g' | sed -e 's/\[\[/\{\"/' | sed -e 's/\[\[//g' | sed -e 's/\]\]:/\":/' |sed -e 's/\]\]//g' | sed -e 's/\(\: \)/\1 \"/' | sed -e 's/\\n/\"\},^M/' | sed -e 's/,^M\\n\.\*//' | grep ':' | grep '"' | awk 'NR>3{print $0}' > /tmp/junk
^^ very horrible
# wikispecies
PLAN
--> https://species.wikimedia.org/w/index.php?title=Special:WhatLinksHere/Aves&limit=500
then go to each page and pull out ea order & family page for detailed information and shove all that into json
# http://demos.kendoui.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment