I hereby claim:
- I am domino14 on github.
- I am cesardelsolar (https://keybase.io/cesardelsolar) on keybase.
- I have a public key whose fingerprint is 1D8B 4EA5 9025 14FC 5AFA 1FEA 8632 444A AE51 DB55
To claim this, I am signing this object:
| // subchans is a map[string]chan *nats.Msg | |
| func (h *Hub) PubsubProcess() { | |
| for { | |
| select { | |
| case msg := <-h.pubsub.subchans["lobby.>"]: | |
| h.sendToRealm(LobbyRealm, msg.Data) | |
| case msg := <-h.pubsub.subchans["user.>"]: | |
| // Send the message to every socket belonging to this user. |
| resp, err := h.pubsub.natsconn.Request("ipc.request.registerRealm", data, ipcTimeout) | |
| if err != nil { | |
| log.Err(err).Msg("timeout registering realm") | |
| return err | |
| } | |
| // The response contains the correct realm for the user. | |
| rrResp := &pb.RegisterRealmResponse{} | |
| err = proto.Unmarshal(resp.Data, rrResp) | |
| if err != nil { | |
| return err |
| type Realm string | |
| type Hub struct { | |
| // Registered clients. | |
| clients map[*Client]Realm | |
| clientsByUserID map[string]map[*Client]bool | |
| register chan *Client | |
| unregister chan *Client | |
| pubsub *PubSub | |
| realmMutex sync.Mutex | |
| // Each realm has a list of clients in it. |
| import random | |
| import sys | |
| def to_freqs(tiles): | |
| """ Convert tiles to freq dictionary. """ | |
| f = {} | |
| for t in tiles: | |
| if t not in f: | |
| f[t] = 1 |
I hereby claim:
To claim this, I am signing this object:
| <div id="solutions_popup" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> | |
| <div class="modal-dialog modal-wide"> | |
| <div class="modal-content"> | |
| <div class="modal-header"> | |
| <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
| <h4 class="modal-title">Solutions</h4> | |
| </div> | |
| <div class="modal-body" id="defs-popup-content"> | |
| <h2>Nothing to see here</h2> | |
| <p>You didn't say the magic word.</p> |
| pi@raspberrypi ~/coding/ujamaa/src/anagrammer $ time ./blank_challenges ../../words/OWL2.gaddag 25 10 8Loading gaddag...Loading ../../words/OWL2.gaddag | |
| Read 4000068 elements, 1240330 nodes | |
| Read entire array | |
| Created all nodes, allocStates: 1240330 | |
| ILIBSUT? SUBTILIN SUBLIMIT MISBUILT | |
| GEEEPRN? EPERGNES | |
| EFAMLAU? FLAMBEAU | |
| EOSWRNR? RECROWNS CROWNERS DROWNERS WRONGERS FROWNERS | |
| YAGEUON? AUTOGENY | |
| ANNERRI? INSNARER INERRANT BRANNIER |
| >>> import requests | |
| >>> requests.get('https://na10-api.salesforce.com') | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| File "/Users/cesar/virtualenvs/venomenv/lib/python2.6/site-packages/requests/api.py", line 65, in get | |
| return request('get', url, **kwargs) | |
| File "/Users/cesar/virtualenvs/venomenv/lib/python2.6/site-packages/requests/safe_mode.py", line 39, in wrapped | |
| return function(method, url, **kwargs) | |
| File "/Users/cesar/virtualenvs/venomenv/lib/python2.6/site-packages/requests/api.py", line 51, in request | |
| return session.request(method=method, url=url, **kwargs) |
| "Yeah, I fought this and it was the horrible JVM running out of memory and swapping like crazy (crashing our process usually). We made the changes below: | |
| In the elasticsearch.yml config: | |
| index.cache.filter.expire: 10m | |
| index.cache.field.expire: 10m | |
| index.cache.field.type: soft | |
| We had 10m expires because we *rarely* (if ever) did the same ES search again. The soft setting just means to evacuate stale caches as needed (which shouldn't happen if caches are that low). Or, that is my understanding. |
| > formatToFixed = function(value) { | |
| ... // turn value into a number if it is not, then | |
| ... // turn it into a fixed string. Then finally turn | |
| ... // that back into a number. | |
| ... tempVal = +((+value).toFixed(6)); | |
| ... // then | |
| ... newValue = tempVal.toString(); | |
| ... return newValue; | |
| ... } | |
| [Function] |