Skip to content

Instantly share code, notes, and snippets.

View TheophileWalter's full-sized avatar

Théophile Walter TheophileWalter

View GitHub Profile
def fizzbuzz(N):
vfb = ['Fizz', '', ''][N%3] + ['Buzz', '', '', '', ''][N%5]
return vfb + (str(N)[len(vfb)*len(str(N)):])
import unittest
class TestFizzBuzz(unittest.TestCase):
def test_fizzbuzz(self):
for i in range(9999999):
# Excuses SNCF
# Les genres
M = 0
F = 1
# Les mots
sujet = ['Le traffic ', 'La circulation des trains ', 'Le fonctionnement de la ligne ', 'L\'horaire du prochain train ']
sujet_genre = [M, F, M, M]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
void error(const char *msg)
(* Open the big integer module, requires to compilate with "nums.cma" *)
open Big_int;;
(* Get the value as a big_int *)
let n = big_int_of_string Sys.argv.(1) in
(* Set up some big_int that we need use *)
let bi1 = big_int_of_int 1 in
(* The function *)
(* Compile with '-rectypes' option *)
let delta x =
if x mod 2 = 0 then x / 2
else 3*x + 1 in
let syr s x =
Printf.printf "%d " x;
if x <= 1 then ()
else s s (delta x) in
// ==UserScript==
// @name Comic Sans Killer
// @namespace tw.walter.comicsanskiller
// @version 1
// @grant none
// ==/UserScript==
/*
* Comic Sans Killer
* by Théophile Walter
* https://walter.tw
/*
* Wololo Javascript
* By Théophile Walter
*
*/
// Starts the Wololo
wololo_init();
// Setting up some datas
// Méthode d'affichage du labyrinthe.
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
for (int i = laby.getHero().cell.getI()-VIEW_FIELD; i <= laby.getHero().cell.getI()+VIEW_FIELD; i++) {
for (int j = laby.getHero().cell.getJ()-VIEW_FIELD; j <= laby.getHero().cell.getJ()+VIEW_FIELD; j++) {
Cell cell = laby.get(i, j);
if (cell == null) {
continue;
}
cell.paintCell(g2, (j-laby.getHero().cell.getJ()+VIEW_FIELD)*SCALE, (i-laby.getHero().cell.getI()+VIEW_FIELD)*SCALE, SCALE);