Skip to content

Instantly share code, notes, and snippets.

View sapiens-sapide's full-sized avatar

Stanislas SABATIER sapiens-sapide

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sapiens-sapide on github.
  • I am stansab (https://keybase.io/stansab) on keybase.
  • I have a public key ASBnlUJcsHi_-S-DgAPqwl42GdmQb0Wnnlz_EOhQCYkbeAo

To claim this, I am signing this object:

@sapiens-sapide
sapiens-sapide / ajouter cette réponse après la réponse "401"
Last active March 22, 2017 10:50
prism test on caliopen's swagger -> route authentication
"x-stoplight": {
"beforeScript": null,
"afterScript": null,
"mock": {
"enabled": true,
"dynamic": false,
"statusCode": 200
}
}
}
@sapiens-sapide
sapiens-sapide / gist:ca6fefa67a95eb6b2ff5ac5a297855c4
Created March 22, 2017 11:03
route /v1/authentications pour test prism
"/v1/authentications": {
"post": {
"description": "Returns an auth token to build basicAuth for the provided credentials",
"tags": [
"users"
],
"security": [],
"consumes": [
"application/json"
],
@sapiens-sapide
sapiens-sapide / gist:6c3fe957d30ca805ad3b207070708a8b
Created April 12, 2017 10:17
Nginx config example for mail proxy
mail {
server {
listen 15.29.8.163:25;
protocol smtp;
server_name ak47.example.com;
auth_http smtpauth.local:80/auth.txt;
smtp_auth none;
timeout 30000;
smtp_capabilities "SIZE 15728640";
@sapiens-sapide
sapiens-sapide / gist:9ed6658acec41501df9e0138ace1d240
Created April 12, 2017 15:19
requête sql recursive de mastodon pour construire le context
def ancestors
ids = (Status.find_by_sql(['WITH RECURSIVE search_tree(id, in_reply_to_id, path) AS (SELECT id, in_reply_to_id, ARRAY[id] FROM statuses WHERE id = ? UNION ALL SELECT statuses.id, statuses.in_reply_to_id, path || statuses.id FROM search_tree JOIN statuses ON statuses.id = search_tree.in_reply_to_id WHERE NOT statuses.id = ANY(path)) SELECT id FROM search_tree ORDER BY path DESC', id]) - [self]).pluck(:id)
statuses = Status.where(id: ids).with_counters.with_includes.group_by(&:id)
ids.map { |id| statuses[id].first }
end
def descendants
ids = (Status.find_by_sql(['WITH RECURSIVE search_tree(id, path) AS (SELECT id, ARRAY[id] FROM statuses WHERE id = ? UNION ALL SELECT statuses.id, path || statuses.id FROM search_tree JOIN statuses ON statuses.in_reply_to_id = search_tree.id WHERE NOT statuses.id = ANY(path)) SELECT id FROM search_tree ORDER BY path', id]) - [self]).pluck(:id)
statuses = Status.where(id: ids).with_counters.with_includes.group_by(&:id)
HTTP Failure in Axios { Error: getaddrinfo ENOTFOUND notyetimplemented notyetimplemented:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'notyetimplemented',
host: 'notyetimplemented',
port: 80,
config:
frontend_1 | RangeError: Invalid status code: 0
frontend_1 | at ServerResponse.writeHead (_http_server.js:192:11)
frontend_1 | at ServerResponse._implicitHeader (_http_server.js:157:8)
frontend_1 | at ServerResponse.OutgoingMessage.end (_http_outgoing.js:574:10)
frontend_1 | at ServerResponse.send (/srv/caliopen/code/src/frontend/web_application/node_modules/express/lib/response.js:211:10)
frontend_1 | at ServerResponse.json (/srv/caliopen/code/src/frontend/web_application/node_modules/express/lib/response.js:256:15)
frontend_1 | at catchError (/srv/caliopen/code/src/frontend/web_application/dist/kotatsu/bundle.js:10471:29)
frontend_1 | at Layer.handle_error (/srv/caliopen/code/src/frontend/web_application/node_modules/express/lib/router/layer.js:71:5)
frontend_1 | at trim_prefix (/srv/caliopen/code/src/frontend/web_application/node_modules/express/lib/router/index.js:315:13)
frontend_1 | at /sr
class Unprocessable(HTTPClientError):
"""
subclass of :class:`~HTTPClientError`
This indicates that the body or headers failed validity checks,
preventing the server from being able to continue processing.
code: 422, title: Bad Request
"""
13 : from elasticsearch_dsl import InnerObjectWrapper, Integer, Date
35 : version = Integer()
36 : date_update = Date()
83 et suiv. :
pi = Nested(doc_class=PIIndexModel, include_in_all=True,
properties={
"technic": Integer(),
"comportment": Integer(),
"context": Integer(),
"version": Integer(),
"date_update": Date()
})
m.field("pi", pi)