Just an example page for testing


╼╤ Outline ╤╾

Some basics

This is the number pi, π=3.141592653589793\pi = 3.141592653589793. It is the ratio of a circles circumference to its diameter.

This is the quadratic formula. It allows the calculation of roots to quadratic polynomials:

x=b±b24ac2ax = \frac{-b \pm \sqrt{b^{2} - 4ac} }{2a}

Some python code

For example, here is a function that generates adds each post or page to the rss feed of this website. Currently it only adds markdown files and not premade html files so this needs to be changed. To see the full script which generates this site look here. Its rather ugly and inefficient at the moment but it does the trick.

#!/usr/bin/python3
import os, re, time, yaml, sys
rss="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n\t<channel>"...
def yaml_rss(fpath,mtime,slug):
    global rss
    with open(fpath, encoding='UTF-8') as f:
        config = list(yaml.load_all(get_yaml(f), Loader=yaml.SafeLoader)) 
        text = f.read()
        #print(text) print("CONFIG from", f)print("TEXT from", f) 
        if 'title' in config[0]: # Add items to rss feed
            rss+="\n\t\t<item>\n\t\t\t<title>"+config[0]["title"]+"</title>"
            if 'description' in config[0]:
                rss+="\n\t\t\t<description>"+config[0]["description"]+"</description>"
            else:
                rss+="\n\t\t\t<description>None</description>"
            rss+="\n\t\t\t<link>"+slug+"</link>\n\t\t\t<guid isPermaLink=\"false\">"+slug+"</guid>\n\t\t\t<pubDate>"+mtime+"</pubDate>\n\t\t</item>"

Some c code

#include <stdio.h>
int main() {
    printf("hello");
    return 0; 
}

A javascript example

let w = 400,h = 200, amt = 0.1;
let x=0,y=0,choice=[0.05,0.06,0.07,0.08,0.04]
function setup() {
  cnv = createCanvas(w, h);
  cnv.parent('cnv');
  noStroke();
  prevMouseX = mouseX;
  prevMouseY = mouseY;
}
function draw() {
  background("#fffee0");
  smooth();
  push();
  translate(w / 2, h / 3);
  for (let i = 100; i >=20; i--){
    strokeWeight(3);
    stroke(255%i,180,180);
    noFill();
    smooth();
    if(x<mouseX)x+=random(choice);
    if(x>mouseX)x-=random(choice);
    if(y<mouseY)y+=random(choice);
    if(y>mouseY)y-=random(choice);
    let xp=map(lerp(currX,x,1),0,w,-amt,amt);
    let yp=map(lerp(currY,y,1),0,w,-amt,amt);
    translate(xp,yp);
    ellipse(0,0,i,i);
  }
  eyeball(20);
  pop();
}
function eyeball(s){
  fill(0);
  ellipse(0,0,s,s);
  fill(255);
  ellipse(0, 0, s, map(sin(noise(frameCount/40)), -1, 1, 0,s));
  fill(0);
  push()
  translate(map(mouseX, 0, w, -1, 1), map(mouseY, 0, w, -1, 1))
  ellipse(0,0,s/4,s/4);
  pop()
}


Last edited :- Sat, 09 Apr 2022 19:08:29 BST