Skip to content

Instantly share code, notes, and snippets.

View floffy-f's full-sized avatar

Florian Vincent floffy-f

  • INRIA
  • Grenoble
  • 16:50 (UTC +01:00)
View GitHub Profile
@floffy-f
floffy-f / notations_block.typ
Created August 28, 2025 18:02
Makes a block that should be put at the top-right of a slide in typst
// Makes a block that should be put at the top-right of a slide in typst.
// Adjust the dy and dx to fit the line length you use, this is set for my default 30pt fontsize.
// Input multiple content blocks to put them side by side.
#let notations = (..contents) => place(top+right, dy: -1.5em, dx: 1.5em, block(inset: 0%, outset: 5pt, fill: red.transparentize(60%), width: 20%*(contents.pos()).len(), height: auto, radius: (bottom-left: 20%))[
#set align(top+left)
#set text(0.65em)
#set text(0.6em)
#emoji.gear *Notations:*
#stack(dir: ltr, spacing: 1em, ..contents)
])
@floffy-f
floffy-f / ldconfig-fix.sh
Last active November 17, 2024 03:21 — forked from metzenseifner/ldconfig-fix.sh
Fix ldconfig "file is empty, not checked" error
# --overwrite '*' whereby * means every file path; reinstall everything otherwise you might get "exists in filesystem" errors
pacman -Syyu $(pacman -Qnq) --overwrite '**.so*'
s/snippet \([^ ]\+\)\(\s\?\)\(\([^ ]* \?\)*\)\(\(\n\t.*\)*\)/snippet \1 "\3"\5\rendsnippet/g
s/\t\(.*\)/\1/g
#!/bin/bash
# Put thins in your i3 block:
# workspace_command /usr/local/bin/custom_zellij_bar.sh
# Output readale by i3-bar
RESULT="[{
\"id\": 1,
\"num\": 1,
\"name\": \"<flag>\",
@floffy-f
floffy-f / colored_block.typ
Last active June 30, 2024 16:47
Colored block for theorems in Typst
#let theoremblock(title: [Theorem:], color: green, radius: (top-right: 2pt, bottom-right: 2pt), ..args, body) = {
// The top-title block needs only the
let tr = radius.at(
default: radius.at(
default: radius.at(
default: 0pt,
"right"
),
"top"
),
@floffy-f
floffy-f / md-like_blockquote.typ
Created June 28, 2024 09:19
Typst block quote like markdown
// A Typst block quote that looks like a `>` syntax sugar in markdown (e.g. github renderer).
// Put on top of relevant files.
#show quote.where(block: true): content => block(
fill: luma(245),
inset: (left: 3%, y: 10%),
radius: (right: 5pt),
stroke: (left: 1pt+luma(100)),
content
)
@floffy-f
floffy-f / lowtr_circulant.py
Last active January 29, 2024 14:49
Lower-triangular circulant embedding of pytorch vector
"""
Partially inspired from https://stackoverflow.com/a/70686229
"""
import torch as pt
def lowtr_circulant(diag: pt.Tensor, dim: int=-1):
r"""
From a vector ``diag``, computes its flipped circular embedding with zeros
above the diagonal.
Can be batched in left dimension(s).