Skip to content

Instantly share code, notes, and snippets.

View EFF's full-sized avatar
:shipit:

Francois-Xavier P. Darveau EFF

:shipit:
View GitHub Profile
@EFF
EFF / from python date to js utc timestamp
Created May 28, 2015 19:41
python date conversion with js utc timestamp
#from date to js timestamp
from datetime import datetime
from calendar import timegm
python_date = datetime.now()
js_timestamp = timegm(python_date.timetuple()) * 1000
@EFF
EFF / results.txt
Created February 3, 2016 15:50
mata.com verbose phantomas run
[10:36:29] eff_it:~ $ phantomas http://www.manta.com --verbose
15:40:19.776 phantomas v1.14.0: /usr/local/lib/node_modules/phantomas/
15:40:19.776 Options: {"format":"plain","R":"plain","reporter":"plain","timeout":15,"silent":false,"progress":false,"page-source":false,"film-strip":false,"colors":false,"analyze-css":false,"stop-at-onload":false,"spy-eval":false,"scroll":false,"no-externals":false,"disable-js":false,"v":true,"verbose":true,"h":false,"help":false,"V":false,"version":false,"url":"http://www.manta.com","user-agent":"phantomas/1.14.0 (PhantomJS/2.1.1; darwin x64)"}
15:40:19.779 Loading: core modules...
15:40:19.781 Core module navigationTiming v1.0 initialized
15:40:19.791 Core module requestsMonitor v1.2 initialized
15:40:19.792 Core module timeToFirstByte v1.1 initialized
15:40:19.792 Loading: extensions...
15:40:19.792 Getting the list of all modules in /usr/local/lib/node_modules/phantomas/extensions...
15:40:19.795 Module cookies v1.0 initialized
@EFF
EFF / donation-service.js
Created January 16, 2017 16:31
calls to dexero
'use strict';
import fetch from 'node-fetch';
import DexeroHttpError from '../../error';
export default class DonationService {
getBase64EncodedDexeroCredentials() {
this.clientId = process.env.DEXERO_CLIENT_ID;
this.clientSecret = process.env.DEXERO_CLIENT_SECRET;
return new Buffer(`${this.clientId}:${this.clientSecret}`).toString('base64');
@EFF
EFF / Alberto.md
Created April 22, 2019 21:55
Alberto

Alberto is an aviation pioneer. He pilots an airplane called "14-bis". Initially, there are F units of fuel in the fuel tank of his airplane.

There are some flight missions Alberto may take. The missions all start and end in the same location, and he may do them in any order. However, he can only do each mission at most once. You are given two int[]s of the same length: duration and refuel. For each valid i:

  • duration[i] is the amount of fuel consumed while running mission i
  • After Alberto completes mission i and gets paid, he will buy refuel[i] units of fuel. This amount will always be strictly smaller than the amount consumed during the mission.

Alberto can only choose a mission if he has enough fuel for it. That is, at the beginning of the mission his fuel tank must have at least duration[i] units of fuel.

Solutions pour sortir le NLU

Solution 1 (La plus simple)

Description

Engine ne change pas d'interface et on code un http API par dessus.

Avantages

  1. Rapide à coder
  2. break rien pentoute