- requires python 2.7 (maybe python 3.3+ will work too, didn't tested it)
Put git2neo.py somewhere in your $PATH and chmod +x it.
| #!/usr/bin/env python | |
| """ | |
| A brute-force approach to solve the first quesiton of GLAT | |
| More about GLAT: http://googleblog.blogspot.de/2004/09/pencils-down-people.html | |
| The question is as follows: | |
| 1. Solve this cryptic equation, realizing of course that values for M and E | |
| could be interchanged. No leading zeros are allowed. |
| #!/usr/bin/env python | |
| """ | |
| A brute-force approach to solve the seventeenth quesiton of GLAT | |
| More about GLAT: http://googleblog.blogspot.de/2004/09/pencils-down-people.html | |
| The questoin is as follows: | |
| 17. Consider a function which, for a given whole number n, | |
| returns the number of ones required when writing out all numbers |
| #!/usr/bin/env python | |
| import csv | |
| import collections | |
| import re | |
| import json | |
| import requests | |
| # start... | |
| $ bin/elasticsearch | |
| # ... with nothing | |
| $ curl -XDELETE localhost:9200 | |
| {"ok":true,"acknowledged":true} | |
| # index document | |
| $ curl -XPUT http://localhost:9200/index1/type1/id1 -d '{"title": "foo", "tags": ["bar", "baz"]}' | |
| {"ok":true,"_index":"index1","_type":"type1","_id":"id1","_version":1} |
| package com.example; | |
| import com.wordnik.swagger.annotations.ApiParam; | |
| import javax.ws.rs.GET; | |
| import javax.ws.rs.Path; | |
| import javax.ws.rs.PathParam; | |
| import javax.ws.rs.Produces; | |
| import javax.ws.rs.core.MediaType; | |
| import javax.ws.rs.core.Response; |
| package stackoverflow; | |
| import org.apache.lucene.analysis.Analyzer; | |
| import org.apache.lucene.analysis.standard.StandardAnalyzer; | |
| import org.apache.lucene.document.Document; | |
| import org.apache.lucene.document.Field; | |
| import org.apache.lucene.document.StringField; | |
| import org.apache.lucene.document.TextField; | |
| import org.apache.lucene.index.*; | |
| import org.apache.lucene.search.*; |
| (function(G,O,o,g,l,e){G.GoogleAnalyticsObject=O;G[O]=function(){G[O].q.push(arguments)},G[O].q=[],G[O].l=+new Date;e=o.createElement('script'),l=o.scripts[0];e.src=g;l.parentNode.insertBefore(e,l)}(this,'ga',document,'//www.google-analytics.com/analytics.js')); | |
| // ===> | |
| ga('create', 'UA-XXXXXXX-Y'); | |
| ga('send', 'pageview'); |
| [info] Starting scala interpreter... | |
| [info] | |
| Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0). | |
| Type in expressions to have them evaluated. | |
| Type :help for more information. | |
| scala> import spray.json._ | |
| import spray.json._ | |
| scala> import DefaultJsonProtocol._ |
| package org.example; | |
| import org.apache.lucene.document.Document; | |
| import org.apache.lucene.document.Field; | |
| import org.apache.lucene.document.LongField; | |
| import org.apache.lucene.index.DirectoryReader; | |
| import org.apache.lucene.index.IndexReader; | |
| import org.apache.lucene.index.IndexWriter; | |
| import org.apache.lucene.index.IndexWriterConfig; |