Skip to content

Instantly share code, notes, and snippets.

View Wikunia's full-sized avatar

Ole Kröger Wikunia

View GitHub Profile
@Wikunia
Wikunia / vis_digits.jl
Created July 13, 2020 16:58
Visualzing digits
using Luxor, ColorSchemes
using UnicodeFun
using Primes
struct PNGScene
opts::Dict{Symbol, Any}
end
function get_coord(val, radius)
θ = 2π*0.1*val
@Wikunia
Wikunia / Manifest.toml
Last active October 2, 2023 20:34
Mandelbrot Set in Julia
# This file is machine-generated - editing it directly is not advised
[[AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "051c95d6836228d120f5f4b984dd5aba1624f716"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "0.5.0"
[[AbstractTrees]]
deps = ["Markdown"]
@Wikunia
Wikunia / fourier.jl
Created November 9, 2020 19:04
JuliaLang logo using Fourier series
#=
Drawing Julia using a Fourier series.
A high definition animation can be seen here: https://youtu.be/rrmx2Q3sO1Y
This code is based on code kindly provided by ric-cioffi (https://github.com/ric-cioffi)
But was rewritten for v0.3 by Ole Kröger.
=#
using Javis, FFTW, FFTViews
@Wikunia
Wikunia / Google Colab Gdrive
Last active November 9, 2021 01:22
Google Colab gdrive
- Provide API keys
```
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
@Wikunia
Wikunia / Manifest_1,5.toml
Created July 20, 2021 16:55
VideoIO duration issue
# This file is machine-generated - editing it directly is not advised
[[AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "485ee0867925449198280d4af84bdb46a2a404d0"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "1.0.1"
[[Adapt]]
deps = ["LinearAlgebra"]
@Wikunia
Wikunia / binet.jl
Created July 2, 2020 09:59
Binet Matt Parker
using Plots
const Φ = (1+√5)/2
const ξ = (1-√5)/2
function binet(n)
c = Complex(n)
return (Φ^c - ξ^c)/√5
end
using JuMP, ConstraintSolver, Combinatorics
const CS = ConstraintSolver
"""
get_possible_splits(p, n, wished_sum, split_point)
p = possible numbers like 1:9 in a normal numoku
n = number of elements in a row
wished_sum = the sum of a row
split_point = index of where the left part should be a multiple of the right part or the other way around
@Wikunia
Wikunia / eternity.jl
Created April 29, 2020 16:21
Eternity
using ConstraintSolver
using JuMP
const CS = ConstraintSolver
include("plot_search_space.jl")
function read_puzzle(fname)
lines = readlines("data/$fname")
npieces = length(lines)
puzzle = zeros(Int, (npieces, 5))
for i=1:npieces
@Wikunia
Wikunia / graph_coloring_mip.jl
Created October 15, 2019 09:55
Graph Coloring MIP using JuMP
using JuMP, GLPK
function graph_coloring(;fast=true, benchmark=false)
m = Model(with_optimizer(GLPK.Optimizer, msg_lev = 3))
@variable(m, max_color, Int)
@variable(m, c[1:49,1:4], Bin)
@objective(m, Min, max_color)
@Wikunia
Wikunia / plot_animation.jl
Created October 8, 2019 21:12
Plot polar prime animation
using Plots
using ColorSchemes
using Primes
using Plots.PlotMeasures
function plot_primes(x)
l_primes = primes(x)
colors = get(ColorSchemes.summer, [i/x for i in l_primes])
anim = Animation("temp", String[])
for i=1:100