Skip to content

Instantly share code, notes, and snippets.

View jeetsukumaran's full-sized avatar

Jeet Sukumaran jeetsukumaran

View GitHub Profile
var utility = require(app.vault.adapter.basePath + "/__annex__/resources/obsidian/scripts/javascript/utility.js")
function formatContributorList(dv, plan) {
let contributors = dv.pages()
.where((p) => p.file.etags.includes(plan.workplanTag))
.where((p) => p.file.path !== plan.file.path)
.sort((p) => p["content-brief"] + p.title + p.file.name)
.map((p) => {
let contributor = [];
let display = p["production-brief"] ?? p["content-brief"] ?? p.title ?? p.file.name;
@jeetsukumaran
jeetsukumaran / noteweights.dataview.js
Created April 30, 2023 08:17
"Lightning rods of thought using Dataview" -- Filter paths in links as well
function runQuery(options) {
options = options || {}
// const excludePatterns = options.excludePatterns ?? []
// const includePatterns = options.includePatterns ?? []
const excludePaths = options.excludePaths ?? []
const includePaths = options.includePaths ?? []
const limit = options.limit ?? 50
const allPages = dv.pages()
let sourcePages = null
if (includePaths.length) {
@jeetsukumaran
jeetsukumaran / pandoc.md
Created February 27, 2023 05:20 — forked from brabect1/pandoc.md
Converting Markdown to PDF with Pandoc. #markup #markdown #pandoc

Converting Markups to PDF with Pandoc

Install packaged versions of Pandoc and TexLive

wget https://mirrors.creativecommons.org/presskit/icons/cc.png

sudo apt-get install \
    pandoc \

texlive-latex-extra texlive-fonts-recommended \

@jeetsukumaran
jeetsukumaran / d.py
Created January 3, 2022 08:28
Simple Bare-Bones Data-as-Attributes Classes
# "heavy" approach (can be useful if you want to derive
# and add simple behavior, e.g. validation etc.)
class Attributes:
def __init__(self, **kwargs):
# Alternatively:
# self.__dict__.update(kwargs)
for k, v in kwargs.items():
setattr(self, k, v)
# or otherwise:
#! /usr/bin/env python
###############################################################################
##
## Copyright 2012 Jeet Sukumaran.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Fountion; either version 3 of the License, or
## (at your option) any ler version.
#! /bin/bash
set -e -o pipefail
prog_name=$(basename ${0})
if [[ -z "$1" || -z "$2" ]]
then
echo "Usage: ${prog_name} <REPO> <SUBDIR> [<DEST>]"
exit 1
# Bash completion of conda environment names {{{3
#
# Triggered on:
# - ``conda activate <TAB>``
# - ``conda ... --clone <TAB>``
# - ``conda ... --name <TAB>``
#
# (C) 2021 Jeet Sukumaran
# (Free to use under the MIT License terms)
function _conda_env_complete() {
# Colorized ``ls``
#
# ``ls`` has native support for colorizing the entries themselves, which can
# be seen by running ``ls --color`` or ``ls --color=auto``, and this can be
# made standard by aliasing these to ``ls`` in your ``.bashrc.
#
# The colors of the file/directory entries themselves can be customized by
# adding the following in your ``~/.bashrc`` :
#
#! /usr/bin/env python
###############################################################################
##
## Copyright 2014 Jeet Sukumaran.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.