Skip to content

Instantly share code, notes, and snippets.

View nt's full-sized avatar

Nicolas Thiébaud nt

  • Anthropic
  • United States
View GitHub Profile
#include <string>
#include <vector>
#include "envoy/http/codes.h"
#include "common/common/assert.h"
#include "common/common/enum_to_int.h"
#include "common/common/fmt.h"
#include "common/http/codes.h"
#include "common/router/config_impl.h"
@nt
nt / min-char-rnn.py
Last active August 29, 2015 14:27 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@nt
nt / brute_force.py
Last active December 22, 2015 17:18
Building poems like those here: http://spotifypoetry.tumblr.com/
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(" "))
@nt
nt / hackerVision_jsbeautified.js
Last active December 17, 2015 01:59
Hacke Vison Chrome extension adding it's own tag to all my Amazon urls. Rude.
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++) {
@nt
nt / NewRelicFinagleFilter.scala
Created December 28, 2012 16:17
Using New Relic with Finagle is a pain
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]]) = {

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:

Quelques références: https://gist.github.com/3888345

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; }
@nt
nt / gist:3041162
Created July 3, 2012 17:22
Problem Statement for KingdomAndTrees
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.
@nt
nt / gist:3041121
Created July 3, 2012 17:15
Problem Statement for KingdomAndPassword
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.
@nt
nt / distributed_http.sacla
Created June 6, 2012 16:47
Concurrency in scala
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]()