Skip to content

Instantly share code, notes, and snippets.

View shostelet's full-sized avatar

Simon Hostelet shostelet

View GitHub Profile

Inscription utilisateur

URL: /inscription/e-cantine

Formulaire

  • Email
  • Mot de passe
  • Adresse physique (pré-remplie si mail reconnu comme d'une entreprise en DB)
<?php
// in a controller
$app->get('/some-page', function() use ($app) {
$address = $app['session']->getAddress();
return $app->render('view.html.twig', ['address' => $address]);
});
// in the extended SessionServiceProvider class
_kmq.push(['identify', '[email protected]', {
'team_slug_name': 'FC John Doe',
'user_team_role': 'coach',
'user_is_admin': true
}]);
# see https://github.com/kissmetrics/py-KISSmetrics
client = KISSmetrics.Client(key=settings.KISSMETRICS_API_KEY)
identity = '[email protected]'
event_name = 'event_created'
properties = {
'total_team_events': some_value,
'total_invited_attendees': some_other_value
}
client.record(identify, event_name, properties)
@shostelet
shostelet / one_element_of_list.py
Last active August 29, 2015 14:23
Get one element (object, dict) within a list if attribute match something
mList = [
{
"name": "Alice",
"age": 19,
"slug_name": "alice"
},
{
"name": "Bob",
"age": 20,
"slug_name": "bob"
<!-- Liste des tags pour le site : SportEasy, Format "OneCall (appel générique)" -->
<!-- RAPPEL: fonction générique à coller dans les pages web. -->
<script src='http://www3.smartadserver.com/config.js?nwid=367' type="text/javascript"></script>
<script type="text/javascript">
sas.setup({ domain: 'http://www3.smartadserver.com'});
</script>
<!-- RAPPEL: fonction générique à coller dans les pages web. -->
<script type="text/javascript">
sas_tmstp=Math.round(Math.random()*10000000000);sas_masterflag=1;
function SmartAdServer(sas_pageid,sas_formatid,sas_target) {
if (sas_masterflag==1) {sas_masterflag=0;sas_master='M';} else {sas_master='S';};
document.write('<scr'+'ipt src="https://www3.smartadserver.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/' + sas_master + '/' + sas_tmstp + '/' + escape(sas_target) + '?"></scr'+'ipt>');
}
</script>
# separated IN + OUT to one stereo
filename="my_audio"
ffmpeg -i $filename-in.mp3 -i $filename-out.mp3 -filter_complex "[0]apad[a];[a][1]amerge[aout]" -map "[aout]" $filename.mp3
# Mono to stereo
ffmpeg -i mono.wav -ac 2 stereo.wav
# Stereo to mono
ffmpeg -i stereo.wav -ac 1 mono.flac
# When an audio has the same data in left and right channel, transcript end up looking like an echo between speakers
# in and out. The following code will filter out one of the speaker, and produce a text file with only one speaker's
# transcript. Because of the overtalk, segments are as short as one word. To mimick real segment, it concatenates
# words within a segment as long as there is less than 300ms between the end of a word and the beginning of the next one.
import json
# given a JSON file containing a call from Activate API. https://docs.allo-media.net/activate-api/
with open('call.json') as jsonfile:
call = json.load(jsonfile)