Skip to content

Instantly share code, notes, and snippets.

@kpym
kpym / Copy code from SX v2.user.js
Last active March 31, 2023 11:27
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/*
\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
\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
@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}
\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