package main
import (
"log"
"math/rand"
"sync"
"time"
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
library(shiny) | |
library(quantmod) | |
library(VGAM) | |
# Define server logic for random distribution application | |
shinyServer(function(input, output) { | |
# acquiring data | |
dataInput <- reactive({ | |
if (input$get == 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
package main | |
// Sources: | |
// 1. https://go.dev/tour/methods/15 | |
// 2. https://go.dev/tour/methods/16 | |
// 3. https://stackoverflow.com/questions/6996704/how-to-check-variable-type-at-runtime-in-go-language | |
// 4. https://go.dev/tour/methods/9 | |
// Notions | |
// concrete types like int, float64, string etc |
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
#= assignment of a function to a new name | |
- is shallow copy of a function | |
- in programming parlance: done by reference | |
=# | |
f(x) = 2x | |
g = f | |
g #f (generic function with 1 method) | |
g(2) #4 | |
f(x) = 4x |
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 DataFrames | |
# create a data.frame (simple) | |
df = DataFrame(A=1:4, B=["M", "N", "O", "P"]) | |
df[!, :A] # no copy | |
df[:, :A] # copy is returned | |
# create a data.frame (row by row - not performant, as DataFrames are like in R built columnwise) | |
df2 = DataFrame(A=Int[], B=String[]) | |
push!(df2, (1, "M")); |
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
a_tuple = (1, 2) | |
a_pair = 1 => 2 | |
a_tuple != a_pair | |
# true | |
# The elements are stored in the fields first and second | |
a_pair.first | |
# 1 | |
a_pair.second | |
# 1 | |
typeof(a_pair) |
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
# Generator Expressions | |
# - comprehensions can also be written without the enclosing square brackets, producing an object known as a generator | |
# - can be iterated to produce values on demand, instead of allocating an array and storing them in advance | |
# - Generators are implemented via inner functions. | |
# - simple example | |
(1/n^2 for n=1:1000) | |
# - collect | |
collect(1/n^2 for n=1:1000) | |
# - the following expression sums a series without allocating memory | |
map(tuple, (1/(i+j) for i=1:2, j=1:2), [1 3; 2 4]) |
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
# Ressources: | |
# - https://github.com/r-hub/r-minimal | |
# - https://hosting.analythium.io/best-practices-for-r-with-docker/ | |
# NOTE | |
# does not support Cairo or x11 add hoc, hence renderPlot will not work, renderPlotly und JS backends are working fine | |
# TEST and DEBUG | |
# - build: sudo docker build --build-arg http_proxy=x --build-arg https_proxy=x -t shiny_app_alpine . | |
# - run: sudo docker run -it -p 3899:3838 -v /home/xyz/:/home/xyz/ shiny_app_alpine |
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
# Multithreaded programming in Julia | |
#= | |
Julia supports multiple types of parallelism | |
- SIMD (handled by the compiler) -> for instance the package StaticArrays.jl, short static vectors incline to encourage SIMD operations, a further reason why the package is so efficient | |
- Threads with shared memory (this documents touches upon this point) | |
- Distributed (multi-mode, not sharing memory) | |
- GPUs | |
=# |
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
# DOCUMENTATION | |
# | |
# Sources: http://adv-r.had.co.nz/Exceptions-Debugging.html & https://adv-r.hadley.nz/conditions.html | |
# | |
# - all conditions inherit from abstract class 'condition' | |
# - conditions are being signalled from functions | |
# - R conditions system was inpsired by Common Lisp | |
# | |
# | |
# Ressources: |
OlderNewer