Skip to content

Instantly share code, notes, and snippets.

Avatar
🟢
Catching up after some long time off... may be slow to respond

Christophe Dervieux cderv

🟢
Catching up after some long time off... may be slow to respond
View GitHub Profile
@cderv
cderv / switch-path.psm1
Last active January 11, 2023 15:25
Switch between Dev and Release Quarto binary
View switch-path.psm1
function Switch-Path {
param()
$paths=$([Environment]::GetEnvironmentVariable('Path','User') -Split ";")
$dev = $paths | Select-String -SimpleMatch "quarto-cli\package\dist\bin"
$rel = $paths | Select-String -SimpleMatch "scoop\shims"
@cderv
cderv / setup-sandbox.ps1
Last active January 6, 2023 17:07
Setup Windows sandbox
View setup-sandbox.ps1
# --- Setup so tools from github release ----------
# --- Tools -----
function Get-GithubLatestRelease {
param (
[parameter(Mandatory)][string]$project, # e.g. paintdotnet/release
[parameter(Mandatory)][string]$pattern, # regex. e.g. install.x64.zip
[switch]$prerelease
@cderv
cderv / update-pandoc.sh
Last active September 8, 2022 15:17
Update scripts - Ubuntu
View update-pandoc.sh
#! /bin/bash
# Using gh cli
gh --repo jgm/pandoc release download --pattern '*amd64.deb'
sudo dpkg -i $(ls pandoc-*.deb)
rm $(ls pandoc-*.deb)
@cderv
cderv / README
Last active July 28, 2022 16:38
Get some component out of a Qmd document
View README
* Set `lang-out` to the language to ignore
* Use the LUA filter to remove the element mark with the languae
```
quarto pandoc --to markdown -L lang-out.lua test.qmd
```
@cderv
cderv / update-org.ps1
Last active June 27, 2022 14:24
Update all repos from an organisation on github
View update-org.ps1
$repos = gh repo list 'quarto-journals' --no-archived --source --json owner,name,defaultBranchRef -q '.[] | {org: .owner.login, repo: .name, branch: .defaultBranchRef.name}' | ConvertFrom-Json
foreach($row in $repos) {
echo "Looking for $($row.repo) folder"
if (Test-Path -Path $row.repo) {
git -C "$($row.repo)" checkout $row.branch
git -C "$($row.repo)" pull origin $row.branch
} else {
gh repo clone "$($row.org)/$($row.repo)"
@cderv
cderv / notes.md
Last active May 5, 2022 16:43
Connect to AZURE VM to test some R stuff
View notes.md

AZURE VM notes

Install azure CLI

Scoop

scoop install azure-cli
@cderv
cderv / custom-reveal-config.html
Last active April 20, 2022 12:23
[ReveaJS] Set code output content dynamically based on remaining space
View custom-reveal-config.html
<script type="text/javascript">
Reveal.on('slidechanged', event => {
getNodes = function(slide) {
var level1 = slide.querySelectorAll(":scope > *")
childs = []
for (let e of level1) {
if (e.nodeName === "DIV" && e.className.includes('cell')) {
var level2 = e.querySelectorAll(":scope > *:not(div.cell-output)")
childs.push(...level2)
@cderv
cderv / compare-hash.ps1
Last active March 30, 2022 08:57
Compare hash of Rstudio daily
View compare-hash.ps1
$wc = [System.Net.WebClient]::new()
$pkgurl = $(curl -s https://dailies.rstudio.com/rstudio/latest/index.json | jq -r '.products.desktop.platforms[\"windows-xcopy\"].link')
$pkgurl
$publishedHash = $(curl -s https://dailies.rstudio.com/rstudio/latest/index.json | jq -r '.products.desktop.platforms[\"windows-xcopy\"].sha256')
$publishedHash
$FileHash = Get-FileHash -InputStream ($wc.OpenRead($pkgurl))
$FileHash.Hash -eq $publishedHash
$FileHash.Hash
$publishedHash
@cderv
cderv / notes.md
Last active January 21, 2022 15:25
Notes on Pandoc's version minimal requirements
@cderv
cderv / README.md
Last active October 4, 2022 15:17
revdepcheck helpers
View README.md

Script that helps me with revdepcheck

Getting setup

Download the scripts

get_gist <- function(where = "revdep/tools") {
  gist_id <- "7018c926b14ec45d1a34e70e018db2d5"
 fs::dir_create(where)