This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Plots, Statistics, ImageFiltering | |
## | |
N = 200 | |
img = zeros(N,N) | |
img[80:120,80:120] .= 1 | |
img = img .+ rand(N,N)*0.5 | |
heatmap(img) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#= | |
# Port of Peter Norvig's Common Lisp program from http://norvig.com/java-lisp.html. | |
# | |
# - Julia version: 1.6.2 | |
# - Author: Renato Athaydes | |
# - Date: 2021-07-24 | |
=# | |
const emptyStrings = String[] | |
function printTranslations(io, dict, num, digits, start=1, words=String[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Clang | |
import Clang, Clang.cindex | |
#include("gtk_get_set_gen.jl") | |
extension(f::String) = splitext(f)[2] | |
filename(f::String) = splitext(f)[1] | |
include_path = "/Users/bieler/Downloads/SDL2-2.0.5/include/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MacroTools, MLStyle, Test | |
subst(a) = MLStyle.@match a begin | |
:(sin($x)) => :(cos($x + 1)) | |
_ => a | |
end | |
MacroTools.prewalk(subst, quote | |
sin(x + sin(x)) | |
end) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ApplicationBuilder, GtkREPL, Compat | |
cd("/Users/jbieler/.julia/dev/GtkREPL/") | |
builddir = "/Users/jbieler/.julia/dev/GtkREPL/builddir/GtkREPL.app/Contents/Libraries/" | |
r = s->joinpath("/Users/jbieler/.julia/",s) | |
#Gtk libs | |
gtk_libs = [ | |
:libgdk, | |
:libgdk_pixbuf, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CMAES | |
using Optim, Distributions, Parameters | |
import Optim: ZerothOrderOptimizer, ZerothOrderState, initial_state, update_state!, | |
trace!, assess_convergence, AbstractOptimizerState, update!, value, value!, pick_best_x, | |
pick_best_f | |
struct CMA <: Optim.ZerothOrderOptimizer | |
λ::Int | |
σ::Float64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RemoteEval | |
@enum Messages DONE=1 | |
function start_server() | |
port, server = listenany(8000) | |
@async begin | |
while true | |
sock = accept(server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BinDeps | |
using Compat | |
@BinDeps.setup | |
sdl2 = library_dependency("sdl2", aliases=["sdl2-2.0"]) | |
# package managers | |
if is_linux() | |
provides(AptGet, Dict("sdl2-2.0"=>sdl2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CMAES | |
using Distributions | |
∑(x) = sum(x) | |
function init_constants(xinit,λ,w,μ) | |
D = length(xinit) | |
μ_w = 1.0 / sum(w.^2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
using Optim | |
import Optim: ZerothOrderOptimizer, ZerothOrderState, initial_state, update_state!, trace!, assess_convergence, AbstractOptimizerState, update!, value | |
struct RandomSampler <: ZerothOrderOptimizer | |
σ::Float64 | |
end | |
RandomSampler(; σ=1e-1) = RandomSampler(σ) |
NewerOlder