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
#!/usr/bin/env julia | |
using Luxor, Colors | |
function julia_balls() | |
# get centers for the three balls | |
points = reverse(ngon(0, 0, 100, 3, pi/6, vertices=true)) | |
gsave() | |
# setcolor(0.251, 0.388, 0.847) # the darker blue not used | |
# setcolor(0.4, 0.51, 0.878) # the lighter blue not used |
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
#!/usr/bin/env julia | |
using Luxor, Colors | |
function julia_balls() | |
# get centers for the three balls | |
points = reverse(ngon(0, 0, 100, 3, pi/6, vertices=true)) | |
gsave() | |
# setcolor(0.251, 0.388, 0.847) # the darker blue not used | |
# setcolor(0.4, 0.51, 0.878) # the lighter blue not used |
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 Luxor | |
function three_circles(cpos::Point, circle_radius; outercircleratio=0.75, innercircleratio=0.65) | |
fontface("Georgia-Bold") | |
fontsize(26) | |
# clockwise, from bottom LEFT... | |
points3 = ngon(cpos, circle_radius, 3, pi/6, vertices=true) | |
for (n, p) in enumerate(points3) | |
sethue(color_sequence[n][1]...) | |
circle(p, outercircleratio * circle_radius, :fill) |
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 Luxor | |
function drawcell(centerpos, width, height, colornumber; hollow=false) | |
darker_purple = (0.584, 0.345, 0.698) | |
lighter_purple = (0.667, 0.475, 0.757) | |
darker_green = (0.22, 0.596, 0.149) | |
lighter_green = (0.376, 0.678, 0.318) | |
darker_red = (0.796, 0.235, 0.2) | |
lighter_red = (0.835, 0.388, 0.361) | |
color_sequence = [(darker_red, lighter_red), |
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
#!/usr/bin/env julia | |
# inspired by http://stackoverflow.com/questions/40031913/simulate-a-bouncing-ball | |
# and the inspired Chris Rackauckas | |
using DifferentialEquations, ParameterizedFunctions, NLsolve, Luxor | |
f = @ode_def BallBounce begin | |
dy = v | |
dv = -g |
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 Luxor | |
function array2dtogrid(a2d::AbstractArray) | |
g = Tiler(200, 200, size(a2d)[1:2]..., margin=25) | |
for (pos, n) in g | |
setgray(a2d[n]) | |
box(pos, g.tilewidth, g.tileheight, :fill) | |
setgray(1-a2d[n]) | |
text(string(round(a2d[n], 2)), pos, halign=:center) | |
end | |
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
MacBook-Pro ~ $ julia | |
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: https://docs.julialang.org | |
_ _ _| |_ __ _ | Type "?help" for help. | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.6.0-rc1.0 (2017-05-07 00:00 UTC) | |
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release | |
|__/ | x86_64-apple-darwin13.4.0 |
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
julia> Pkg.status() | |
37 required packages: | |
- AstroLib 0.1.0 | |
- Atom 0.6.1 | |
- BenchmarkTools 0.0.8 | |
- Cairo 0.3.0 | |
- ColorSchemes 1.4.0+ master | |
- Combinatorics 0.4.1 | |
- DataFrames 0.10.0 | |
- Documenter 0.11.1 |
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 HTTP, JSON, Query | |
# get data for the julia channel "UC9IuUwwE2xdjQUT_LMLONoA" | |
function getrawdata(nextpagetoken, apikey) | |
d = HTTP.get("https://www.googleapis.com/youtube/v3/search?key=$(apikey)&channelId=UC9IuUwwE2xdjQUT_LMLONoA&pageToken=$(nextpagetoken)&part=snippet,id&order=date&maxResults=50") | |
return d.body | |
end | |
jsonpages = [] # store the json pages, 50 records at a time | |
vidlinks = [] # to hold the video titles and links |
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 Luxor | |
darker_blue = (0.251, 0.388, 0.847) | |
darker_purple = (0.584, 0.345, 0.698) | |
darker_green = (0.22, 0.596, 0.149) | |
darker_red = (0.796, 0.235, 0.2) | |
@png begin | |
w = 256 | |
background("white") | |
origin() |
OlderNewer