I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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
# alias to edit commit messages without using rebase interactive | |
# example: git reword commithash message | |
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
# edit all commit messages | |
git rebase -i --root | |
# clone all your repos with gh cli tool | |
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone |
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(shiny) | |
library(datasets) | |
Logged = FALSE; | |
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad") | |
# Define server logic required to summarize and view the selected dataset | |
shinyServer(function(input, output) { | |
source("www/Login.R", local = TRUE) | |
observe({ | |
if (USER$Logged == TRUE) { |
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
colour_picker <- function() { | |
n <- length(colours()) | |
i <- ceiling(sqrt(n)) | |
m <- matrix(c(1:n, rep(NA, i^2 - n)), | |
ncol = i, nrow = i) | |
## plotting | |
image(m, col = colours(), | |
xaxt = "n", yaxt = "n") | |
k <- seq(0, 1, length.out = i) | |
kk <- expand.grid(k, k) |
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(shiny) | |
library(gmailr) | |
ui <- fluidPage( | |
textInput("subj", "Subject", "Schedule change"), | |
textInput("text", "Message"), | |
actionButton("btn", "Send") | |
) | |
server <- function(input, output, session) { |
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
# Q on @GitHub: does anyone now how to easily (ie automatically) list all forks | |
# of a repository that have more than N commits in the fork? | |
library(gh) # devtools::install_github("gaborcsardi/gh") | |
forks_n_commits <- function(owner, repo, n = 1) { | |
events <- gh("GET /networks/:owner/:repo/events", owner = owner, repo = repo, .limit = Inf) | |
fork_pushes <- Filter(function(x) x$type == "PushEvent" && x$repo$name != paste0(owner, "/", repo), | |
events) |
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
#compare with https://gist.github.com/expersso/bb03efcab2a6c125da5ac22e1c33d070 | |
url <- "https://github.com/daattali/addinslist/blob/master/README.md#list-of-addins" | |
get_html_table <- function(url){ | |
xx <- xml2::read_html(url) | |
rvest::xml_node(rvest::xml_node(xx,"body"),"table") | |
} | |
tr_to_nms <- function(tbl){ |
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
# This script uploads all the FAST files to the taxonomer server (only one file can be uploaded at a time) | |
# Assumes that you have RSelenium package installed and that you've got a simple selenium example to work | |
if (FALSE) { | |
fastq_files <- c( | |
list.files(# WHERE ARE THE FILES?, pattern = "fastq.gz$", full.names = TRUE) | |
) | |
login_password <- "" # what is my password??? | |
library(RSelenium) |
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(shiny) | |
library(shinyjs) | |
if (!dir.exists('www/')) { | |
dir.create('www') | |
} | |
download.file( | |
url = 'https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js', | |
destfile = 'www/js.cookie.js' |
OlderNewer