Skip to content

Instantly share code, notes, and snippets.

View cderv's full-sized avatar

Christophe Dervieux cderv

View GitHub Profile
@cderv
cderv / test.md
Last active March 20, 2023 17:02
Pandoc GFM TOC demo - bug
@cderv
cderv / update-pandoc.sh
Last active October 9, 2023 10:40
Update scripts - Arch Linux
#! /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 / switch-path.psm1
Last active January 11, 2023 15:25
Switch between Dev and Release Quarto binary
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 May 5, 2025 01:28
Setup Windows sandbox
# --- Setup so tools from github release ----------
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
# --- 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 March 18, 2026 17:42
Update scripts - Ubuntu
#! /bin/bash
# Install Pandoc on Linux using gh cli
#
# Usage:
# ./update-pandoc.sh # Install latest stable release
# ./update-pandoc.sh 3.8.3 # Install specific version
# ./update-pandoc.sh --nightly # Download latest nightly build
# check tool requirement
@cderv
cderv / README
Last active May 30, 2023 12:12
Get some component out of a Qmd document
* Set `lang-out` to the language to ignore
* Use the LUA filter to remove the element mark with the language
```
quarto pandoc --to markdown -L lang-out.lua test.qmd
```
@cderv
cderv / update-org.ps1
Last active December 6, 2024 15:27
Update all repos from an organisation on github
# Get organization name from parent directory
$orgName = Split-Path -Path $PSScriptRoot -Leaf
# Prompt user for confirmation
$confirmation = Read-Host -Prompt "Do you want to update repositories for organization '$orgName'? (y/n)"
if ($confirmation -ne 'y') {
Write-Output "Operation cancelled by user"
exit 0
}
@cderv
cderv / notes.md
Last active May 5, 2022 16:43
Connect to AZURE VM to test some R stuff

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
<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
$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