This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| git log | grep 'Author' | sed 's/<.*>//g' | sed 's/Author: //g' | sort | uniq | xargs -I {} bash -c "echo -n \"{}= \" ; git log -p --author='{}' --oneline | grep -c -e '^[+-]'" | sort -t '=' -g -k 2 -r |
| private def wikiTitles() = io.Source.fromFile(wikiTitlesDumpFile).getLines() | |
| def retrieveAndIndex() { | |
| val titles = wikiTitles().filter( titleIsUsable(_) ).map( cleanLine(_) ).toSet | |
| for (title <- titles) { | |
| val q = textPhraseQuery("_all", title) | |
| val request = esClient.prepareSearch(buskIndex) | |
| .setQuery(q).execute().actionGet() | |
| val totalHits = request.hits().totalHits() |
| [2012-02-08 20:11:02,128][DEBUG][action.search.type ] [Caprice] [suggest][0], node[JV4DgCKsTmaSXAAO_p6a1g], [R], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@5aad39c3] | |
| org.elasticsearch.transport.RemoteTransportException: [Eric the Red][inet[/10.70.69.80:9300]][search/phase/query+fetch] | |
| Caused by: java.lang.IllegalArgumentException | |
| at java.nio.Buffer.limit(Buffer.java:249) | |
| at org.apache.lucene.store.NIOFSDirectory$NIOFSIndexInput.readInternal(NIOFSDirectory.java:123) | |
| at org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:213) | |
| at org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:39) | |
| at org.apache.lucene.store.DataInput.readInt(DataInput.java:84) | |
| at org.apache.lucene.store.BufferedIndexInput.readInt(BufferedIndexInput.java:153) | |
| at org.apache.lucene.store.DataInput.readLong(DataInput.java:126) |
| val Regex = """\(([0-9]+),[0-9]+,'([^']+)','[^']*',[0-9]+,[0-9]+,[0-9]+,[0-9.]+,'[0-9]+',[0-9]+,[0-9]+,[0-9]+\)""".r | |
| io.Source.fromFile("ptwiki-20120126-page.sql").getLines().foreach { line => | |
| Regex.findAllIn(line).foreach { | |
| case Regex(id, title) => println(id + " :: "+title) | |
| } | |
| } |
| def create(userId: String, feedItemId: String) { | |
| println("user: "+userId + " clipou: "+feedItemId) | |
| redisClientPool.withClient { client => | |
| val itemsAdded = addItemToClips(redis, userId, feedItemId) | |
| if (itemsAdded != 0) { | |
| addClipToTimeline(client, userId, feedItemId) | |
| userFollowersSet(client, userId) match { | |
| case Some(followersIds) => followersIds.flatten { followerId => | |
| addClipToTimeline(client, userId, feedItemId) | |
| } |
| def create(userId: String, feedItemId: String) { | |
| println("user: "+userId + " clipou: "+feedItemId) | |
| redisClientPool.withClient { implicit client => | |
| val itemsAdded = addItemToClips(userId, feedItemId) | |
| if (itemsAdded != 0) { | |
| addClipToTimeline(userId, feedItemId) | |
| userFollowersSet(userId).flatten { followersIds => | |
| addClipToTimeline(userId, feedItemId) | |
| } | |
| } |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| high-thread-dispatcher { | |
| # Dispatcher is the name of the event-based dispatcher | |
| type = Dispatcher | |
| # What kind of ExecutionService to use | |
| executor = "fork-join-executor" | |
| # Configuration for the fork join pool | |
| fork-join-executor { | |
| # Min number of threads to cap factor-based parallelism number to | |
| parallelism-min = 200 | |
| # Parallelism (threads) ... ceil(available processors * factor) |