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(tidyverse) | |
library(furrr) | |
library(future) | |
future::plan("multicore") | |
L = 1000 | |
M = 100 | |
N = 200 | |
w = rgamma(L, 1) | |
prob = w / sum(w) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Example of thread pool | |
https://docs.python.org/3/library/concurrent.futures.html | |
https://docs.python.org/3/library/multiprocessing.html | |
""" | |
import concurrent.futures as confu | |
import multiprocessing.pool as mpp | |
import 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(ggplot2) | |
library(dplyr) | |
library(stringr) | |
library(pipeR) | |
.data = data_frame(fill=colours()) %>>% | |
mutate(basename=str_extract(fill, '[^\\d]+'), number=extract_numeric(fill)) %>>% | |
dplyr::filter(!(basename %in% c('gray', 'grey') & (number %% 10 != 0))) %>>% | |
replace_na(list(number=0)) %>>% | |
arrange(basename, number) %>>% |
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
<?xml version="1.0"?> | |
<root> | |
<appdef> | |
<appname>RStudio</appname> | |
<equal>org.rstudio.RStudio</equal> | |
</appdef> | |
<item> | |
<name>RStudio</name> | |
<list> | |
<item> |
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
Sub KillLine() | |
Selection.MoveDown Unit:=wdParagraph, Extend:=wdExtend | |
Selection.Cut | |
End Sub | |
Sub BackSpace() | |
Selection.TypeBackspace | |
End Sub | |
Sub Delete() | |
Selection.Delete | |
End Sub |
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
signif_levels = function(tbl) { | |
colnames(tbl) = c("lhs", "rhs", "significant") | |
tbl$lhs = as.character(tbl$lhs) | |
tbl$rhs = as.character(tbl$rhs) | |
print(tbl); cat('\n') | |
output = data.frame(group=unique(c(tbl$lhs, tbl$rhs)), level='' | |
, stringsAsFactors=FALSE) | |
print(output$group); cat('\n') | |
nakama_list = list() | |
j = 1 |
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
#!/usr/bin/osascript | |
tell application "mi" | |
set CommandLines to selection of front document | |
end tell | |
tell application "Terminal" | |
activate | |
ignoring application responses | |
do script with command CommandLines in front window | |
end ignoring |