Skip to content

Instantly share code, notes, and snippets.

@taylorhughes
taylorhughes / run-worker.sh
Last active March 23, 2022 19:05
Celery example with tasks of varying length + -Ofair
# tested with celery[redis]==3.1.17
# to run with default configuration -- tasks will take 14 seconds to complete the 20 tasks in start_all() below
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4
# to run with -Ofair -- tasks will take 10 seconds to complete
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4 -Ofair
@wch
wch / app.r
Last active December 18, 2023 16:41
Shiny example app with dynamic number of plots
max_plots <- 5
ui <- fluidPage(
headerPanel("Dynamic number of plots"),
sidebarPanel(
sliderInput("n", "Number of plots", value=1, min=1, max=5)
),
@pitakakariki
pitakakariki / polls.r
Last active August 4, 2016 09:28
Code to generate an interactive SVG graph of NZ general election polling.
###
##
## --- New Zealand General Election Polling ---
##
## Plots polling data scraped from Wikipedia.
##
## - GAM -
##
## The smoothed curves are calculated using a generalised additive model (GAM). The
## smoothing parameter is estimated using cross-validation. This means that the curves