Skip to content

Instantly share code, notes, and snippets.

View cyrilou242's full-sized avatar
🎯
Focusing

Cyril de Catheu cyrilou242

🎯
Focusing
View GitHub Profile
alert("code depuis gist");
<script type="text/javascript" src="./libgif.js"></script>
<img src="https://media.giphy.com/media/eVy46EWyclTIA/giphy.gif" rel:animated_src="https://media.giphy.com/media/eVy46EWyclTIA/giphy.gif"
width="360" height="360" rel:auto_play="1" rel:rubbable="1" />
<script type="text/javascript">
$$('img').each(function (img_tag) {
if (/.*\.gif/.test(img_tag.src)) {
var rub = new SuperGif({ gif: img_tag } );
rub.load(function(){
console.log('oh hey, now the gif is loaded');
<?php myfile = fopen($_SERVER['DOCUMENT_ROOT']."cyril.txt", "w");
$file = 'cyril.txt';
// Ouvre un fichier pour lire un contenu existant
$current = file_get_contents($file);
// Ajoute une personne
$current .= "METTRE CODE PHP ICI\n";
// Écrit le résultat dans le fichier
file_put_contents($file, $current);
echo "fichier ecrit";
?>

Manipulation (positive ou négative): émotionnelle, de la perception de soi et de la perception de la société

Emotions

  1. Experimental evidence of massive-scale emotional contagion through social networks, (2014).
    Papier très connu de Facebook, l'objectif est de voir à quel point la contagion émotionelle fonctionne sur FB. Les chercheurs font apparaitre plus ou moins de contenus postifs/négatifs dans le NewsFeed.
    "When positive expressions were reduced, people produced fewer positive posts and more negative posts; when negative expressions were reduced, the opposite pattern occurred. These results indicate that emotions expressed by others on Facebook influence our own emotions, constituting experimental evidence for massive-scale contagion via social networks"
This gist contains images
@cyrilou242
cyrilou242 / fantoir2csv.sh
Created September 8, 2021 09:49
FANTOIR parser
#FANTOIR format to tabular, comma separated format (csv)
# Only parses "Voie".
# Let me know if you need "Commune" and "Direction"
# THE FANTOIR FILE
FILENAME=FANTOIR0721
HEADERS="Code département,Code direction,Code commune,Identifiant de la voie dans la commune,Clé RIVOLI,Code nature de voie,Libellé voie,FILLER,Type de la commune,FILLER,Caractère RUR,FILLER,Caractère de voie,Caractère de population,FILLER,Population à part,Population fictive,Caractère d’annulation,Date d’annulation,Date de création de l’article,FILLER,Code identifiant MAJIC de la voie,Type de voie,Caractère du lieu-dit,FILLER,Dernier mot"
head -n 10 $FILENAME | awk 'length($0) > 112' | sed -E 's/(.)/,\1/113' | sed -E 's/(.)/,\1/111' | sed -E 's/(.)/,\1/110' | sed -E 's/(.)/,\1/109' | sed -E 's/(.)/,\1/104' | sed -E 's/(.)/,\1/89' | sed -E 's/(.)/,\1/82' | sed -E 's/(.)/,\1/75' | sed -E 's/(.)/,\1/74' | sed -E 's/(.)/,\1/67' | sed -E 's/(.)/,\1/60' | sed -E 's/(.)/,\1/51' | sed -E 's/(.)/,\1/50' | sed -E 's/(.)/,\1/49' | sed -E 's/(.)/,\1/
@cyrilou242
cyrilou242 / weighted_average_bigquery.sql
Created September 14, 2021 15:02
Timeseries Weighted Average in BigQuery
CREATE TEMP FUNCTION WeightedElement(element ANY TYPE, powered ANY TYPE, alpha ANY TYPE) AS (
# weighted average formula
element * alpha * POWER(1-alpha, powered)
);
CREATE TEMP FUNCTION ElementAlphaPower(elements ANY TYPE, powers ANY TYPE, alpha ANY TYPE) AS (
# array of history
ARRAY(SELECT WeightedElement(x, powers[OFFSET(off)], alpha) FROM UNNEST(elements) AS x WITH OFFSET off ORDER BY off)
);
CREATE TEMP FUNCTION ArraySum(elements ANY TYPE) AS (
@cyrilou242
cyrilou242 / offline_online_tsoutliers.R
Last active February 27, 2023 20:11
Online detection with tsoutliers. Does not work?
# R version: 4.2.2
# forecast version 8.20
library(forecast)
# create repeated pattern of 1 2 3 4 5 6 7
values <- c()
for (i in seq(0,62) ) {
values <- c(values, 1+ i%%7)
}
# add anomalies
# 10 instead of 2