Skip to content

Instantly share code, notes, and snippets.

Avatar
🤦‍♂️

B. Ogan Mancarcı oganm

🤦‍♂️
View GitHub Profile
@oganm
oganm / roll20Message.R
Created Aug 29, 2020
send messages to roll20 chat using chromote
View roll20Message.R
library(chromote)
startRoll20Session = function(email, password, gameLink,view = FALSE){
b <- chromote::ChromoteSession$new()
if(view){
b$view()
}
b$Page$navigate(gameLink)
b$DOM$enable()
@oganm
oganm / differential download.r
Last active Aug 10, 2020
yeast download for jesse
View differential download.r
library(gemmaAPI)
# identify all yeast datasets
yeastStudies = taxonInfo('yeast',request = 'datasets',limit = 0)
studyIDs = yeastStudies %>% purrr::map_chr('id')
# get metadata for yeast studies
yeastMetadata = studyIDs %>% lapply(compileMetadata,outputType = 'list')
View flagCoords.R
# source https://en.wikipedia.org/wiki/Flag_of_Turkey
# suggested width for narrow images
coverWidth = 590
starOverlap = 2/5-1/3
# approximate and arbitrary
G = coverWidth* (4/3 - starOverlap)
@oganm
oganm / install.R
Last active Apr 7, 2020
install arbitrary packages from command line
View install.R
#!/usr/bin/Rscript
# Rscript install.R packageName
# point of this is to be able to install arbitrary packages from CRAN, github, bioconductor, etc from command line
# used for my remote server where I use the root library to share packages between my user and the shiny user
# sudo install.R glue oganm/ogbox bioc::3.6/affy
library(dplyr)
library(ogbox)
print(.libPaths())
@oganm
oganm / pkgRank.R
Created May 8, 2019
cranlogs package rank
View pkgRank.R
library(cranlogs)
library(dplyr)
allPackages = available.packages() %>% rownames
groups = cut(seq_along(allPackages), breaks = seq(0,length(allPackages),20)) %>% {.=as.character(.);.[is.na(.)]='last';factor(.,levels = unique(.))}
package_groups = split(allPackages,groups)
package_groups %>% lapply(function(x){
View terrainStuff.R
library(rayshader)
library(ambient)
k = 8
m = noise_perlin(dim = c(2^k,2^k),octaves = 9)
mToMap(m)
m = noise_simplex(c(2^k,2^k),fractal = 'fbm',octaves = 4,lacunarity = 2,gain = .5,frequency = .01)
View notes.lua
for i in pairs(table) do print(i) end -- list things in table
View parser.R
library(dplyr)
generatePatterns = function(patterns, # final outputs here
helperPatterns = NULL, # intermediate patterns that won't be returned here
.open= '{', .close = '}'){
for (i in seq_along(helperPatterns)){
helperPatterns[[i]] = with(helperPatterns[1:i],
{glue::glue(helperPatterns[[i]],
@oganm
oganm / se.R
Last active Dec 6, 2019
dplyr standard evaluation recipes
View se.R
library(dplyr)
diamonds = ggplot2::diamonds
filterBy = 'color'
diamonds %>% filter(!!rlang::sym(filterBy) == 'E')
diamonds %>% group_by(!!rlang::sym(filterBy))
diamonds %>% mutate(!!rlang::sym('new_col'):='yes')
@oganm
oganm / mri.R
Last active Oct 23, 2018
play with mri data
View mri.R
library(OpenImageR)
library(oro.dicom)
library(dplyr)
library(magrittr)
library(magick)
dicompath = '/home/omancarci/Dropbox/MRI'
imageFiles = list.files(file.path(dicompath,'DICOM'),recursive = TRUE,full.names = TRUE)