This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, os | |
import shutil | |
def getint(data, offset, intsize): | |
"""Retrieve an integer (big-endian) and new offset from the current offset""" | |
value = 0 | |
while intsize > 0: | |
value = (value<<8) + ord(data[offset]) | |
offset = offset + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.actors.Actor._ | |
import java.util.concurrent._ | |
import scala.collection.mutable.ListBuffer | |
val terms = (1900 to 2012) map (i => "best party in "+i) | |
val pool = Executors.newFixedThreadPool(10) | |
var result = new ListBuffer[String]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem Statement | |
King Dengklek has a special room protected by a password. The password is a positive integer that does not contain the digit zero. You are given the old password as a long oldPassword. King Dengklek has been using this password for a long time. Now, he wants to create a new password. You are also given a int[] restrictedDigits. The tradition in the kingdom insists that: | |
The digits in the new password are a permutation of the digits in oldPassword. | |
For each i, the i-th most significant digit (0-based index) of the new password is not restrictedDigits[i]. | |
Return the new password X. If there are multiple solutions, return the one for which |oldPassword - X| is minimized. If there are still two possible solutions, return the smaller one. If there is no valid new password at all, return -1 instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem Statement | |
King Dengklek once planted N trees, conveniently numbered 0 through N-1, along the main highway in the Kingdom of Ducks. As time passed, the trees grew beautifully. Now, the height of the i-th tree is heights[i] units. | |
King Dengklek now thinks that the highway would be even more beautiful if the tree heights were in strictly ascending order. More specifically, in the desired configuration the height of tree i must be strictly smaller than the height of tree i+1, for all possible i. To accomplish this, King Dengklek will cast his magic spell. If he casts magic spell of level X, he can increase or decrease the height of each tree by at most X units. He cannot decrease the height of a tree into below 1 unit. Also, the new height of each tree in units must again be an integer. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table { font-size: 5pt; } | |
table td { table-layout:fixed; width:10px; overflow:hidden; word-wrap:break-word; } | |
table th { table-layout:fixed; width:10px; overflow:hidden; word-wrap:break-word; } |
Je voudrai m'essayer aux techno de graph processing, perso je n'y connais rien mais j'y vois là une bonne occasion de découvrir.
Je pense que ça peux être marrant d'appliquer cela à l'analyse de texte en utilisant ConceptNet. http://conceptnet5.media.mit.edu/ J'ai rencontré une boite à Boston qui fait ça et qui a de très bon résultats (Luminoso). Je vais chercher les publis.
Base de données et technos que j'ai envie de tester:
- http://thinkaurelius.github.com/titan/
- Cassandra
Quelques références: https://gist.github.com/3888345
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.thrift.protocol.TProtocolFactory | |
import com.twitter.finagle.{Service, SimpleFilter} | |
import com.twitter.util.{Duration, Time} | |
import org.apache.thrift.transport.TMemoryInputTransport | |
import com.newrelic.api.agent.{Response, Request, NewRelic, Trace} | |
import java.util.Collections | |
class NewRelicFinagleFilter(protocolFactory:TProtocolFactory) extends SimpleFilter[Array[Byte], Array[Byte]] { | |
def apply(request: Array[Byte], service: Service[Array[Byte], Array[Byte]]) = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('DOMContentLoaded', function () { | |
var ae = '68656c7064757-20'; | |
var an = /(.*\.)?amazon\.(com|[a-z]{2}(\.[a-z]{2})?)$/i; | |
var an2 = /\/gp\/product\/(\w{10})/i; | |
var an3 = /\/exec\/obidos\/tg\/detail\/\-\/(\w{10})/i; | |
var an4 = /\/dp\/(\w{10})/i; | |
var an5 = /\/exec\/obidos\/ASIN\/(\w{10})/i; | |
if (location.hostname.match(an || an2 || an3 || an4 || an5)) { | |
var items = document.evaluate("//a[contains(@href, 'amazon.')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); | |
mainloop: for (l = null, i = 0; l = items.snapshotItem(i); i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from httplib import HTTPConnection | |
import urllib | |
import json, sys | |
inp = sys.argv[1] | |
con = HTTPConnection("ws.spotify.com") | |
def tokenize(s): | |
return map(lambda l:l.lower(), s.split(" ")) |
OlderNewer