Skip to content

Instantly share code, notes, and snippets.

View cderv's full-sized avatar

Christophe Dervieux cderv

View GitHub Profile
#!/bin/sh
# Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
@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 / README.md
Last active April 19, 2023 09:21
pretty output for `pandoc lua`

We don't get pretty output by default with pandoc lua like we do with --to native

 pandoc -f markdown -t native
![My Image](local/img/jpg)
^Z
[ Figure
    ( "" , [] , [] )
    (Caption
 Nothing [ Plain [ Str "My" , Space , Str "Image" ] ])
@cderv
cderv / test.md
Last active March 20, 2023 17:02
Pandoc GFM TOC demo - bug
@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 / update-org.ps1
Last active June 27, 2022 14:24
Update all repos from an organisation on github
$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

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
@cderv
cderv / notes.md
Last active January 21, 2022 15:25
Notes on Pandoc's version minimal requirements