I hereby claim:
- I am khamidou on github.
- I am khamidou_nylas (https://keybase.io/khamidou_nylas) on keybase.
- I have a public key ASAqGQhuLWPrByeUfH0WKXp_T2OVf9AQPvRQXsfOo3oOVQo
To claim this, I am signing this object:
<form method = "POST" action="resultat.html"> {% csrf_token %} | |
<select name="entry_to_delete"> | |
{% for product_name, product_id in history %} | |
<option value={{ product_id }}>{{ product_name }}</option> | |
{% endfor %} | |
</select> | |
<input type = "submit" value = "Submit"> | |
</form> |
from django.db import models | |
from django import forms | |
class Niveau(forms.Form): | |
choix_niveau=( | |
('deb', 'debutant'), | |
('int', 'intermédiaire'), | |
('av', 'avancé')) | |
niveau=forms.ChoiceField(choices=choix_niveau) |
I hereby claim:
To claim this, I am signing this object:
# Exponential backoff in Ruby | |
begin | |
make_request | |
rescue RequestError => e | |
if retries <= max_retries | |
retries += 1 | |
sleep 2 ** retries + rand(20) | |
retry | |
else | |
raise "Timeout: #{e.message}" |
# Mostly cribbed from https://github.com/carlos-jenkins/python-github-webhooks/blob/759b67e3af8ed7334467b7d359cd00a10b0ac3c7/webhooks.py#L73 | |
import hmac | |
def verify_github_webhook(secret, hub_signature_header, request_body): | |
sha_name, sha_value = hub_signature_header.split('=') | |
if sha_name != 'sha1': | |
raise ValueError('Unknown signature algorithm') | |
mac = hmac.new(secret.encode('utf-8'), msg=request_body, digestmod='sha1') | |
if not hmac.compare_digest(str(mac.hexdigest()), str(sha_value)): |
#!/usr/bin/env python3 | |
# | |
# This is an example script that generates JWT tokens for the Github API. | |
# Usage: genjwt.py your_github_private_key.pem | |
# | |
# After getting a token, you can make curl requests to the API like this: | |
# curl -i -H "Authorization: Bearer JWT_TOKEN" -H "Accept: application/vnd.github.machine-man-preview+json" "https://api.github.com/app" | |
import sys | |
import jwt | |
import time |
<?php | |
$ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"; | |
$CALENDAR_ID = "The id of a calendar you got from the Nylas /calendars API"; | |
$ch = curl_init("https://api.nylas.com/events"); | |
# Setup request to send json via POST. | |
$payload = json_encode( | |
array("title" => "Alan Turing Birthdate", | |
"description" => "Alan Turing Birthdate", |
<?php | |
$ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"; | |
$ch = curl_init("https://api.nylas.com/events"); | |
# Pass the access token as an HTTP basic auth username | |
curl_setopt($ch, CURLOPT_USERPWD, $ACCESS_TOKEN . ":"); | |
# Return response instead of printing. | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
// Taken from Mozilla's Public Suffix List (https://publicsuffix.org/). License: MPL | |
domains = ["ac", | |
"com.ac", | |
"edu.ac", | |
"gov.ac", | |
"net.ac", | |
"mil.ac", | |
"org.ac", | |
"ad", | |
"nom.ad", |
require 'openssl' | |
# verify_webhook: check that a webhook was sent by a Nylas server. | |
# params: | |
# - request: the request object you get from Rails, | |
# - nylas_app_secret: your app secret. | |
def verify_webhook(request, nylas_app_secret) | |
digest = OpenSSL::Digest.new('sha256') | |
data = request.body.read | |
digest = OpenSSL::HMAC.hexdigest(digest, nylas_app_secret, data) |