Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| #!/bin/bash | |
| #============================================================================== | |
| #TITLE: mysql_backup.sh | |
| #DESCRIPTION: script for automating the daily mysql backups on development computer | |
| #AUTHOR: tleish | |
| #DATE: 2013-12-20 | |
| #VERSION: 0.4 | |
| #USAGE: ./mysql_backup.sh | |
| #CRON: | |
| # example cron for daily db backup @ 9:15 am |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net" | |
| "net/mail" | |
| "net/smtp" | |
| "crypto/tls" | |
| ) |
| # 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 |
| sudo apt-get update | |
| sudo apt-get upgrade | |
| sudo apt-get install gcc autoconf bison flex libtool make libboost-all-dev libcurl4-openssl-dev curl libevent-dev uuid-dev | |
| cd ~ | |
| wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| // Detecting data URLs | |
| // data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs | |
| // The "data" URL scheme: http://tools.ietf.org/html/rfc2397 | |
| // Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2 | |
| function isDataURL(s) { | |
| return !!s.match(isDataURL.regex); | |
| } | |
| isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; |
| # Solves: | |
| # error: Couldn't set refs/heads/branchName | |
| # To X:xxx.git | |
| # ! [remote rejected] branchName -> branchName (failed to write) | |
| # error: failed to push some refs to 'X:xxx.git' | |
| git fsck --unreachable | |
| git reflog expire --expire=0 --all | |
| git repack -a -d -l | |
| git prune |
| app.directive('ngFocus', ['$parse', function($parse) { | |
| return function(scope, element, attr) { | |
| var fn = $parse(attr['ngFocus']); | |
| element.bind('focus', function(event) { | |
| scope.$apply(function() { | |
| fn(scope, {$event:event}); | |
| }); | |
| }); | |
| } | |
| }]); |
| #!/bin/sh | |
| echo | |
| curl -XDELETE 'http://localhost:9200/products' | |
| echo | |
| curl -XPUT 'localhost:9200/products' -d ' | |
| { | |
| "mappings" : { | |
| "Root" : { |
| -Dsun.java2d.xrender=true | |
| -Dswing.aatext=true | |
| -Dawt.useSystemAAFontSettings=lcd |