RSQLite::SQLite() |>
DBI::dbConnect(":memory:") |>
RSQLite::dbWriteTable("foo", data.frame(
a = numeric(1E8)
))
invisible(gc())
ps::ps_memory_info()
This file contains hidden or 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
```{r} | |
RSQLite::SQLite() |> | |
DBI::dbConnect(":memory:") |> | |
RSQLite::dbWriteTable("foo", data.frame( | |
a = numeric(1E8) | |
)) | |
invisible(gc()) | |
ps::ps_memory_info() | |
y <- integer(1E8) | |
ps::ps_memory_info() |
This file contains hidden or 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
#' Installs one or more packages using the libraries inside a conda environment | |
#' | |
#' @param packages A vector of package names to install. This is the same as the | |
#' argument you would normally pass to `install.packages` | |
#' @param env The path to the conda environment that already has the dependencies installed into it | |
install_using_conda <- function(packages, env){ | |
env <- normalizePath(env) | |
if (!"withr" %in% rownames(installed.packages())) install.packages("withr") | |
withr::with_envvar( | |
# Tell R where to find the pkgconfig |
This file contains hidden or 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
# Update this according to the GCC version you have from brew | |
GCC_VERSION=12 | |
# You may update this to a later release from https://github.com/3dem/relion/releases | |
RELION_VERSION=3.1.3 | |
brew install cmake gcc openmpi fltk fftw libx11 libtiff | |
export CXX=g++-$GCC_VERSION | |
export CC=gcc-$GCC_VERSION | |
export OMPI_CXX=g++-$GCC_VERSION | |
export OMPI_CC=gcc-$GCC_VERSION |
This file contains hidden or 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
require(purrr) | |
require(dplyr) | |
require(stringr) | |
#' Maps over the keys and values of a vector, but expects the function to return | |
#' a named vector with "key" and "value" entries. These will become the names | |
#' and values of the final vector. Think of this as like a Python dictionary | |
#' comprehension: it takes an iterable and produces a dictionary. | |
#' | |
#' @param l a vector to map over | |
#' @param func the function to apply over that vector, which must return a `list(key=?, value=?)` |
This file contains hidden or 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
import pathlib | |
from git import Repo | |
def last_git_update(path: pathlib.Path) -> int: | |
""" | |
Returns the last date of update as a unix timestamp, according to a git repo | |
""" | |
repo = Repo(path.parent, search_parent_directories=True) | |
commit = next(repo.iter_commits(paths=path)) | |
return commit.authored_date |
This file contains hidden or 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
/* | |
Tells the body to apply the "spin" animation. | |
Change the `2s` to alter the speed. | |
Also change the selector from `body` to some other selector to target something else | |
*/ | |
body { | |
animation: spin 2s infinite linear | |
} | |
/* |
This file contains hidden or 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
// Open up Sever Settings → Emoji in your browser | |
// Open the dev console using F12 | |
// Paste the below script into the dev tools console | |
let str = ""; | |
for (let emoj of document.querySelectorAll('div[class*=emojiRow][class*=card]')){ | |
str += emoj.children[1].innerText; | |
str += '\t' | |
str += emoj.children[0].style['background-image'].replace('url("https://cdn.discordapp.com/emojis/', '').replace('.png?v=1")', ''); | |
str += '\n' | |
} |
This file contains hidden or 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
// Open up Sever Settings → Emoji in your browser | |
// Open the dev console using F12 | |
// Using the inspection tool, look for an element with the class .emojiRow-XXXX | |
// Edit the string ".emojiRow-zIc7ZX" below into whatever class you got from the previous script | |
// Paste the below script into the dev tools console | |
let str = ""; | |
for (let emoj of $$('.emojiRow-zIc7ZX')){ | |
str += emoj.children[1].innerText; | |
str += '\t' | |
str += emoj.children[0].style['background-image'].replace('url("https://cdn.discordapp.com/emojis/', '').replace('.png?v=1")', ''); |
This file contains hidden or 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 prints out a TCG order as a TSV (plain text spreadsheet that can be imported into Excel) | |
// Usage instructions: | |
// 1) Log in to your account and visit https://store.tcgplayer.com/myaccount/orderhistory | |
// 2) Type in the order number that you want printed out into the search bar | |
// 3) Open the dev console using F12 | |
// 4) Click the "Console" tab in the top bar | |
// 5) Copy this entire script to your clipboard | |
// 6) Paste it into the console text box and press enter | |
// 7) A TSV (tab-separated value) table of your TCG Player order will be printed out |
NewerOlder