Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env julia
using Luxor
Drawing(500, 500, "/tmp/julia-flowers.png")
background("white")
function juliaflowers(cpos::Point, radius; petals=30, outercircleratio=0.75, innercircleratio=0.65)
# clockwise, from bottom LEFT...
points3 = ngon(cpos, radius, 3, pi/6, vertices=true)
@DoktorMike
DoktorMike / keybase.md
Created December 1, 2020 12:29
keybase.md

Keybase proof

I hereby claim:

  • I am doktormike on github.
  • I am doktormike (https://keybase.io/doktormike) on keybase.
  • I have a public key ASBubcSLPxG8QqZdIFF2XHuRO-WLEmzqZk0SzhJqqDjiOwo

To claim this, I am signing this object:

@DoktorMike
DoktorMike / videoconversionsamples.sh
Last active September 5, 2024 21:03
Useful commands for converting videos using ffmpeg
#!/bin/bash
# Examples taken from https://opensource.com/article/17/6/ffmpeg-convert-media-file-formats
# Convert a webm file to a matroska format with a vp9 encoding and keeping the same audio encoding.
# Also changes the bitrate to 1Mb/s
ffmpeg -i input.webm -c:a copy -c:v vp9 -b:v 1M output.mkv
# Same but change the frame rate to 30 FPS and dropping the bitrate conversion
ffmpeg -i input.webm -c:a copy -c:v vp9 -r 30 output.mkv
# Same but only setting the video size to a predetermined format HD 720 in this case
@DoktorMike
DoktorMike / rundataturks.sh
Created April 30, 2020 22:30
Run dataturks image annotation software on prem
#!/bin/bash
docker run -d -p 80:80 klimentij/dataturks:latest
@DoktorMike
DoktorMike / runit.sh
Created April 8, 2020 20:31
Running portainer
# Run it for a single node
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
# Docker compose setup
curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
@DoktorMike
DoktorMike / rstudiodocker.sh
Created March 7, 2020 10:57
Run RStudio server in docker
#!/bin/bash
# ____ ____ _ _ _ ____ _
# | _ \/ ___|| |_ _ _ __| (_) ___ _ | _ \ ___ ___| | _____ _ __
# | |_) \___ \| __| | | |/ _` | |/ _ \ _| |_ | | | |/ _ \ / __| |/ / _ \ '__|
# | _ < ___) | |_| |_| | (_| | | (_) | |_ _| | |_| | (_) | (__| < __/ |
# |_| \_\____/ \__|\__,_|\__,_|_|\___/ |_| |____/ \___/ \___|_|\_\___|_|
#
# Idea from https://medium.com/@guidoman/tutorial-install-and-run-rstudio-server-with-docker-5e67607811a0
# Based on the awesome rocker/tidyverse image
git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA" \
--prune-empty --tag-name-filter cat -- --all
@DoktorMike
DoktorMike / weeklytodaily.R
Created March 3, 2020 08:21
weekly_to_daily_values
library(tidyverse)
library(ISOweek)
library(lubridate)
# Load weekly data
mydf <- read_csv("weeklydata.csv")[, -1] %>% mutate(week = ISOweek(date))
# Create daily dates
firstdate <- min(mydf$date) - 6
lastdate <- max(mydf$date)
@DoktorMike
DoktorMike / generate_openapi_client.sh
Created December 31, 2019 12:15
Generate client code from openapi specification through docker
#!/bin/bash
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/openapi.json \
-g go \
-o /local/out/go
@DoktorMike
DoktorMike / publisherfilter.R
Created May 30, 2019 12:30
Filter away all that match publisherlist
library(tidyverse)
mydf <- tibble(publisher=sample(LETTERS[1:10], 10, replace=TRUE), investment=rnorm(10, 100000, 20000))
mydf
mydf %>% filter(publisher %in% c('B', 'G'))
mydf %>% filter(!(publisher %in% c('B', 'G')))