Skip to content

Instantly share code, notes, and snippets.

View Feuermurmel's full-sized avatar
🐙

Feuermurmel Feuermurmel

🐙
  • Zürich, Switzerland
View GitHub Profile
@Feuermurmel
Feuermurmel / pi_digits.py
Last active February 17, 2020 12:09
I wrote this for fun. Slow as hell. Maybe broken. Don't use.
from math import floor
from fractions import Fraction as F
def pi_approx(bits):
def term(k):
return F(1, 16 ** k) * (F(4, 8 * k + 1) - F(2, 8 * k + 4) - F(1, 8 * k + 5) - F(1, 8 * k + 6))
return sum(term(k) for k in range(bits // 4 + 1))
@Feuermurmel
Feuermurmel / sitecustomize.py
Created March 22, 2020 11:04
Relative paths in Python stack traces.
import builtins
import os
import sys
from builtins import __import__
def fix_path(p: str):
if not p.startswith('/'):
return p
@Feuermurmel
Feuermurmel / geometry.swift
Created October 17, 2023 10:51
Swift Named Parameter Examples
import Foundation
struct Point {
var x: Float64
var y: Float64
init(_ x: Float64, _ y: Float64) {
self.x = x
self.y = y
}