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 / Copy code from SX v2.user.js
Last active August 22, 2024 02:59
Greasemonkey : Add copy code button in stackexchange.com (SX).
// ==UserScript==
// @name Copy code from SX
// @namespace https://gist.github.com/kpym/30d90be41ab5c248cdf7
// @version 0.3
// @description This script use clipboard.js to add copy button for code sections on SX. When you hover a code the button "</>" appear on the top right corner. Click it and the code is copied.
// @author kpym
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
@kpym
kpym / PHC-Merlion-transp.png
Last active February 21, 2016 19:59
PHC Merlion - icône
PHC-Merlion-transp.png
@kpym
kpym / A_Lille_Photos.md
Last active July 3, 2022 12:49
Photos Lille

Ce gist contient des photos qui peuvent être utiliser lors de la création de pages web de conférences.

Pour obtenir le lien d'une photo il suffit de cliquer sur le lien dans la liste des fichiers avec le bouton droit et de faire «Enregistrer le lien sous...».

Le lien vers un fichier est obtenu en précédant son nom par

https://gist.githubusercontent.com/kpym/e7c4bd94953332159e6d0f666aa1f398/raw/
@kpym
kpym / tkz-euclid-cheatsheet.en.md
Last active August 10, 2024 08:17
cheatsheet : tkz-euclid (latex library based on tikz)

Gist

Package

\usepackage{tkz-euclide} % checked for version 3.02c

Point definitions

\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-.