Skip to content

Instantly share code, notes, and snippets.

View adisarid's full-sized avatar

Adi Sarid adisarid

View GitHub Profile
1b;2d;3c;4d;5b;6c;7c;8a;9d;10c.
python main_program_one_depth_cascade.py --time_limit 12 --export_results_file --instance_location instance30 --budget 20.4698048780488 --load_capacity_factor 0.7 --line_upgrade_capacity_coef_scale 7.73414634146341 --line_establish_cost_coef_scale 0.5 --line_establish_capacity_coef_scale 15.4682926829268 --dump_file 733
python main_program_one_depth_cascade.py --time_limit 12 --export_results_file --instance_location instance30 --budget 22.9226341463415 --load_capacity_factor 0.8 --line_upgrade_capacity_coef_scale 8.8390243902439 --line_establish_cost_coef_scale 0.5 --line_establish_capacity_coef_scale 17.6780487804878 --dump_file 737
python main_program_one_depth_cascade.py --time_limit 12 --export_results_file --instance_location instance30 --budget 34.1163414634146 --load_capacity_factor 0.7 --line_upgrade_capacity_coef_scale 7.73414634146341 --line_establish_cost_coef_scale 0.5 --line_establish_capacity_coef_scale 15.4682926829268 --dump_file 741
python main_program_one_depth_cascade.py --time_limit 12 --
library(tidyverse)
tbl <- tribble(~main_cat, ~success, ~projects,
"Dancer", 63, 4,
"Theater", 60, 11,
"Comics", 55, 11,
"Music", 47, 52,
"Art", 42, 28,
"Film & Video", 38, 63,
"Games", 36, 30,
"Design", 36, 30,
@adisarid
adisarid / nifgaim_year.csv
Last active April 27, 2020 18:32
סטטיסטיקה על חללים ונפגעי פעולות איבה 1947-2019
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
חללים פעולות_איבה שנה
197 3 1947
4416 118 1948
295 4 1949
131 6 1950
185 10 1951
145 4 1952
149 15 1953
144 6 1954
141 1 1955
@adisarid
adisarid / rtl_ggplot.R
Created May 7, 2020 18:30
Right to left direction and alignment in ggplot2 charts
library(ggplot2)
ggplot() +
ggtitle(label = "הסימן הזה הפוך!",
subtitle = "\u202bאבל דווקא זה בסדר!") +
theme(plot.title = ggplot2::element_text(hjust = 1),
plot.subtitle = ggplot2::element_text(hjust = 1))
@adisarid
adisarid / symptoms_onset_distribution.R
Created July 8, 2020 19:27
Distribution of symptom onset time from transmission
tibble(plnorm = 0.8*plnorm(q = seq(0, 20, by = 0.1), meanlog = 1.621, sdlog = 0.418),
q = seq(0, 20, by = 0.1)) %>%
ggplot(aes(x = q, y = plnorm)) +
geom_point() +
coord_cartesian(ylim = c(0,1))
# https://www.eurosurveillance.org/content/10.2807/1560-7917.ES.2020.25.10.2000180#html_fulltext
# https://www.acpjournals.org/doi/10.7326/M20-0504
@adisarid
adisarid / example_fct_inorder_frustrations.R
Created July 14, 2020 13:01
Source of many frustrations when using fct_inorder
library(tidyverse)
example1 <- tibble(size = c("A", "A", "C", "C", "B", "B"),
re_order_var = c(1,1,2,2,3,3))
# works as expected:
example1 %>%
arrange(re_order_var) %>%
mutate(size = fct_inorder(size)) %>%
ggplot(aes(size, y = 1)) +
@adisarid
adisarid / bootstrap-rtl.css
Created August 3, 2020 05:50
An adaptation of a right to left cascading style sheet to be used in shinydashboards
/*******************************************************************************
* bootstrap-rtl (version 3.3.4)
* Author: Morteza Ansarinia (http://github.com/morteza)
* Created on: August 13,2015
* Project: bootstrap-rtl
* Copyright: Unlicensed Public Domain
*******************************************************************************/
/*
Work to allow handsontable to go from right to left
example1 <- tribble(~x, ~y, ~x_end, ~y_end,
0, 0, 1, 1,
1.5, 1, 2, 2,
3, 5, 4, 2)
example_pointed <- example1 %>% select(x,y) %>%
bind_rows(example1 %>% select(x_end, y_end) %>% set_names(c("x", "y")))
ggplot(example1, aes(x = x, y = y)) +
geom_segment(aes(x = x, y = y, xend = x_end, yend = y_end), lineend = "round") +
watch_levels <- tribble(~time, ~battery, ~status,
"2020-08-19 18:27", 0.94, "actual",
"2020-08-19 18:27", 0.94, "predicted",
"2020-08-19 22:42", 0.57, "actual",
"2020-08-20 06:42", 0, "actual") %>%
mutate(time = as.POSIXct(time)) %>%
bind_rows(tibble(time = as.POSIXct("2020-08-19 18:27") + (24+5)*60*60 + 120,
battery = 0,
status = "predicted")) %>%
mutate(status = case_when(status == "actual" ~ "What actually happened",