Skip to content

Instantly share code, notes, and snippets.

View AmauryCarrade's full-sized avatar
🍊
I don't hate you

Amaury Carrade AmauryCarrade

🍊
I don't hate you
View GitHub Profile
@AmauryCarrade
AmauryCarrade / CalculusAntiSpam.php
Last active December 20, 2015 14:58
A calculation-based anti-spam for web forms, written in PHP. The documentation is available under the first file.
<?php
if(session_id() == '') {
session_start();
}
/**
* This class generates a calculation to prevent the spam on forms.
*
* @author Amaury Carrade
*/
#!/usr/bin/python
import sys, os;
from path import path;
from datetime import datetime;
if len(sys.argv) < 2:
print('Usage: listIds.py <configDirectory> [reportFile] [lineBreaksInReportFile] [debugLevel]');
print('');
print('reportFile: a path where the report will be stored. If it is blank, the report will be saved in a file called report, in the config directory.');
@AmauryCarrade
AmauryCarrade / Science.md
Last active October 30, 2021 14:52
La science sur YouTube

Chaînes scientifiques et informatives YouTubiennes

(Aucun ordre particulier.)

Français

  • Mickaël Launay : diverses vidéos autour des mathématiques. Cours de maths, jeux de logique, chroniques ou encore manipulations autour des mathématiques.
  • Experimentboy : « Des expériences et des découvertes, des plus folles aux plus intrigantes avec une petite touche... experimentboy :D »
  • e-penser : « Il y a un paquet de choses qui sont parfaitement acquises et sur lesquelles on ne revient jamais. Pourtant, si on prend le temps d'y penser, les choses ne sont pas nécessairement aussi évidentes qu'elles le semblent. Sur e-penser, nous allons tenter de creuser un peu, qu'il s'agisse de science, d'histoire, de culture générale, voire parfois simplement de bon sens. »
@AmauryCarrade
AmauryCarrade / getBooleanFromString.java
Last active August 29, 2015 14:06
getBooleanFromString
/**
* Returns a boolean from an entered string, or null if the string does not represent a boolean.
*
* "on", "yes", "y", "true" = true
* "off", "no", "n", "false" = false
*
* @param input the input text.
* @return true/false if the string is a boolean; null else.
*/
public Boolean getBooleanFromString(String input) {
@AmauryCarrade
AmauryCarrade / mod-zcraft.user.js
Last active January 14, 2017 17:23
Affichage de raccourcis de modération et divers autres améliorations sur le forum de ZCraft
// ==UserScript==
// @name Affichage de raccourcis de modération sur ZCraft
// @namespace eu.carrade.amaury.zcraft
// @description Affichage de raccourcis de modération sur ZCraft
// @include https://forum.zcraft.fr/viewtopic.php*
// @include https://forum.zcraft.fr/post.php*
// @include https://forum.zcraft.fr/edit.php*
// @include http://forum.zcraft.fr/viewtopic.php*
// @include http://forum.zcraft.fr/post.php*
// @include http://forum.zcraft.fr/edit.php*
@AmauryCarrade
AmauryCarrade / chat-zcraft.user.js
Last active September 18, 2015 17:14
Accès rapide à un mini-client IRC connecté au bon canal, depuis le forum de zCraft.
// ==UserScript==
// @name Chat intégré sur le forum
// @namespace eu.carrade.amaury.zcraft.chat
// @description Intégration d'un accès à IRC sur le forum
// @include https://forum.zcraft.fr/*
// @version 2
// @grant none
// ==/UserScript==
var chat_url = "https://kiwiirc.com/client/irc.zcraft.fr/?&theme=mini#zcraft";
<?php
use Symfony\Component\HttpFoundation\Response;
$app->get("/tools/minecraft/history", function() use($app)
{
$user = isset($_GET["user"]) ? trim($_GET["user"]) : "";
$valid = true;
$emptyHistory = false;
$data = array();
#!/bin/bash
mkdir -p `kpsewhich --var-value=TEXMFHOME`
cd `kpsewhich --var-value=TEXMFHOME`
wget http://mirror.ctan.org/fonts/emerald.zip
unzip emerald.zip
cp -r emerald/. . && rm -rf emerald/
rm emerald.zip
@AmauryCarrade
AmauryCarrade / generator.php
Last active December 26, 2015 15:57
Bukkit permissions generator (published under the CeCILL-B licence)
<?php
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\Generator\UrlGenerator;
/* ** *** Plugin.yml generation *** ** */
@AmauryCarrade
AmauryCarrade / injectTranslations.py
Created January 19, 2016 21:49
Translations injector for migration from key-based i18n to gettext (using the zDevelopers/zLib I18n component).
import fnmatch
import os
import yaml
def flat_yaml(stream):
with open(stream) as f:
raw_data = yaml.load(f)
data = {}
flatten_structure(raw_data, data)