Skip to content

Instantly share code, notes, and snippets.

View charelF's full-sized avatar

Charel Felten charelF

  • https://github.com/charel-felten-rq
  • Amsterdam
View GitHub Profile
@charelF
charelF / Equation Game.md
Last active April 2, 2023 12:18
Using GPT3 and 4 to write an equation game for kids.

Using GPT to write an equation game for kids.

  • Author: Charel Felten
  • Date: 2023-04-02

I used ChatGPT (3.5 and 4) to write an equation game for kids. In this article, I will refer to the overall system as ChatGPT, and if I like to draw focus to the specific version used, I will mention GPT3.5 or GPT4.

Part 1: generating the equation

About the game

@charelF
charelF / SampleGestureView.swift
Created September 29, 2022 09:00
SwiftUI sample persistent gesture view
//
// SampleGestureView.swift
// StickerPaste
//
// Created by Charel Felten on 25/09/2022.
//
import SwiftUI
struct SampleGestureView: View {
df = pd.read_csv(files[1], sep="\s+")
df.columns = ["x", "xxx", "y"]
df.drop(columns="xxx", inplace=True)
plt.figure(figsize=(10,5))
plt.scatter(df.x, df.y, alpha=0.4, linewidths=0, color="blue")
def f(x, w0, i0, x0):
return 0.5 * i0 * (1 + erf(2**0.5 * (x0-x) / w0))
@charelF
charelF / How to use Minion Pro in Overleaf.md
Last active March 20, 2022 17:58
Using Minion Pro in Overleaf in 2022

Using Minion Pro in Overleaf in 2022

Small guide on the most easy way to use Minion Pro in Overleaf, avoiding all the uncessary / outdated steps (such as e.g. using the MinionPro package, which does not work in Overleaf, or dealing with .sty files)

Get Minion Pro

Follow these steps if you dont have Minion Pro yet.

  1. Download and Install Adobe Reader
  2. Locate the font: On MacOS, it can be found here: /Applications/Adobe Acrobat Reader DC.app/Contents/Resources/Resource/Font. On other operating systems its probably similar.
y = np.array([0.09, 0.06, 0.18, 0.004, 0.14, 0.07, 0.08, 0.19])
x = np.array([0.06, 0.09, 0.006, 0.5, 0.02, 0.06, 0.07, 0.003])
idx = np.argsort(x)
x = x[idx]
y = y[idx]
x = np.log(x)
z = np.polyfit(x, y, 1)
p = np.poly1d(z)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

krüger-gauge-circular-chart

krüger-gauge-circular-chart is an addition to the gauge-circular-chart. The added feature is another data dimension the chart, by adjusting the bar width of each bar seperately.

Example

The data passed is from the Netherlands with the first element the age at which the animals are slaughtered, the second element the amount of animals slaughtered the main difference between a krüger-gauge-circular-chart and a bar chart with variable bar width is the functionality of display. a bar chart displays the whole amount as an area (A = length * width), which makes sense when the two variables are compatible to multiply (e.g. per Capita CO2 emissions and number of people). However, as seen in the hypothetical data above, this chart type is not compatible, as the interesting fact is not the whole amount of years lived by the animals, but the comparison of amount of animals slaughtered and their age.

from kgc_chart import krueger_gauge_circular_chart as kgc_chart
import matplotlib.pyplot as plt
import numpy as np
xx, yy = np.meshgrid(np.linspace(0, 11*np.pi, 100), np.linspace(0, 11*np.pi, 100))
X = np.exp(np.sin(xx) + np.cos(yy)) + np.sqrt(xx*yy*0.4)
plt.figure(figsize=(10,10), dpi=100)
plt.imshow(X, cmap="afmhot", interpolation="Gaussian")
plt.show()
We can't make this file beautiful and searchable because it's too large.
problemStart,auction
2018-12-19 13:00:00,1
2018-12-19 14:00:00,0
2018-12-19 15:00:00,0
2018-12-19 16:00:00,0
2018-12-19 17:00:00,0
2018-12-19 18:00:00,0
2018-12-19 19:00:00,0
2018-12-19 20:00:00,0
2018-12-19 21:00:00,0