Skip to content

Instantly share code, notes, and snippets.

View ckunte's full-sized avatar

Chetan Kunte ckunte

View GitHub Profile
@ckunte
ckunte / preamble.typ
Last active July 1, 2024 07:57
Typst preamble -- an example
#let cknotes(doc) = {
// settings
set page(
header: align(left)[
#image("logo.png", width: 9%)
],
margin: (
top: 2cm,
y: 2cm,
),
@ckunte
ckunte / Typst-Cyg.sublime-build
Last active July 1, 2024 03:03
A build system for Typst via Cygwin
{
// Ctrl+B to build a .pdf file from .typ (in Sublime Text's current tab)
// Ref: https://forum.sublimetext.com/t/using-cygwin-for-build-system/8307/6
"shell_cmd" : "typst compile \"$file_name\"",
"selector" : "source.typ",
"path" : "C:\\Cygwin\\bin;$path",
"working_dir" : "$file_path"
}
@ckunte
ckunte / smallcaps.typ
Created April 18, 2024 03:54
Turn uppercase words into smallcaps in Typst
// Small caps ( see: https://github.com/typst/typst/discussions/3927 )
// Turn uppercase letters to small caps: use #sc([WORDINCAPS])
// for those that escape the REGEX match
#let sc(content) = text(features: ("c2sc",))[#content]
// For testing, comment the above line, and uncomment the line below
// let sc(content) = text(features: ("c2sc",))[#highlight(content)]
// Turn all uppercase words (any 2 or more grouping of A-Z
// ASCII characters) into small caps
@ckunte
ckunte / ctd.py
Last active April 4, 2024 03:06
Compile Typst document to PDF using Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Compile Typst document
ctd.py 2024 ckunte
Usage: ctd.py (-f <file>)
ctd.py --help
ctd.py --version
@ckunte
ckunte / integrity-hash.sh
Created March 12, 2024 06:33
Generate SHA384 hash for file integrity check attribute in link and script tags
#!/usr/bin/env bash
# 2024 ckunte
cat <filename> | openssl dgst -sha384 -binary | openssl base64 -A | pbcopy
@ckunte
ckunte / books-read.csv
Created February 13, 2024 09:20
Books read to-date
Author Title Read (y) Like?
Arlene Pellicane Calm, Cool, and Connected 2024 Y
Brene Brown The Power of Vulnerability 2023 Y
Yuval Noah Harari Sapiens: A Brief History of Humankind 2023 Y
Yuval Noah Harari Homo Deus: A Brief History of Tomorrow 2023 Y
Yuval Noah Harari 21 Lessons for the 21st Century 2023 Y
Glen van Brummelen Trigonometry 2021 Y
William Zinsser On Writing Well - 30Ed 2021 Y
Mark Manson The Subtle Art of Not Giving a F*ck 2021 O
David Acheson The Calculus Story 2021 Y
@ckunte
ckunte / datestamp-in-vim.md
Created January 14, 2024 11:31
Get date stamp (in Y-m-d H:M format) in Vim from an abbreviation (ds)
abbr <expr> ds strftime('%Y-%m-%d %H:%M')
@ckunte
ckunte / datestamp-in-sublimetext.md
Last active January 14, 2024 11:30
Get date stamp (in Y-m-d H:M format) in Sublime Text from a shortcut (ctrl+shift+d)
  1. From Tools → Developer → New Plugin... within Sublime Text, replace the template with the following python script:

    import sublime
    import sublime_plugin
    from datetime import datetime
    
    class InsertFormattedDateCommand(sublime_plugin.TextCommand):
        def run(self, edit):

formatted_date = datetime.now().strftime("%Y-%m-%d %H:%M")

@ckunte
ckunte / search-email.md
Created May 6, 2023 06:33
Email search (to add rule) in Fastmail

Email search (to add rule) in Fastmail

Fastmail has nice search email options. Here is an example: search for email from either linkedin.com or booking.com, received before:1y, which can be added as a rule to process the findings further.

from:(linkedin.com OR booking.com) AND before:1y
@ckunte
ckunte / wsl-howto.md
Last active May 1, 2023 09:49
Access linux environment from within Windows (via Windows Subsystem for Linux)

Access linux environment from within Windows

via Windows Subsystem for Linux (WSL)

Ubuntu (a debian linux distribution) in Windows Terminal powered by WSL.

Ubuntu (a debian linux distribution) in Windows Terminal powered by WSL.

Purpose