Skip to content

Instantly share code, notes, and snippets.

\documentclass[tikz]{standalone}
\usetikzlibrary{math}
\tikzmath{
function FordCircles(\a,\b,\n){
int \p, \q; % ------------------------------ p and q are integers
for \q in {1,...,\n}{ % -------------------- 0 < q <= n
for \p in {\a*\q,...,\b*\q}{ % ----------- a < p/q < b <=> [aq] < p < [bq]
if gcd(\p,\q) == 1 then { % ------------ if the fraction is irreducible
\f = \p/\q; % ------------------------ evaluate the tuch point f = p/q
\r = 1/(2*\q*\q); % ------------------ evaluate the radius r = 1/2q^2
@kpym
kpym / sinc.tex
Last active August 29, 2015 14:16
\documentclass[tikz]{standalone}
\usetikzlibrary{math}
\tikzmath{
function sinc(\x) {
if abs(\x) < .001 then { % (|x| < .001) ~ (x = 0)
return 1;
} else {
return sin(\x r)/\x;
};
};
\documentclass[tikz]{standalone}
\usetikzlibrary{math,spy}
\tikzmath{
let \startcolor=blue; let \endcolor=red; % --- the start and end colors
function FordCircles(\a,\b,\n){
int \p, \q; % ------------------------------ p and q are integers
for \q in {1,...,\n}{ % -------------------- 0 < q <= n
int \mix; \mix = 100*(\q-1)/(\n-1); % ---- color mix parameter in [0,100]
for \p in {\a*\q,...,\b*\q}{ % ----------- a < p/q < b <=> [aq] < p < [bq]
if gcd(\p,\q) == 1 then { % ------------ if the fraction is irreducible
\documentclass[tikz]{standalone}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}[scale=.03pt]
\tikzmath{
% --------------------------
% the parameters of the tree
% --------------------------
\power=2.3; % the scale base factor
\deviation=70; % the angle between the 3 child edges
@kpym
kpym / PHC-Merlion-transp.png
Last active February 21, 2016 19:59
PHC Merlion - icône
PHC-Merlion-transp.png
\documentclass[tikz,border=7pt]{standalone}
\usetikzlibrary{svg.path}
\begin{document}
\begin{tikzpicture}
% the code generated with SVGPathy goes here
\fill svg{M50.1-.5l-1.5-3.8-2.7-6.4-2.2-5.2-1-2.4-1.1-2.8-4.8-11.8-1.3-3.3c-1.4-3.5-2-4.6-3.3-5.8s-3.1-2.5-4.3-2.9c-1.9-.6-4.9-.2-6.9 1l-1.2 .5 .3-.8 1.1-3.8c.2-1.6 .3-4.9 0-6.5l-.8-2.5-.2-.9h.8c2.2 .5 3.9-.3 7.1-3.2 4.7-3.8 10.2-6.5 16-7.7 3.5-.8 4.4-.6 1.8 .2-4.6 1.4-8 3.3-9.8 5.5-1.8 1.9-2.7 4.5-2.5 7.1 .2 1.6 .3 2.2 1.6 5.5 1.3 3.4 2.5 6.8 3.8 10.2l2 5.8c1.8 5.2 3.7 10.3 5.8 15.5 .7 2.1 1.5 4.2 2.4 6.2l3.8-9.1 .7-1.7c1-2.3 1.9-4.7 2.9-7.1l2.2-5 2-5.2 3.2-7.6 2-4.7c.6-1.7 .8-2.5 .8-4.1 0-2.5-.6-4.2-2.5-6.1-3.2-2.7-7-4.5-11-5.4l-.8-.5c7.6 .8 14.7 3.9 20.4 8.9 .6 .6 1.9 1.7 2.9 2 1.1 .6 2.4 .8 3.3 .5l1.1-.2-.3 1c-.6 1.9-.8 3.3-.8 5.6 0 2.5 .2 3.9 1.1 6.3l.5 1.6-1-.2-2.3-.4c-2.5-.3-5.4 .3-7.4 1.7-1.4 .9-2.8 2.5-3.8 3.9-2.3 4.8-4.3 9.6-6 14.7l-1.4 3.3-3.3 8.5-3.3 8c-.5 1.3-1 2.6-1.6 3.9 0 .3-.3 .2-.5-.3zm-28.9-21.2c-3-1.4-4.7-3.5-6.2-6.9-.5-.9-.5-2-.
@kpym
kpym / README.md
Last active March 20, 2019 08:38
whittakerw-for-tikz.ipynb
@kpym
kpym / Add print style to SX.user.js
Last active March 28, 2019 19:38
Greasemonkey : Add print style to stackexchange.com (SX).
// ==UserScript==
// @name Add print style to SX
// @namespace https://gist.github.com/kpym/0e595241caeaccefdecdb09d4186c376
// @version 0.1
// @description This script inject @media print CSS to SX websites
// @author kpym
// @match http*://*.stackexchange.com/*
// @grant GM_addStyle
// ==/UserScript==
/* jshint -W097 */
@kpym
kpym / 3-5-8 (Sergent Major).md
Last active August 21, 2019 09:51
Jeux de cartes

3-5-8 (Sergeant Major)

  • nombre de joueurs : 3
  • nombre de cartes : 52
  • sens de rotation : dans le sens des aiguilles d'une montre

Le «3-5-8» (ou «Sergent Major») est un jeu de cartes composé de 6 types de manches différentes (chacun joué 3 fois, une fois par joueur «annonceur»)

Ce jeu est conçu pour 3 joueurs et nécessite un paquet de 52 cartes. Les joueurs doivent essayer de faire 3, 5 ou 8 plis (d'où le nom du jeu). Dans 15 sur les 18 manches, si un joueur ne remporte pas suffisamment de plis, il perd des points. En revanche, s'il fait plus de plis que nécessaire, il gagne des points. Dans les 3 autres manches l'objectif est exactement l'inverse : les joueurs doivent faire le moins de plis possible. Par conséquent, les joueurs qui font trop de plis perdent des points, et ceux qui en font le moins possible gagnent des points. À la fin, le joueur avec le score le plus élevé gagne la partie.